/**
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

#include "himpi_common.h"
#include "himpi_vdec.h"
#include "himpi_venc.h"
#include "himpi_vpc.h"
#include "himpi_pngd.h"

namespace {
PyMethodDef g_methodsHimpi[] = {
    // 公共模块接口
    {"sys_init", WrapHiMpiSysInit, METH_VARARGS, "sys init"},
    {"sys_exit", WrapHiMpiSysExit, METH_VARARGS, "sys exit"},
    {"dvpp_malloc", WrapHiMpiDvppMalloc, METH_VARARGS, "dvpp malloc"},
    {"dvpp_free", WrapHiMpiDvppFree, METH_VARARGS, "dvpp free"},
    {"dvpp_get_version", WrapHiMpiDvppGetVersion, METH_VARARGS, "dvpp get version"},
    {"sys_create_epoll", WrapHiMpiSysCreateEpoll, METH_VARARGS, "sys create epoll"},
    {"sys_ctl_epoll", WrapHiMpiSysCtlEpoll, METH_VARARGS, "sys ctl epoll"},
    {"sys_wait_epoll", WrapHiMpiSysWaitEpoll, METH_VARARGS, "sys wait epoll"},
    {"sys_close_epoll", WrapHiMpiSysCloseEpoll, METH_VARARGS, "sys close epoll"},
    {"sys_set_chn_csc_matrix", WrapHiMpiSysSetChnCscMatrix, METH_VARARGS, "sys set chn csc matrix"},
    {"sys_get_chn_csc_matrix", WrapHiMpiSysGetChnCscMatrix, METH_VARARGS, "sys get chn csc matrix"},
    {"sys_get_image_align_info", WrapHiMpiSysGetImageAlignInfo, METH_VARARGS, "sys get image align info"},

    // 视频、图像解码接口
    {"vdec_create_chn", WrapHiMpiVdecCreateChn, METH_VARARGS, "vdec create chn"},
    {"vdec_destroy_chn", WrapHiMpiVdecDestroyChn, METH_VARARGS, "vdec destroy chn"},
    {"vdec_get_chn_attr", WrapHiMpiVdecGetChnAttr, METH_VARARGS, "vdec get chn attr"},
    {"vdec_set_chn_attr", WrapHiMpiVdecSetChnAttr, METH_VARARGS, "vdec set chn attr"},
    {"vdec_start_recv_stream", WrapHiMpiVdecStartRecvStream, METH_VARARGS, "vdec start recv stream"},
    {"vdec_stop_recv_stream", WrapHiMpiVdecStopRecvStream, METH_VARARGS, "vdec stop recv stream"},
    {"vdec_query_status", WrapHiMpiVdecQueryStatus, METH_VARARGS, "vdec query status"},
    {"vdec_reset_chn", WrapHiMpiVdecResetChn, METH_VARARGS, "vdec reset chn"},
    {"vdec_set_chn_param", WrapHiMpiVdecSetChnParam, METH_VARARGS, "vdec set chn param"},
    {"vdec_get_chn_param", WrapHiMpiVdecGetChnParam, METH_VARARGS, "vdec get chn param"},
    {"vdec_set_protocol_param", WrapHiMpiVdecSetProtocolParam, METH_VARARGS, "vdec set protocol param"},
    {"vdec_get_protocol_param", WrapHiMpiVdecGetProtocolParam, METH_VARARGS, "vdec get protocol param"},
    {"vdec_send_stream", WrapHiMpiVdecSendStream, METH_VARARGS, "vdec send stream"},
    {"vdec_get_frame", WrapHiMpiVdecGetFrame, METH_VARARGS, "vdec get frame"},
    {"vdec_release_frame", WrapHiMpiVdecReleaseFrame, METH_VARARGS, "vdec release frame"},
    {"vdec_get_fd", WrapHiMpiVdecGetFd, METH_VARARGS, "vdec get fd"},
    {"vdec_close_fd", WrapHiMpiVdecCloseFd, METH_VARARGS, "vdec close fd"},
    {"vdec_get_pic_buf_size", WrapHiMpiVdecGetPicBufSize, METH_VARARGS, "vdec get pic buf size"},
    {"vdec_get_tmv_buf_size", WrapHiMpiVdecGetTmvBufSize, METH_VARARGS, "vdec get tvm buf size"},
    {"dvpp_get_image_info", WrapHiMpiDvppGetImageInfo, METH_VARARGS, "dvpp get image info"},
    {"vdec_set_jpegd_precision_mode", WrapHiMpiVdecSetJpegdPrecisionMode, METH_VARARGS,
     "vdec set jpegd precision mode"},
    {"vdec_get_jpegd_output_info", WrapHiMpiVdecGetJpegdOutputInfo, METH_VARARGS, "vdec get jpegd output info"},
    {"vdec_set_display_mode", WrapHiMpiVdecSetDisplayMode, METH_VARARGS, "vdec set display mode"},
    {"vdec_get_display_mode", WrapHiMpiVdecGetDisplayMode, METH_VARARGS, "vdec get display mode"},

    // 视频、图像编码接口
    {"venc_create_chn", WrapHiMpiVencCreateChn, METH_VARARGS, "venc create chn"},
    {"venc_destroy_chn", WrapHiMpiVencDestroyChn, METH_VARARGS, "venc destroy chn"},
    {"venc_start_chn", WrapHiMpiVencStartChn, METH_VARARGS, "venc start chn"},
    {"venc_stop_chn", WrapHiMpiVencStopChn, METH_VARARGS, "venc stop chn"},
    {"venc_query_status", WrapHiMpiVencQueryStatus, METH_VARARGS, "venc query status"},
    {"venc_get_stream", WrapHiMpiVencGetStream, METH_VARARGS, "venc get stream"},
    {"venc_release_stream", WrapHiMpiVencReleaseStream, METH_VARARGS, "venc release stream"},
    {"venc_send_frame", WrapHiMpiVencSendFrame, METH_VARARGS, "venc send frame"},
    {"venc_send_frame_ex", WrapHiMpiVencSendFrameEx, METH_VARARGS, "venc send frame ex"},
    {"venc_set_mod_param", WrapHiMpiVencSetModParam, METH_VARARGS, "venc set mod param"},
    {"venc_get_mod_param", WrapHiMpiVencGetModParam, METH_VARARGS, "venc get mod param"},
    {"venc_request_idr", WrapHiMpiVencRequestIdr, METH_VARARGS, "venc request idr"},
    {"venc_get_fd", WrapHiMpiVencGetFd, METH_VARARGS, "venc get fd"},
    {"venc_close_fd", WrapHiMpiVencCloseFd, METH_VARARGS, "venc close fd"},
    {"venc_set_jpeg_param", WrapHiMpiVencSetJpegParam, METH_VARARGS, "venc set jpeg param"},
    {"venc_get_jpeg_param", WrapHiMpiVencGetJpegParam, METH_VARARGS, "venc get jpeg param"},
    {"venc_set_chn_param", WrapHiMpiVencSetChnParam, METH_VARARGS, "venc set chn param"},
    {"venc_get_chn_param", WrapHiMpiVencGetChnParam, METH_VARARGS, "venc get chn param"},
    {"venc_set_chn_attr", WrapHiMpiVencSetChnAttr, METH_VARARGS, "venc set chn attr"},
    {"venc_get_chn_attr", WrapHiMpiVencGetChnAttr, METH_VARARGS, "venc get chn attr"},
    {"venc_set_scene_mode", WrapHiMpiVencSetSceneMode, METH_VARARGS, "venc set scene mode"},
    {"venc_set_rc_param", WrapHiMpiVencSetRcParam, METH_VARARGS, "venc set rc param"},
    {"venc_get_rc_param", WrapHiMpiVencGetRcParam, METH_VARARGS, "venc get rc param"},
    {"venc_set_jpeg_huffman_param", WrapHiMpiVencSetJpegHuffmanParam, METH_VARARGS, "venc set jpeg huffman param"},
    {"venc_get_jpeg_huffman_param", WrapHiMpiVencGetJpegHuffmanParam, METH_VARARGS, "venc get jpeg huffman param"},
    {"venc_compact_jpeg_tables", WrapHiMpiVencCompactJpegTables, METH_VARARGS, "venc compact jpeg tables"},
    {"venc_send_jpege_frame", WrapHiMpiVencSendJpegeFrame, METH_VARARGS, "venc send jpege frame"},
    {"venc_get_jpege_predicted_size", WrapHiMpiVencGetJpegePredictedSize, METH_VARARGS,
     "venc get jpege predicted size"},
    {"venc_get_scene_mode", WrapHiMpiVencGetSceneMode, METH_VARARGS, "venc get scene mode"},
    {"venc_set_cu_pred", WrapHiMpiVencSetCuPred, METH_VARARGS, "venc set cu pred"},
    {"venc_get_cu_pred", WrapHiMpiVencGetCuPred, METH_VARARGS, "venc get cu pred"},
    {"venc_set_h264_vui", WrapHiMpiVencSetH264Vui, METH_VARARGS, "venc set h264 vui"},
    {"venc_get_h264_vui", WrapHiMpiVencGetH264Vui, METH_VARARGS, "venc get h264 vui"},
    {"venc_set_h265_vui", WrapHiMpiVencSetH265Vui, METH_VARARGS, "venc set h265 vui"},
    {"venc_get_h265_vui", WrapHiMpiVencGetH265Vui, METH_VARARGS, "venc get h265 vui"},
    {"venc_set_intra_refresh", WrapHiMpiVencSetIntraRefresh, METH_VARARGS, "venc venc set intra refresh"},
    {"venc_get_intra_refresh", WrapHiMpiVencGetIntraRefresh, METH_VARARGS, "venc get intra refresh"},
    {"venc_set_ref_param", WrapHiMpiVencSetRefParam, METH_VARARGS, "venc set ref param"},
    {"venc_get_ref_param", WrapHiMpiVencGetRefParam, METH_VARARGS, "venc get ref param"},
    {"venc_set_roi_attr", WrapHiMpiVencSetRoiAttr, METH_VARARGS, "venc set roi attr"},
    {"venc_get_roi_attr", WrapHiMpiVencGetRoiAttr, METH_VARARGS, "venc get roi attr"},
    {"venc_set_slice_split", WrapHiMpiVencSetSliceSplit, METH_VARARGS, "venc set slice split"},
    {"venc_get_slice_split", WrapHiMpiVencGetSliceSplit, METH_VARARGS, "venc get slice split"},
    {"venc_get_qpmap_stride", WrapHiMpiVencGetQpmapStride, METH_VARARGS, "venc get qpmap stride"},
    {"venc_get_qpmap_size", WrapHiMpiVencGetQpmapSize, METH_VARARGS, "venc get qpmap size"},
    {"venc_set_streamcopy_param", WrapHiMpiVencSetStreamcopyParam, METH_VARARGS, "venc set streamcopy param"},
    {"venc_get_streamcopy_param", WrapHiMpiVencGetStreamcopyParam, METH_VARARGS, "venc get streamcopy param"},

    // 图像处理接口
    {"vpc_create_chn", WrapHiMpiVpcCreateChn, METH_VARARGS, "vpc create chn"},
    {"vpc_destroy_chn", WrapHiMpiVpcDestroyChn, METH_VARARGS, "vpc destroy chn"},
    {"vpc_resize", WrapHiMpiVpcResize, METH_VARARGS, "vpc resize"},
    {"vpc_crop", WrapHiMpiVpcCrop, METH_VARARGS, "vpc crop"},
    {"vpc_crop_resize", WrapHiMpiVpcCropResize, METH_VARARGS, "vpc crop resize"},
    {"vpc_crop_resize_paste", WrapHiMpiVpcCropResizePaste, METH_VARARGS, "vpc cropc resize paste"},
    {"vpc_convert_color", WrapHiMpiVpcConvertColor, METH_VARARGS, "vpc convert color"},
    {"vpc_convert_color_v2", WrapHiMpiVpcConvertColorV2, METH_VARARGS, "vpc convert color v2"},
    {"vpc_convert_color_to_yuv420", WrapHiMpiVpcConvertColorToYuv420, METH_VARARGS, "vpc convert color to yuv420"},
    {"vpc_copy_make_border", WrapHiMpiVpcCopyMakeBorder, METH_VARARGS, "vpc copy make border"},
    {"vpc_pyrdown", WrapHiMpiVpcPyrdown, METH_VARARGS, "vpc pyrdown"},
    {"vpc_calc_hist", WrapHiMpiVpcCalcHist, METH_VARARGS, "vpc calc hist"},
    {"vpc_calc_hist_v2", WrapHiMpiVpcCalcHistV2, METH_VARARGS, "vpc calc hist v2"},
    {"vpc_equalize_hist", WrapHiMpiVpcEqualizeHist, METH_VARARGS, "vpc equalize hist"},
    {"vpc_get_process_result", WrapHiMpiVpcGetProcessResult, METH_VARARGS, "vpc get process result"},
    {"vpc_sys_create_chn", WrapHiMpiVpcSysCreateChn, METH_VARARGS, "vpc sys create chn"},
    {"vpc_crop_resize_make_border", WrapHiMpiVpcCropResizeMakeBorder, METH_VARARGS, "vpc crop resize make border"},
    {"vpc_batch_crop_resize_paste", WrapHiMpiVpcBatchCropResizePaste, METH_VARARGS, "vpc batch crop resize paste"},
    {"vpc_batch_crop_resize_make_border", WrapHiMpiVpcBatchCropResizeMakeBorder, METH_VARARGS,
     "vpc batch crop resize make border"},
    {"vpc_crop_resize_resize_paste", WrapHiMpiVpcCropResizeResizePaste, METH_VARARGS, "vpc crop resize resize paste"},
    {"vpc_dilate", WrapHiMpiVpcDilate, METH_VARARGS, "vpc dilate"},
    {"vpc_draw_cover", WrapHiMpiVpcDrawCover, METH_VARARGS, "vpc draw cover"},
    {"vpc_draw_line", WrapHiMpiVpcDrawLine, METH_VARARGS, "vpc draw line"},
    {"vpc_draw_mosaic", WrapHiMpiVpcDrawMosaic, METH_VARARGS, "vpc draw mosaic"},
    {"vpc_draw_osd", WrapHiMpiVpcDrawOsd, METH_VARARGS, "vpc draw osd"},
    {"vpc_blur", WrapHiMpiVpcBlur, METH_VARARGS, "vpc blur"},
    {"vpc_gaussian_blur", WrapHiMpiVpcGaussianBlur, METH_VARARGS, "vpc gaussian blur"},
    {"vpc_erode", WrapHiMpiVpcErode, METH_VARARGS, "vpc erode"},
    {"vpc_filter2d", WrapHiMpiVpcFilter2d, METH_VARARGS, "vpc filter2d"},
    {"vpc_flip", WrapHiMpiVpcFlip, METH_VARARGS, "vpc flip"},
    {"vpc_get_affine_lut", WrapHiMpiVpcGetAffineLut, METH_VARARGS, "vpc get affinelut"},
    {"vpc_get_lut_mem_size", WrapHiMpiVpcGetLutMemSize, METH_VARARGS, "vpc get lut mem size"},
    {"vpc_get_affine_transform", WrapHiMpiVpcGetAffineTransform, METH_VARARGS, "vpc get affine transform"},
    {"vpc_get_perspective_lut", WrapHiMpiVpcGetPerspectiveLut, METH_VARARGS, "vpc get perspective lut"},
    {"vpc_get_remap_lut", WrapHiMpiVpcGetRemapLut, METH_VARARGS, "vpc get remap lut"},
    {"vpc_get_rotation_matrix", WrapHiMpiVpcGetRotationMatrix, METH_VARARGS, "vpc get rotation matrix"},
    {"vpc_lut_remap", WrapHiMpiVpcLutRemap, METH_VARARGS, "vpc lut remap"},
    {"vpc_set_chn_workspace", WrapHiMpiVpcSetChnWorkspace, METH_VARARGS, "vpc set chn workspace"},
    {"vpc_median_blur", WrapHiMpiVpcMedianBlur, METH_VARARGS, "vpc median blur"},
    {"vpc_rotate", WrapHiMpiVpcRotate, METH_VARARGS, "vpc rotate"},
    {"vpc_warp_affine", WrapHiMpiVpcWarpAffine, METH_VARARGS, "vpc warp affine"},
    {"vpc_set_chn_opt_attr", WrapHiMpiVpcSetChnOptAttr, METH_VARARGS, "vpc set chn opt attr"},

    // pngd图像解码
    {"pngd_create_chn", WrapHiMpiPngdCreateChn, METH_VARARGS, "pngd create chn"},
    {"pngd_destroy_chn", WrapHiMpiPngdDestroyChn, METH_VARARGS, "pngd destroy chn"},
    {"pngd_send_stream", WrapHiMpiPngdSendStream, METH_VARARGS, "pngd send stream"},
    {"pngd_get_image_data", WrapHiMpiPngdGetImageData, METH_VARARGS, "pngd get image data"},
    {"png_get_image_info", WrapHiMpiPngGetImageInfo, METH_VARARGS, "png get image info"},
    {nullptr, nullptr, 0, nullptr}};
}

PyMethodDef* GetHimpiMethods() { return g_methodsHimpi; }