History

lavc: move CODEC_FLAG_NORMALIZE_AQP to mpegvideo

Anton Khirnov committed 12 years ago

Commit b2c31711 parent 5fcceda7 files · +28 −4Browse files

Unified · Split

7 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +7 −1
  3. libavcodec/mpegvideo.h +2 −0
  4. libavcodec/mpegvideo_enc.c +7 −0
  5. libavcodec/options_table.h +2 −0
  6. libavcodec/ratecontrol.c +2 −2
  7. libavcodec/version.h +4 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2013-12-xx · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162014-04-xx - xxxxxxx - lavc 55.50.1 - avcodec.h
17 Deprecate CODEC_FLAG_NORMALIZE_AQP. It is replaced by the flag "naq" in the
18 "mpv_flags" private option of the mpegvideo encoders.
19
162014-04-xx - xxxxxxx - avcodec.h202014-04-xx - xxxxxxx - avcodec.h
17 Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing21 Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing
18 reference-counted frames to encoders.22 reference-counted frames to encoders.
libavcodec/avcodec.h+7−1
@@ -691,7 +691,13 @@ typedef struct RcOverride{ · 690 unmodified lines
691#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.691#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
692#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random692#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
693 location instead of only at frame boundaries. */693 location instead of only at frame boundaries. */
694#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.694#if FF_API_NORMALIZE_AQP
695/**
696 * @deprecated use the flag "naq" in the "mpv_flags" private option of the
697 * mpegvideo encoders
698 */
699#define CODEC_FLAG_NORMALIZE_AQP 0x00020000
700#endif
695#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.701#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
696#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.702#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
697#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.703#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
libavcodec/mpegvideo.h+2−0
@@ -649,6 +649,7 @@ typedef struct MpegEncContext { · 648 unmodified lines
649#define FF_MPV_FLAG_STRICT_GOP 0x0002649#define FF_MPV_FLAG_STRICT_GOP 0x0002
650#define FF_MPV_FLAG_QP_RD 0x0004650#define FF_MPV_FLAG_QP_RD 0x0004
651#define FF_MPV_FLAG_CBP_RD 0x0008651#define FF_MPV_FLAG_CBP_RD 0x0008
652#define FF_MPV_FLAG_NAQ 0x0010
652 653
653#define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x)654#define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x)
654#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)655#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
@@ -658,6 +659,7 @@ typedef struct MpegEncContext { · 3 unmodified lines
658{ "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" },\659{ "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" },\
659{ "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" },\660{ "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" },\
660{ "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" },\661{ "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" },\
662{ "naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_NAQ }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
661{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\663{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
662 FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\664 FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
663{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\665{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
libavcodec/mpegvideo_enc.c+7−0
@@ -780,6 +780,13 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) · 779 unmodified lines
780 FF_ENABLE_DEPRECATION_WARNINGS;780 FF_ENABLE_DEPRECATION_WARNINGS;
781#endif781#endif
782 782
783#if FF_API_NORMALIZE_AQP
784 FF_DISABLE_DEPRECATION_WARNINGS
785 if (avctx->flags & CODEC_FLAG_NORMALIZE_AQP)
786 s->mpv_flags |= FF_MPV_FLAG_NAQ;
787 FF_ENABLE_DEPRECATION_WARNINGS;
788#endif
789
783 if (avctx->b_frame_strategy == 2) {790 if (avctx->b_frame_strategy == 2) {
784 for (i = 0; i < s->max_b_frames + 2; i++) {791 for (i = 0; i < s->max_b_frames + 2; i++) {
785 s->tmp_frames[i] = av_frame_alloc();792 s->tmp_frames[i] = av_frame_alloc();
libavcodec/options_table.h+2−0
@@ -63,7 +63,9 @@ static const AVOption avcodec_options[] = { · 62 unmodified lines
63{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"},63{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"},
64{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"},64{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"},
65{"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"},65{"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"},
66#if FF_API_NORMALIZE_AQP
66{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"},67{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"},
68#endif
67{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},69{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
68{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},70{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},
69{"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"},71{"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"},
libavcodec/ratecontrol.c+2−2
@@ -672,7 +672,7 @@ static void adaptive_quantization(MpegEncContext *s, double q) · 671 unmodified lines
672 }672 }
673 673
674 /* handle qmin/qmax clipping */674 /* handle qmin/qmax clipping */
675 if (s->flags & CODEC_FLAG_NORMALIZE_AQP) {675 if (s->mpv_flags & FF_MPV_FLAG_NAQ) {
676 float factor = bits_sum / cplx_sum;676 float factor = bits_sum / cplx_sum;
677 for (i = 0; i < s->mb_num; i++) {677 for (i = 0; i < s->mb_num; i++) {
678 float newq = q * cplx_tab[i] / bits_tab[i];678 float newq = q * cplx_tab[i] / bits_tab[i];
@@ -697,7 +697,7 @@ static void adaptive_quantization(MpegEncContext *s, double q) · 18 unmodified lines
697 float newq = q * cplx_tab[i] / bits_tab[i];697 float newq = q * cplx_tab[i] / bits_tab[i];
698 int intq;698 int intq;
699 699
700 if (s->flags & CODEC_FLAG_NORMALIZE_AQP) {700 if (s->mpv_flags & FF_MPV_FLAG_NAQ) {
701 newq *= bits_sum / cplx_sum;701 newq *= bits_sum / cplx_sum;
702 }702 }
703 703
libavcodec/version.h+4−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
30 30
31#define LIBAVCODEC_VERSION_MAJOR 5531#define LIBAVCODEC_VERSION_MAJOR 55
32#define LIBAVCODEC_VERSION_MINOR 5032#define LIBAVCODEC_VERSION_MINOR 50
33#define LIBAVCODEC_VERSION_MICRO 033#define LIBAVCODEC_VERSION_MICRO 1
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
36 LIBAVCODEC_VERSION_MINOR, \36 LIBAVCODEC_VERSION_MINOR, \
@@ -132,5 +132,8 @@ · 95 unmodified lines
132#ifndef FF_API_INPUT_PRESERVED132#ifndef FF_API_INPUT_PRESERVED
133#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 57)133#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 57)
134#endif134#endif
135#ifndef FF_API_NORMALIZE_AQP
136#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 57)
137#endif
135 138
136#endif /* AVCODEC_VERSION_H */139#endif /* AVCODEC_VERSION_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t