From 0c68e066fcbc8f4dc3ff98b65daa025f5e571a26 Mon Sep 17 00:00:00 2001 From: tiano zheng Date: Thu, 6 Jan 2022 00:01:07 +0800 Subject: [PATCH 1/3] Add AVS3 encoder --- configure | 10 ++ libavcodec/Makefile | 2 + libavcodec/allcodecs.c | 4 +- libavcodec/libuavs3e.c | 303 +++++++++++++++++++++++++++++++++++++++++ libavformat/matroska.c | 2 + libavformat/riff.c | 1 + 6 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libuavs3e.c diff --git a/configure b/configure index f113f8f4ec4d..f3d47ed6890e 100755 --- a/configure +++ b/configure @@ -279,6 +279,7 @@ External library support: if openssl, gnutls or mbedtls is not used [no] --enable-libtwolame enable MP2 encoding via libtwolame [no] --enable-libuavs3d enable AVS3 decoding via libuavs3d [no] + --enable-libuavs3e enable AVS3 encoding via uavs3e [no] --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvidstab enable video stabilization using vid.stab [no] --enable-libvmaf enable vmaf filter via libvmaf [no] @@ -289,6 +290,7 @@ External library support: --enable-libwebp enable WebP encoding via libwebp [no] --enable-libx264 enable H.264 encoding via x264 [no] --enable-libx265 enable HEVC encoding via x265 [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libxavs enable AVS encoding via xavs [no] --enable-libxavs2 enable AVS2 encoding via xavs2 [no] --enable-libxcb enable X11 grabbing using XCB [autodetect] @@ -1773,6 +1775,8 @@ EXTERNAL_LIBRARY_GPL_LIST=" libcdio libdavs2 librubberband + libuavs3d + libuavs3e libvidstab libx264 libx265 @@ -1812,6 +1816,7 @@ EXTERNAL_LIBRARY_LIST=" gnutls jni ladspa + libsvthevc libaom libass libbluray @@ -1864,6 +1869,7 @@ EXTERNAL_LIBRARY_LIST=" libtheora libtwolame libuavs3d + libuavs3e libv4l2 libvmaf libvorbis @@ -3363,6 +3369,7 @@ libsvtav1_encoder_deps="libsvtav1" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libuavs3d_decoder_deps="libuavs3d" +libuavs3e_encoder_deps="libuavs3e" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" libvorbis_decoder_deps="libvorbis" libvorbis_encoder_deps="libvorbis libvorbisenc" @@ -3379,6 +3386,7 @@ libx264_encoder_select="atsc_a53" libx264rgb_encoder_deps="libx264" libx264rgb_encoder_select="libx264_encoder" libx265_encoder_deps="libx265" +libsvt_hevc_encoder_deps="libsvthevc" libxavs_encoder_deps="libxavs" libxavs2_encoder_deps="libxavs2" libxvid_encoder_deps="libxvid" @@ -6615,6 +6623,7 @@ enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >= 1.1.41" uavs3d.h uavs3d_decode +enabled libuavs3e && require_pkg_config libuavs3e uavs3e "uavs3e/uavs3e.h" uavs3e_enc enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.5.2" libvmaf.h compute_vmaf @@ -6675,6 +6684,7 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } || die "ERROR: mmal not found" && check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; } +enabled libsvthevc && require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } || die "ERROR: openal not found"; } && diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 995b2792e49d..18a7cb372fde 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1075,6 +1075,7 @@ OBJS-$(CONFIG_LIBSVTAV1_ENCODER) += libsvtav1.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBUAVS3D_DECODER) += libuavs3d.o +OBJS-$(CONFIG_LIBUAVS3E_ENCODER) += libuavs3e.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \ @@ -1088,6 +1089,7 @@ OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER) += libwebpenc_common.o libwebpenc_anim OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER) += libsvt_hevc.o OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d1e10197de68..ae28023b9483 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -783,8 +783,10 @@ extern LIBX264_CONST AVCodec ff_libx264_encoder; #endif extern const AVCodec ff_libx264rgb_encoder; extern AVCodec ff_libx265_encoder; +extern AVCodec ff_libsvt_hevc_encoder; extern const AVCodec ff_libxavs_encoder; -extern const AVCodec ff_libxavs2_encoder; +extern const AVCodec ff_libxavs2_encoder +extern const AVCodec ff_libuavs3e_encoder;; extern const AVCodec ff_libxvid_encoder; extern const AVCodec ff_libzvbi_teletext_decoder; diff --git a/libavcodec/libuavs3e.c b/libavcodec/libuavs3e.c new file mode 100644 index 000000000000..53ab6eb4fa7a --- /dev/null +++ b/libavcodec/libuavs3e.c @@ -0,0 +1,303 @@ +#include +#include +#include +#include +#include +#include +//#include +#include "avcodec.h" +#include "internal.h" +#include "encode.h" +#include "libavutil/internal.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/imgutils.h" +#include "libswscale/swscale.h" +#include "libswscale/swscale_internal.h" +//#include "mxnet_api.h" + +#include "uavs3e/uavs3e.h" + +#define MAX_BUMP_FRM_CNT (8 <<1) +#define MAX_BS_BUF (32*1024*1024) + +static const int color_primaries_tab[10] = { + AVCOL_PRI_RESERVED0 , // 0 + AVCOL_PRI_BT709 , // 1 + AVCOL_PRI_UNSPECIFIED , // 2 + AVCOL_PRI_RESERVED , // 3 + AVCOL_PRI_BT470M , // 4 + AVCOL_PRI_BT470BG , // 5 + AVCOL_PRI_SMPTE170M , // 6 + AVCOL_PRI_SMPTE240M , // 7 + AVCOL_PRI_FILM , // 8 + AVCOL_PRI_BT2020 // 9 +}; + +static const int color_transfer_tab[15] = { + AVCOL_TRC_RESERVED0 , // 0 + AVCOL_TRC_BT709 , // 1 + AVCOL_TRC_UNSPECIFIED , // 2 + AVCOL_TRC_RESERVED , // 3 + AVCOL_TRC_GAMMA22 , // 4 + AVCOL_TRC_GAMMA28 , // 5 + AVCOL_TRC_SMPTE170M , // 6 + AVCOL_TRC_SMPTE240M , // 7 + AVCOL_TRC_LINEAR , // 8 + AVCOL_TRC_LOG , // 9 + AVCOL_TRC_LOG_SQRT , // 10 + AVCOL_TRC_BT2020_12 , // 11 + AVCOL_TRC_SMPTE2084 , // 12 + AVCOL_TRC_UNSPECIFIED , // 13 + AVCOL_TRC_ARIB_STD_B67 // 14 +}; + +static const int color_matrix_tab[12] = { + AVCOL_SPC_RESERVED , // 0 + AVCOL_SPC_BT709 , // 1 + AVCOL_SPC_UNSPECIFIED , // 2 + AVCOL_SPC_RESERVED , // 3 + AVCOL_SPC_FCC , // 4 + AVCOL_SPC_BT470BG , // 5 + AVCOL_SPC_SMPTE170M , // 6 + AVCOL_SPC_SMPTE240M , // 7 + AVCOL_SPC_BT2020_NCL , // 8 + AVCOL_SPC_BT2020_CL , // 9 + AVCOL_SPC_UNSPECIFIED , // 10 + AVCOL_SPC_UNSPECIFIED // 11 +}; + +typedef struct UAVS3EContext { + AVClass *class; + void* handle; + enc_cfg_t avs3_cfg; + + /* configuration */ + int threads_wpp; + int threads_frm; + int baseQP; + int baseCRF; + int speed_level; + int intra_period; + int hdr; + int close_gop; + char* hdr_ext; + int rc_type; +} UAVS3EContext; + +static int uavs3e_init(AVCodecContext *avctx) +{ + UAVS3EContext *ec = avctx->priv_data; + uavs3e_load_default_cfg(&ec->avs3_cfg); + + if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { + ec->avs3_cfg.bit_depth_input = 8; + ec->avs3_cfg.bit_depth_internal = 8; + } else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE){ +#if (BIT_DEPTH == 10) + ec->avs3_cfg.bit_depth_input = 10; + ec->avs3_cfg.bit_depth_internal = 10; +#else + return -1; +#endif + } else { + return -1; + } + + av_log(NULL, AV_LOG_INFO, "Internal depth: %d input depth %d\n", ec->avs3_cfg.bit_depth_internal, ec->avs3_cfg.bit_depth_input); + + ec->avs3_cfg.horizontal_size = avctx->coded_width; + ec->avs3_cfg.vertical_size = avctx->coded_height; + ec->avs3_cfg.fps_num = avctx->time_base.den; + ec->avs3_cfg.fps_den = avctx->time_base.num; + ec->avs3_cfg.wpp_threads = ec->threads_wpp; + ec->avs3_cfg.frm_threads = ec->threads_frm; + ec->avs3_cfg.qp = ec->baseQP; + ec->avs3_cfg.rc_crf = ec->baseCRF; + ec->avs3_cfg.rc_type = ec->rc_type; + ec->avs3_cfg.i_period = ec->intra_period; + ec->avs3_cfg.close_gop = ec->close_gop; + ec->avs3_cfg.speed_level = ec->speed_level; + + if (avctx->bit_rate) { + ec->avs3_cfg.rc_type = 2; + ec->avs3_cfg.rc_bitrate = avctx->bit_rate / 1000; + ec->avs3_cfg.rc_max_bitrate = ec->avs3_cfg.rc_bitrate * 2; + ec->avs3_cfg.rc_min_qp = 16; + ec->avs3_cfg.rc_max_qp = 63; + } + + av_log(NULL, AV_LOG_INFO, "uavs3e cfg: %dx%d %d/%dfps gop:%d\n", ec->avs3_cfg.pic_width, ec->avs3_cfg.pic_height, + ec->avs3_cfg.fps_num, ec->avs3_cfg.fps_den, ec->avs3_cfg.i_period); + if (avctx->bit_rate) { + av_log(NULL, AV_LOG_INFO, "uavs3e cfg: bitrate: %d kbps\n", ec->avs3_cfg.rc_bitrate); + } else { + av_log(NULL, AV_LOG_INFO, "uavs3e cfg: %s: %d\n", ec->avs3_cfg.rc_type == 0 ? "CQP" : "CRF", ec->avs3_cfg.rc_type == 0 ? ec->avs3_cfg.qp : ec->avs3_cfg.rc_crf); + } + av_log(NULL, AV_LOG_INFO, "uavs3e cfg: wpp_thread:%d frm_thread:%d\n", ec->avs3_cfg.wpp_threads, ec->avs3_cfg.frm_threads); + + ec->handle = uavs3e_create(&ec->avs3_cfg, NULL); + + return 0; +} + +static void __imgb_cpy_plane(void *src, void *dst, int bw, int h, int s_src, int s_dst) +{ + int i; + unsigned char *s, *d; + s = (unsigned char *)src; + d = (unsigned char *)dst; + for (i = 0; i < h; i++) { + memcpy(d, s, bw); + s += s_src; + d += s_dst; + } +} + +static void uavs3e_image_copy_pic(void *dst[4], int i_dst[4], unsigned char *const src[4], const int i_src[4], enum AVPixelFormat pix_fmts, int width, int height) +{ + if(sizeof(pel)>1 && pix_fmts==AV_PIX_FMT_YUV420P){ //sizeof(pel)==2 when BIT_DEPTH == 10 + //Expand YUV420P to 2-byte + for(int plane=0;plane<3;plane++){ + int planeheight=(plane==0)?height:height>>1; + int planewidth=(plane==0)?width:width>>1; + + pel *dstpel = (pel *)dst[plane]; + int ind_src = 0; + int ind_dst = 0; + + for (int y = 0; y < planeheight; y++) { + for (int x = 0; x < planewidth; x++) { + dstpel[ind_dst + x] = src[plane][ind_src + x]; //byte to short + }//for (int x = 0; x < planewidth; x++) + ind_src += i_src[plane]; + ind_dst += (i_dst[plane]>>1); + }//for (int y = 0; y < planeheight; y++) + }//for(int plane=0;plane<3;plane++) + } + else{ + width=(sizeof(pel)>1)?width<<1:width; + __imgb_cpy_plane(src[0], dst[0], width, height, i_src[0], i_dst[0]); + __imgb_cpy_plane(src[1], dst[1], width >> 1, height >> 1, i_src[1], i_dst[1]); + __imgb_cpy_plane(src[2], dst[2], width >> 1, height >> 1, i_src[2], i_dst[2]); + } +} + +static int uavs3e_encode_frame(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *frame, int *got_packet) +{ + UAVS3EContext *ec = avctx->priv_data; + enc_stat_t stat = {0}; + com_img_t *img_enc = NULL; + + int ret; + + if (ff_alloc_packet(avctx, pkt, MAX_BS_BUF) < 0) { + return -1; + } + + if (frame) { + uavs3e_get_img(ec->handle, &img_enc); + img_enc->pts = frame->pts; + uavs3e_image_copy_pic(img_enc->planes, img_enc->stride, frame->data, frame->linesize, avctx->pix_fmt, img_enc->width[0], img_enc->height[0]); + } + + ret = uavs3e_enc(ec->handle, &stat, img_enc); + + if (ret == COM_OK) { + *got_packet = 1; + memcpy(pkt->data, stat.buf, stat.bytes); + pkt->size = stat.bytes; + pkt->pts = stat.pts; + pkt->dts = stat.dts - 4 * avctx->time_base.num; + + if (stat.type == SLICE_I) { + pkt->flags |= AV_PKT_FLAG_KEY; + } else { + pkt->flags &= ~AV_PKT_FLAG_KEY; + } + +#if FF_API_CODED_FRAME + FF_DISABLE_DEPRECATION_WARNINGS + avctx->coded_frame->pts = stat.pts; + switch (stat.type) { + case SLICE_I: + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; + break; + case SLICE_P: + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; + break; + case SLICE_B: + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; + break; + default: + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_NONE; + } + avctx->coded_frame->key_frame = (stat.type == SLICE_I); + FF_ENABLE_DEPRECATION_WARNINGS +#endif + } else { + *got_packet = 0; + } + + return 0; +} + +static int uavs3e_close(AVCodecContext *avctx) +{ + UAVS3EContext *ec = avctx->priv_data; + uavs3e_free(ec->handle); + + return 0; +} + +#define OFFSET(x) offsetof(UAVS3EContext, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + +static const AVOption options[] = { + { "thds_wpp", "Wavefront threads", OFFSET(threads_wpp ), AV_OPT_TYPE_INT, {.i64 = 8 }, 1, 256, VE }, + { "thds_frm", "Frame threads", OFFSET(threads_frm ), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, 64, VE }, + { "qp", "Quantization parameter", OFFSET(baseQP ), AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE }, + { "crf", "CRF parameter", OFFSET(baseCRF ), AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE }, + { "speed", "Speed level", OFFSET(speed_level ), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, 6, VE }, + { "iperiod", "Intra period", OFFSET(intra_period), AV_OPT_TYPE_INT, {.i64 = 64 }, 16, 1000, VE }, + { "close_gop", "Enable Close GOP", OFFSET(close_gop ), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, VE }, + { "rc_type", "Rate Control Type", OFFSET(rc_type ), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, VE }, + + { "hdr", "Enable HDR(0:NULL, 1:SDR, 2:SMPTE2084, 3:HLG)", + OFFSET(hdr ), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 3, VE }, + { "hdr_ext", "HDR extension data:[enable:pri_x1:pri_x2:pri_x3:pri_y1:pri_y2:pri_y3:white_x,white_y:max:min:content:picture]", + OFFSET(hdr_ext ), AV_OPT_TYPE_STRING, {.str = "[0:0:0:0:0:0:0:0:0:0:0:0:0]" }, 0, 0, VE }, + { NULL }, +}; + +static const AVClass uavs3e_class = { + .class_name = "libuavs3e", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + +static const AVCodecDefault uavs3e_defaults[] = { + { "b", "0" }, + { NULL }, +}; + +AVCodec ff_libuavs3e_encoder = { + .name = "libuavs3e", + .long_name = NULL_IF_CONFIG_SMALL("libuavs3e Chinese AVS3 (Audio Video Standard)"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_AVS3, + .priv_data_size = sizeof(UAVS3EContext), + .init = uavs3e_init, + .encode2 = uavs3e_encode_frame, + .close = uavs3e_close, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, +#if (BIT_DEPTH == 10) + .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_NONE }, +#else + .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, +#endif + .priv_class = &uavs3e_class, + .defaults = uavs3e_defaults, +} ; diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 7c56aba4039c..90d94b65bf79 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -78,6 +78,8 @@ const CodecTags ff_mkv_codec_tags[]={ {"S_HDMV/TEXTST" , AV_CODEC_ID_HDMV_TEXT_SUBTITLE}, {"V_AV1" , AV_CODEC_ID_AV1}, + {"V_AVS2" , AV_CODEC_ID_AVS2}, + {"V_AVS3" , AV_CODEC_ID_AVS3}, {"V_DIRAC" , AV_CODEC_ID_DIRAC}, {"V_FFV1" , AV_CODEC_ID_FFV1}, {"V_MJPEG" , AV_CODEC_ID_MJPEG}, diff --git a/libavformat/riff.c b/libavformat/riff.c index 27a970651096..614e8294ad22 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -373,6 +373,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') }, { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') }, { AV_CODEC_ID_AVS2, MKTAG('A', 'V', 'S', '2') }, + { AV_CODEC_ID_AVS3, MKTAG('A', 'V', 'S', '3') }, { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') }, { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') }, From db88f00a1732a8d3169c2d0b81d6bfca954148ca Mon Sep 17 00:00:00 2001 From: tiano zheng Date: Thu, 6 Jan 2022 00:17:46 +0800 Subject: [PATCH 2/3] Fix typo --- libavcodec/allcodecs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ae28023b9483..4efbcfa2a6eb 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -785,8 +785,8 @@ extern const AVCodec ff_libx264rgb_encoder; extern AVCodec ff_libx265_encoder; extern AVCodec ff_libsvt_hevc_encoder; extern const AVCodec ff_libxavs_encoder; -extern const AVCodec ff_libxavs2_encoder -extern const AVCodec ff_libuavs3e_encoder;; +extern const AVCodec ff_libxavs2_encoder; +extern const AVCodec ff_libuavs3e_encoder; extern const AVCodec ff_libxvid_encoder; extern const AVCodec ff_libzvbi_teletext_decoder; From 53346ddcbcea7ad62ad213cb4023b09a4f6828d8 Mon Sep 17 00:00:00 2001 From: tiano zheng Date: Thu, 6 Jan 2022 01:51:21 +0800 Subject: [PATCH 3/3] Remove unused head files --- libavcodec/libuavs3e.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/libavcodec/libuavs3e.c b/libavcodec/libuavs3e.c index 53ab6eb4fa7a..aecac881bef5 100644 --- a/libavcodec/libuavs3e.c +++ b/libavcodec/libuavs3e.c @@ -1,22 +1,14 @@ -#include -#include -#include -#include -#include -#include -//#include -#include "avcodec.h" + + +#include "uavs3e/uavs3e.h" + #include "internal.h" -#include "encode.h" -#include "libavutil/internal.h" -#include "libavutil/mem.h" +#include "avcodec.h" + +#include "libavutil/common.h" #include "libavutil/opt.h" -#include "libavutil/imgutils.h" -#include "libswscale/swscale.h" -#include "libswscale/swscale_internal.h" -//#include "mxnet_api.h" -#include "uavs3e/uavs3e.h" +#include "encode.h" #define MAX_BUMP_FRM_CNT (8 <<1) #define MAX_BS_BUF (32*1024*1024)