mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 12:36:41 +08:00 
			
		
		
		
	lavc: move CODEC_FLAG_NORMALIZE_AQP to mpegvideo
This commit is contained in:
		| @@ -13,6 +13,10 @@ libavutil:     2013-12-xx | |||||||
|  |  | ||||||
| API changes, most recent first: | API changes, most recent first: | ||||||
|  |  | ||||||
|  | 2014-04-xx - xxxxxxx - lavc 55.50.1 - avcodec.h | ||||||
|  |   Deprecate CODEC_FLAG_NORMALIZE_AQP. It is replaced by the flag "naq" in the | ||||||
|  |   "mpv_flags" private option of the mpegvideo encoders. | ||||||
|  |  | ||||||
| 2014-04-xx - xxxxxxx - avcodec.h | 2014-04-xx - xxxxxxx - avcodec.h | ||||||
|   Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing |   Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing | ||||||
|   reference-counted frames to encoders. |   reference-counted frames to encoders. | ||||||
|   | |||||||
| @@ -691,7 +691,13 @@ typedef struct RcOverride{ | |||||||
| #define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding. | #define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding. | ||||||
| #define CODEC_FLAG_TRUNCATED       0x00010000 /** Input bitstream might be truncated at a random | #define CODEC_FLAG_TRUNCATED       0x00010000 /** Input bitstream might be truncated at a random | ||||||
|                                                   location instead of only at frame boundaries. */ |                                                   location instead of only at frame boundaries. */ | ||||||
| #define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< Normalize adaptive quantization. | #if FF_API_NORMALIZE_AQP | ||||||
|  | /** | ||||||
|  |  * @deprecated use the flag "naq" in the "mpv_flags" private option of the | ||||||
|  |  * mpegvideo encoders | ||||||
|  |  */ | ||||||
|  | #define CODEC_FLAG_NORMALIZE_AQP  0x00020000 | ||||||
|  | #endif | ||||||
| #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. | #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. | ||||||
| #define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay. | #define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay. | ||||||
| #define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe. | #define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe. | ||||||
|   | |||||||
| @@ -649,6 +649,7 @@ typedef struct MpegEncContext { | |||||||
| #define FF_MPV_FLAG_STRICT_GOP   0x0002 | #define FF_MPV_FLAG_STRICT_GOP   0x0002 | ||||||
| #define FF_MPV_FLAG_QP_RD        0x0004 | #define FF_MPV_FLAG_QP_RD        0x0004 | ||||||
| #define FF_MPV_FLAG_CBP_RD       0x0008 | #define FF_MPV_FLAG_CBP_RD       0x0008 | ||||||
|  | #define FF_MPV_FLAG_NAQ          0x0010 | ||||||
|  |  | ||||||
| #define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x) | #define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x) | ||||||
| #define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) | #define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) | ||||||
| @@ -658,6 +659,7 @@ typedef struct MpegEncContext { | |||||||
| { "strict_gop",     "Strictly enforce gop size",             0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | { "strict_gop",     "Strictly enforce gop size",             0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | ||||||
| { "qp_rd",          "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_QP_RD },  0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | { "qp_rd",          "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_QP_RD },  0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | ||||||
| { "cbp_rd",         "use rate distortion optimization for CBP",          0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | { "cbp_rd",         "use rate distortion optimization for CBP",          0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | ||||||
|  | { "naq",            "normalize adaptive quantization",                   0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_NAQ },    0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ | ||||||
| { "luma_elim_threshold",   "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\ | { "luma_elim_threshold",   "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\ | ||||||
|                                                                       FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ |                                                                       FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ | ||||||
| { "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\ | { "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\ | ||||||
|   | |||||||
| @@ -780,6 +780,13 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) | |||||||
|     FF_ENABLE_DEPRECATION_WARNINGS; |     FF_ENABLE_DEPRECATION_WARNINGS; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if FF_API_NORMALIZE_AQP | ||||||
|  |     FF_DISABLE_DEPRECATION_WARNINGS | ||||||
|  |     if (avctx->flags & CODEC_FLAG_NORMALIZE_AQP) | ||||||
|  |         s->mpv_flags |= FF_MPV_FLAG_NAQ; | ||||||
|  |     FF_ENABLE_DEPRECATION_WARNINGS; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|     if (avctx->b_frame_strategy == 2) { |     if (avctx->b_frame_strategy == 2) { | ||||||
|         for (i = 0; i < s->max_b_frames + 2; i++) { |         for (i = 0; i < s->max_b_frames + 2; i++) { | ||||||
|             s->tmp_frames[i] = av_frame_alloc(); |             s->tmp_frames[i] = av_frame_alloc(); | ||||||
|   | |||||||
| @@ -63,7 +63,9 @@ static const AVOption avcodec_options[] = { | |||||||
| {"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, | {"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, | ||||||
| {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, | {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, | ||||||
| {"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"}, | {"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"}, | ||||||
|  | #if FF_API_NORMALIZE_AQP | ||||||
| {"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, | {"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, | ||||||
|  | #endif | ||||||
| {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, | {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, | ||||||
| {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, | {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, | ||||||
| {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, | {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, | ||||||
|   | |||||||
| @@ -672,7 +672,7 @@ static void adaptive_quantization(MpegEncContext *s, double q) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* handle qmin/qmax clipping */ |     /* handle qmin/qmax clipping */ | ||||||
|     if (s->flags & CODEC_FLAG_NORMALIZE_AQP) { |     if (s->mpv_flags & FF_MPV_FLAG_NAQ) { | ||||||
|         float factor = bits_sum / cplx_sum; |         float factor = bits_sum / cplx_sum; | ||||||
|         for (i = 0; i < s->mb_num; i++) { |         for (i = 0; i < s->mb_num; i++) { | ||||||
|             float newq = q * cplx_tab[i] / bits_tab[i]; |             float newq = q * cplx_tab[i] / bits_tab[i]; | ||||||
| @@ -697,7 +697,7 @@ static void adaptive_quantization(MpegEncContext *s, double q) | |||||||
|         float newq      = q * cplx_tab[i] / bits_tab[i]; |         float newq      = q * cplx_tab[i] / bits_tab[i]; | ||||||
|         int intq; |         int intq; | ||||||
|  |  | ||||||
|         if (s->flags & CODEC_FLAG_NORMALIZE_AQP) { |         if (s->mpv_flags & FF_MPV_FLAG_NAQ) { | ||||||
|             newq *= bits_sum / cplx_sum; |             newq *= bits_sum / cplx_sum; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ | |||||||
|  |  | ||||||
| #define LIBAVCODEC_VERSION_MAJOR 55 | #define LIBAVCODEC_VERSION_MAJOR 55 | ||||||
| #define LIBAVCODEC_VERSION_MINOR 50 | #define LIBAVCODEC_VERSION_MINOR 50 | ||||||
| #define LIBAVCODEC_VERSION_MICRO  0 | #define LIBAVCODEC_VERSION_MICRO  1 | ||||||
|  |  | ||||||
| #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||||
|                                                LIBAVCODEC_VERSION_MINOR, \ |                                                LIBAVCODEC_VERSION_MINOR, \ | ||||||
| @@ -132,5 +132,8 @@ | |||||||
| #ifndef FF_API_INPUT_PRESERVED | #ifndef FF_API_INPUT_PRESERVED | ||||||
| #define FF_API_INPUT_PRESERVED   (LIBAVCODEC_VERSION_MAJOR < 57) | #define FF_API_INPUT_PRESERVED   (LIBAVCODEC_VERSION_MAJOR < 57) | ||||||
| #endif | #endif | ||||||
|  | #ifndef FF_API_NORMALIZE_AQP | ||||||
|  | #define FF_API_NORMALIZE_AQP     (LIBAVCODEC_VERSION_MAJOR < 57) | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #endif /* AVCODEC_VERSION_H */ | #endif /* AVCODEC_VERSION_H */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Anton Khirnov
					Anton Khirnov