[FFmpeg-cvslog] avcodec: stop using deprecated codec flags

James Almer git at videolan.org
Sun Mar 26 04:25:55 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Mar 25 21:35:15 2017 -0300| [f5c8d004c28d930d780c9164f7ed6005b88b9be5] | committer: James Almer

avcodec: stop using deprecated codec flags

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5c8d004c28d930d780c9164f7ed6005b88b9be5
---

 libavcodec/aaccoder.c         |  8 ++++----
 libavcodec/aaccoder_twoloop.h | 10 +++++-----
 libavcodec/aacenc.c           |  2 +-
 libavcodec/aacpsy.c           |  6 +++---
 libavcodec/clearvideo.c       |  2 +-
 libavcodec/pngenc.c           |  4 ++--
 libavcodec/psymodel.h         |  2 +-
 libavcodec/snowenc.c          |  4 ++--
 libavcodec/xpmdec.c           |  2 +-
 9 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 9f3b4ed..abd0b9c 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -557,13 +557,13 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
     const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
 
     int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
-        / ((avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
         * (lambda / 120.f);
 
     /** Keep this in sync with twoloop's cutoff selection */
     float rate_bandwidth_multiplier = 1.5f;
     int prev = -1000, prev_sf = -1;
-    int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)
+    int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
         ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
         : (avctx->bit_rate / avctx->channels);
 
@@ -694,12 +694,12 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme
     const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
 
     int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
-        / ((avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
         * (lambda / 120.f);
 
     /** Keep this in sync with twoloop's cutoff selection */
     float rate_bandwidth_multiplier = 1.5f;
-    int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)
+    int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
         ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
         : (avctx->bit_rate / avctx->channels);
 
diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h
index f175c5f..8e1bc88 100644
--- a/libavcodec/aaccoder_twoloop.h
+++ b/libavcodec/aaccoder_twoloop.h
@@ -71,7 +71,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
 {
     int start = 0, i, w, w2, g, recomprd;
     int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
-        / ((avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
+        / ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
         * (lambda / 120.f);
     int refbits = destbits;
     int toomanybits, toofewbits;
@@ -136,7 +136,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
             * (lambda / (avctx->global_quality ? avctx->global_quality : 120));
     }
 
-    if (avctx->flags & CODEC_FLAG_QSCALE) {
+    if (avctx->flags & AV_CODEC_FLAG_QSCALE) {
         /**
          * Constant Q-scale doesn't compensate MS coding on its own
          * No need to be overly precise, this only controls RD
@@ -184,7 +184,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
          * AAC_CUTOFF_FROM_BITRATE is calibrated for effective bitrate.
          */
         float rate_bandwidth_multiplier = 1.5f;
-        int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)
+        int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
             ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
             : (avctx->bit_rate / avctx->channels);
 
@@ -332,7 +332,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
                     sce->coeffs + start,
                     nzslope * cleanup_factor);
                 energy2uplim *= de_psy_factor;
-                if (!(avctx->flags & CODEC_FLAG_QSCALE)) {
+                if (!(avctx->flags & AV_CODEC_FLAG_QSCALE)) {
                     /** In ABR, we need to priorize less and let rate control do its thing */
                     energy2uplim = sqrtf(energy2uplim);
                 }
@@ -346,7 +346,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
                     sce->coeffs + start,
                     2.0f);
                 energy2uplim *= de_psy_factor;
-                if (!(avctx->flags & CODEC_FLAG_QSCALE)) {
+                if (!(avctx->flags & AV_CODEC_FLAG_QSCALE)) {
                     /** In ABR, we need to priorize less and let rate control do its thing */
                     energy2uplim = sqrtf(energy2uplim);
                 }
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 956e974..11da260 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -769,7 +769,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
             start_ch += chans;
         }
 
-        if (avctx->flags & CODEC_FLAG_QSCALE) {
+        if (avctx->flags & AV_CODEC_FLAG_QSCALE) {
             /* When using a constant Q-scale, don't mess with lambda */
             break;
         }
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index a5fec73..e32faaa 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -303,7 +303,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
     float bark;
     int i, j, g, start;
     float prev, minscale, minath, minsnr, pe_min;
-    int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->channels);
+    int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->channels);
 
     const int bandwidth    = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
     const float num_bark   = calc_bark((float)bandwidth);
@@ -314,7 +314,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
     pctx = (AacPsyContext*) ctx->model_priv_data;
     pctx->global_quality = (ctx->avctx->global_quality ? ctx->avctx->global_quality : 120) * 0.01f;
 
-    if (ctx->avctx->flags & CODEC_FLAG_QSCALE) {
+    if (ctx->avctx->flags & AV_CODEC_FLAG_QSCALE) {
         /* Use the target average bitrate to compute spread parameters */
         chan_bitrate = (int)(chan_bitrate / 120.0 * (ctx->avctx->global_quality ? ctx->avctx->global_quality : 120));
     }
@@ -704,7 +704,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
 
     /* 5.6.1.3.2 "Calculation of the desired perceptual entropy" */
     ctx->ch[channel].entropy = pe;
-    if (ctx->avctx->flags & CODEC_FLAG_QSCALE) {
+    if (ctx->avctx->flags & AV_CODEC_FLAG_QSCALE) {
         /* (2.5 * 120) achieves almost transparent rate, and we want to give
          * ample room downwards, so we make that equivalent to QSCALE=2.4
          */
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 91f37e1..e2644e3 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -382,6 +382,6 @@ AVCodec ff_clearvideo_decoder = {
     .init           = clv_decode_init,
     .close          = clv_decode_end,
     .decode         = clv_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
 };
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index f67a546..69b4495 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -873,7 +873,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt,
         if (!pict)
             return AVERROR(EINVAL);
 
-        s->bytestream = s->extra_data = av_malloc(FF_MIN_BUFFER_SIZE);
+        s->bytestream = s->extra_data = av_malloc(AV_INPUT_BUFFER_MIN_SIZE);
         if (!s->extra_data)
             return AVERROR(ENOMEM);
 
@@ -1167,7 +1167,7 @@ AVCodec ff_apng_encoder = {
     .init           = png_enc_init,
     .close          = png_enc_close,
     .encode2        = encode_apng,
-    .capabilities   = CODEC_CAP_DELAY,
+    .capabilities   = AV_CODEC_CAP_DELAY,
     .pix_fmts       = (const enum AVPixelFormat[]) {
         AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,
         AV_PIX_FMT_RGB48BE, AV_PIX_FMT_RGBA64BE,
diff --git a/libavcodec/psymodel.h b/libavcodec/psymodel.h
index 582f040..e5f917d 100644
--- a/libavcodec/psymodel.h
+++ b/libavcodec/psymodel.h
@@ -39,7 +39,7 @@
     22000, \
     sample_rate / 2): (sample_rate / 2))
 #define AAC_CUTOFF(s) ( \
-    (s->flags & CODEC_FLAG_QSCALE) \
+    (s->flags & AV_CODEC_FLAG_QSCALE) \
     ? s->sample_rate / 2 \
     : AAC_CUTOFF_FROM_BITRATE(s->bit_rate, s->channels, s->sample_rate) \
 )
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 5cc7997..ca55914 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -106,11 +106,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
         if (!avctx->stats_out)
             return AVERROR(ENOMEM);
     }
-    if((avctx->flags&AV_CODEC_FLAG_PASS2) || !(avctx->flags&CODEC_FLAG_QSCALE)){
+    if((avctx->flags&AV_CODEC_FLAG_PASS2) || !(avctx->flags&AV_CODEC_FLAG_QSCALE)){
         if(ff_rate_control_init(&s->m) < 0)
             return -1;
     }
-    s->pass1_rc= !(avctx->flags & (AV_CODEC_FLAG_QSCALE|CODEC_FLAG_PASS2));
+    s->pass1_rc= !(avctx->flags & (AV_CODEC_FLAG_QSCALE|AV_CODEC_FLAG_PASS2));
 
     switch(avctx->pix_fmt){
     case AV_PIX_FMT_YUV444P:
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index 3c025a6..9112d4c 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -415,6 +415,6 @@ AVCodec ff_xpm_decoder = {
     .priv_data_size = sizeof(XPMDecContext),
     .close          = xpm_decode_close,
     .decode         = xpm_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image")
 };



More information about the ffmpeg-cvslog mailing list