Commit f5c8d004 authored by James Almer's avatar James Almer

avcodec: stop using deprecated codec flags

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 2f05d18e
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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
*/
......
......@@ -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"),
};
......@@ -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,
......
......@@ -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) \
)
......
......@@ -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:
......
......@@ -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")
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment