diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 21:12:51 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 21:24:41 +0300 |
commit | d9b264bc73723ce538d72f28a4a8fb4f85af7eca (patch) | |
tree | 7a2f93dbd9adf87534c29c932ed157941a2c4af6 /libavcodec | |
parent | 337aa17e61091500b95d6127c9ffd65d9086decb (diff) | |
parent | 848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42 (diff) |
Merge commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42'
* commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42':
mpegvideo: Drop flags and flags2
Conflicts:
libavcodec/mpeg12dec.c
libavcodec/mpeg12enc.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_enc.c
libavcodec/mpegvideo_motion.c
libavcodec/ratecontrol.c
libavcodec/vc1_block.c
libavcodec/vc1_loopfilter.c
libavcodec/vc1_mc.c
libavcodec/vc1dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h261dec.c | 2 | ||||
-rw-r--r-- | libavcodec/h263.h | 2 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 7 | ||||
-rw-r--r-- | libavcodec/ituh263enc.c | 2 | ||||
-rw-r--r-- | libavcodec/motion_est.c | 14 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 14 | ||||
-rw-r--r-- | libavcodec/mpeg12enc.c | 2 | ||||
-rw-r--r-- | libavcodec/mpeg4videodec.c | 4 | ||||
-rw-r--r-- | libavcodec/mpeg4videoenc.c | 16 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 33 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 56 | ||||
-rw-r--r-- | libavcodec/mpegvideo_motion.c | 16 | ||||
-rw-r--r-- | libavcodec/mpegvideo_xvmc.c | 2 | ||||
-rw-r--r-- | libavcodec/ratecontrol.c | 14 | ||||
-rw-r--r-- | libavcodec/rv10.c | 2 | ||||
-rw-r--r-- | libavcodec/snowenc.c | 2 | ||||
-rw-r--r-- | libavcodec/svq1enc.c | 1 | ||||
-rw-r--r-- | libavcodec/vc1_block.c | 41 | ||||
-rw-r--r-- | libavcodec/vc1_loopfilter.c | 20 | ||||
-rw-r--r-- | libavcodec/vc1_mc.c | 14 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 6 | ||||
-rw-r--r-- | libavcodec/wmv2.c | 4 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideo.c | 2 |
24 files changed, 132 insertions, 146 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index ca20ba8eae..4f5994a659 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -594,8 +594,6 @@ static int h261_decode_frame(AVCodecContext *avctx, void *data, ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); - s->flags = avctx->flags; - s->flags2 = avctx->flags2; h->gob_start_code_skipped = 0; diff --git a/libavcodec/h263.h b/libavcodec/h263.h index 954889cedd..dbc91e0beb 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -144,7 +144,7 @@ static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code } static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y, int f_code){ - if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){ + if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT) { skip_put_bits(&s->pb, h263_get_motion_length(s, x, f_code) +h263_get_motion_length(s, y, f_code)); diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 3e115eb60c..7faf12009b 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -163,7 +163,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) /* We would have to scan through the whole buf to handle the weird * reordering ... */ return buf_size; - } else if (s->flags & CODEC_FLAG_TRUNCATED) { + } else if (s->avctx->flags & CODEC_FLAG_TRUNCATED) { pos -= s->parse_context.last_index; // padding is not really read so this might be -1 if (pos < 0) @@ -414,9 +414,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int slice_ret = 0; AVFrame *pict = data; - s->flags = avctx->flags; - s->flags2 = avctx->flags2; - /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ @@ -431,7 +428,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return 0; } - if (s->flags & CODEC_FLAG_TRUNCATED) { + if (s->avctx->flags & CODEC_FLAG_TRUNCATED) { int next; if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 7d4d9b09db..aeb2202bc1 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -451,7 +451,7 @@ void ff_h263_encode_mb(MpegEncContext * s, int16_t pred_dc; int16_t rec_intradc[6]; int16_t *dc_ptr[6]; - const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1); + const int interleaved_stats = s->avctx->flags & CODEC_FLAG_PASS1; if (!s->mb_intra) { /* compute cbp */ diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 7e16880d95..ed226c5d73 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -336,7 +336,7 @@ int ff_init_me(MpegEncContext *s){ c->mb_flags = get_flags(c, 0, c->avctx->mb_cmp &FF_CMP_CHROMA); /*FIXME s->no_rounding b_type*/ - if(s->flags&CODEC_FLAG_QPEL){ + if (s->avctx->flags & CODEC_FLAG_QPEL) { c->sub_motion_search= qpel_motion_search; c->qpel_avg = s->qdsp.avg_qpel_pixels_tab; if (s->no_rounding) @@ -996,7 +996,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, mx <<=shift; my <<=shift; } - if((s->flags&CODEC_FLAG_4MV) + if ((s->avctx->flags & CODEC_FLAG_4MV) && !c->skip && varc>50<<8 && vard>10<<8){ if(h263_mv4_search(s, mx, my, shift) < INT_MAX) mb_type|=CANDIDATE_MB_TYPE_INTER4V; @@ -1004,7 +1004,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, set_p_mv_tables(s, mx, my, 0); }else set_p_mv_tables(s, mx, my, 1); - if((s->flags&CODEC_FLAG_INTERLACED_ME) + if ((s->avctx->flags & CODEC_FLAG_INTERLACED_ME) && !c->skip){ //FIXME varc/d checks if(interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0) < INT_MAX) mb_type |= CANDIDATE_MB_TYPE_INTER_I; @@ -1017,7 +1017,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1); - if((s->flags&CODEC_FLAG_4MV) + if ((s->avctx->flags & CODEC_FLAG_4MV) && !c->skip && varc>50<<8 && vard>10<<8){ int dmin4= h263_mv4_search(s, mx, my, shift); if(dmin4 < dmin){ @@ -1025,7 +1025,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, dmin=dmin4; } } - if((s->flags&CODEC_FLAG_INTERLACED_ME) + if ((s->avctx->flags & CODEC_FLAG_INTERLACED_ME) && !c->skip){ //FIXME varc/d checks int dmin_i= interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0); if(dmin_i < dmin){ @@ -1553,7 +1553,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; ff_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin); - if(s->flags & CODEC_FLAG_INTERLACED_ME){ + if (s->avctx->flags & CODEC_FLAG_INTERLACED_ME) { //FIXME mb type penalty c->skip=0; c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; @@ -1684,7 +1684,7 @@ void ff_fix_long_p_mvs(MpegEncContext * s) if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; - if(s->flags&CODEC_FLAG_4MV){ + if (s->avctx->flags & CODEC_FLAG_4MV) { const int wrap= s->b8_stride; /* clip / convert to intra 8x8 type MVs */ diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 1ca6c9db45..3bb736f87c 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -843,7 +843,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { - if (s->flags2 & CODEC_FLAG2_FAST) { + if (s->avctx->flags2 & CODEC_FLAG2_FAST) { for (i = 0; i < 6; i++) mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i); } else { @@ -1063,7 +1063,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) ff_xvmc_pack_pblocks(s, cbp); if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { - if (s->flags2 & CODEC_FLAG2_FAST) { + if (s->avctx->flags2 & CODEC_FLAG2_FAST) { for (i = 0; i < 6; i++) { if (cbp & 32) mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i); @@ -1085,7 +1085,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) } } } else { - if (s->flags2 & CODEC_FLAG2_FAST) { + if (s->avctx->flags2 & CODEC_FLAG2_FAST) { for (i = 0; i < 6; i++) { if (cbp & 32) mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i); @@ -1469,7 +1469,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) s->avctx->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10; s->low_delay = get_bits1(&s->gb); - if (s->flags & CODEC_FLAG_LOW_DELAY) + if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; s1->frame_rate_ext.num = get_bits(&s->gb, 2) + 1; @@ -2192,7 +2192,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; s->out_format = FMT_MPEG1; s->swap_uv = 0; // AFAIK VCR2 does not have SEQ_HEADER - if (s->flags & CODEC_FLAG_LOW_DELAY) + if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) @@ -2645,7 +2645,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, } } } - if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->flags2 & CODEC_FLAG2_SHOW_ALL)) + if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->avctx->flags2 & CODEC_FLAG2_SHOW_ALL)) s->sync = 1; if (!s2->next_picture_ptr) { /* Skip P-frames if we do not have a reference frame or @@ -2766,7 +2766,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, return buf_size; } - if (s2->flags & CODEC_FLAG_TRUNCATED) { + if (s2->avctx->flags & CODEC_FLAG_TRUNCATED) { int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL); diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index edcce35329..25e216703c 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -384,7 +384,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_bits(&s->pb, 1, 1); put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60)); put_bits(&s->pb, 6, (uint32_t)((time_code % fps))); - put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP) || s->intra_only || !s->gop_picture_number); + put_bits(&s->pb, 1, !!(s->avctx->flags & CODEC_FLAG_CLOSED_GOP) || s->intra_only || !s->gop_picture_number); put_bits(&s->pb, 1, 0); // broken link } } diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 9bf33dd253..cbcc7509ef 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2222,7 +2222,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* pict type: I = 0 , P = 1 */ if (s->pict_type == AV_PICTURE_TYPE_B && s->low_delay && - ctx->vol_control_parameters == 0 && !(s->flags & CODEC_FLAG_LOW_DELAY)) { + ctx->vol_control_parameters == 0 && !(s->avctx->flags & CODEC_FLAG_LOW_DELAY)) { av_log(s->avctx, AV_LOG_ERROR, "low_delay flag set incorrectly, clearing it\n"); s->low_delay = 0; } @@ -2601,7 +2601,7 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) } end: - if (s->flags & CODEC_FLAG_LOW_DELAY) + if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; s->avctx->has_b_frames = !s->low_delay; diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 5751432a31..4b602f0a79 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -430,7 +430,7 @@ static inline void mpeg4_encode_blocks(MpegEncContext *s, int16_t block[6][64], int i; if (scan_table) { - if (s->flags2 & CODEC_FLAG2_NO_OUTPUT) { + if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT) { for (i = 0; i < 6; i++) skip_put_bits(&s->pb, mpeg4_get_block_length(s, block[i], i, @@ -442,7 +442,7 @@ static inline void mpeg4_encode_blocks(MpegEncContext *s, int16_t block[6][64], intra_dc[i], scan_table[i], dc_pb, ac_pb); } } else { - if (s->flags2 & CODEC_FLAG2_NO_OUTPUT) { + if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT) { for (i = 0; i < 6; i++) skip_put_bits(&s->pb, mpeg4_get_block_length(s, block[i], i, 0, @@ -507,7 +507,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], PutBitContext *const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; PutBitContext *const tex_pb = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B ? &s->tex_pb : &s->pb; PutBitContext *const dc_pb = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_I ? &s->pb2 : &s->pb; - const int interleaved_stats = (s->flags & CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0; + const int interleaved_stats = (s->avctx->flags & CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0; if (!s->mb_intra) { int i, cbp; @@ -832,7 +832,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], for (i = 0; i < 6; i++) dc_diff[i] = ff_mpeg4_pred_dc(s, i, block[i][0], &dir[i], 1); - if (s->flags & CODEC_FLAG_AC_PRED) { + if (s->avctx->flags & CODEC_FLAG_AC_PRED) { s->ac_pred = decide_ac_pred(s, block, dir, scan_table, zigzag_last_index); } else { for (i = 0; i < 6; i++) @@ -932,7 +932,7 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) put_bits(&s->pb, 1, 1); put_bits(&s->pb, 6, seconds); - put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP)); + put_bits(&s->pb, 1, !!(s->avctx->flags & CODEC_FLAG_CLOSED_GOP)); put_bits(&s->pb, 1, 0); // broken link == NO ff_mpeg4_stuffing(&s->pb); @@ -1078,7 +1078,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s, ff_mpeg4_stuffing(&s->pb); /* user data */ - if (!(s->flags & CODEC_FLAG_BITEXACT)) { + if (!(s->avctx->flags & CODEC_FLAG_BITEXACT)) { put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1B2); /* user_data */ avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0); @@ -1092,7 +1092,7 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) int time_div, time_mod; if (s->pict_type == AV_PICTURE_TYPE_I) { - if (!(s->flags & CODEC_FLAG_GLOBAL_HEADER)) { + if (!(s->avctx->flags & CODEC_FLAG_GLOBAL_HEADER)) { if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) // HACK, the reference sw is buggy mpeg4_encode_visual_object_header(s); if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number == 0) // HACK, the reference sw is buggy @@ -1325,7 +1325,7 @@ static av_cold int encode_init(AVCodecContext *avctx) s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table; - if (s->flags & CODEC_FLAG_GLOBAL_HEADER) { + if (s->avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { s->avctx->extradata = av_malloc(1024); init_put_bits(&s->pb, s->avctx->extradata, 1024); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 11d6729195..61c9fae57c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -405,7 +405,7 @@ static av_cold int dct_init(MpegEncContext *s) s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; - if (s->flags & CODEC_FLAG_BITEXACT) + if (s->avctx->flags & CODEC_FLAG_BITEXACT) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; @@ -1122,8 +1122,6 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) s->height = avctx->coded_height; s->codec_id = avctx->codec->id; s->workaround_bugs = avctx->workaround_bugs; - s->flags = avctx->flags; - s->flags2 = avctx->flags2; /* convert fourcc to upper case */ s->codec_tag = avpriv_toupper4(avctx->codec_tag); @@ -1234,7 +1232,7 @@ static int init_context_frame(MpegEncContext *s) } if (s->codec_id == AV_CODEC_ID_MPEG4 || - (s->flags & CODEC_FLAG_INTERLACED_ME)) { + (s->avctx->flags & CODEC_FLAG_INTERLACED_ME)) { /* interlaced direct mode decoding tables */ for (i = 0; i < 2; i++) { int j, k; @@ -1330,9 +1328,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) dct_init(s); - s->flags = s->avctx->flags; - s->flags2 = s->avctx->flags2; - /* set chroma shifts */ avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, @@ -1839,7 +1834,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME; s->current_picture_ptr->f->pict_type = s->pict_type; - // if (s->flags && CODEC_FLAG_QSCALE) + // if (s->avctx->flags && CODEC_FLAG_QSCALE) // s->current_picture_ptr->quality = s->new_picture_ptr->quality; s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; @@ -2683,7 +2678,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, src_x, src_y << field_based, h_edge_pos, v_edge_pos); ptr_y = s->edge_emu_buffer; - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *vbuf =ubuf + 9 * s->uvlinesize; s->vdsp.emulated_edge_mc(ubuf, ptr_cb, @@ -2718,7 +2713,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, sy = (sy << 2) >> lowres; pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h; uvsx = (uvsx << 2) >> lowres; uvsy = (uvsy << 2) >> lowres; @@ -2838,7 +2833,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, my += s->mv[dir][i][1]; } - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my); break; @@ -3078,9 +3073,9 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) s->mbintra_table[mb_xy]=1; - if ( (s->flags&CODEC_FLAG_PSNR) - || s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor - || !(s->encoding && (s->intra_only || s->pict_type==AV_PICTURE_TYPE_B) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc + if ((s->avctx->flags & CODEC_FLAG_PSNR) || s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor || + !(s->encoding && (s->intra_only || s->pict_type == AV_PICTURE_TYPE_B) && + s->avctx->mb_decision != FF_MB_DECISION_RD)) { // FIXME precalc uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; @@ -3181,7 +3176,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); - if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { if (s->chroma_y_shift){ add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); @@ -3200,7 +3195,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); - if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){//Chroma420 add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize); @@ -3233,7 +3228,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); - if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); @@ -3252,7 +3247,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], s->idsp.idct_put(dest_y + dct_offset, dct_linesize, block[2]); s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); - if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ s->idsp.idct_put(dest_cb, uvlinesize, block[4]); s->idsp.idct_put(dest_cr, uvlinesize, block[5]); @@ -3278,7 +3273,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], skip_idct: if(!readable){ s->hdsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 0be20241f3..f667bb0e85 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -243,8 +243,6 @@ typedef struct MpegEncContext { enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ int fixed_qscale; ///< fixed qscale if non zero int encoding; ///< true if we are encoding (vs decoding) - int flags; ///< AVCodecContext.flags (HQ, MV4, ...) - int flags2; ///< AVCodecContext.flags2 int max_b_frames; ///< max number of b-frames for encoding int luma_elim_threshold; int chroma_elim_threshold; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 5eb2d9a6ae..3a1b3d65ac 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -327,8 +327,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) } s->gop_size = avctx->gop_size; s->avctx = avctx; - s->flags = avctx->flags; - s->flags2 = avctx->flags2; if (avctx->max_b_frames > MAX_B_FRAMES) { av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum " "is %d.\n", MAX_B_FRAMES); @@ -389,7 +387,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) (s->mpv_flags & FF_MPV_FLAG_QP_RD)) && !s->fixed_qscale; - s->loop_filter = !!(s->flags & CODEC_FLAG_LOOP_FILTER); + s->loop_filter = !!(s->avctx->flags & CODEC_FLAG_LOOP_FILTER); if (avctx->rc_max_rate && !avctx->rc_buffer_size) { switch(avctx->codec_id) { @@ -470,7 +468,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) "specified vbv buffer is too large for the given bitrate!\n"); } - if ((s->flags & CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4 && + if ((s->avctx->flags & CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_H263 && s->codec_id != AV_CODEC_ID_H263P && s->codec_id != AV_CODEC_ID_FLV1) { av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); @@ -563,7 +561,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) return -1; } - if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME)) && + if ((s->avctx->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME)) && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; @@ -589,14 +587,14 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) } if (s->avctx->scenechange_threshold < 1000000000 && - (s->flags & CODEC_FLAG_CLOSED_GOP)) { + (s->avctx->flags & CODEC_FLAG_CLOSED_GOP)) { av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, " "set threshold to 1000000000\n"); return -1; } - if (s->flags & CODEC_FLAG_LOW_DELAY) { + if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) { if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); @@ -696,12 +694,12 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) switch (avctx->codec->id) { case AV_CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; - s->low_delay = !!(s->flags & CODEC_FLAG_LOW_DELAY); + s->low_delay = !!(s->avctx->flags & CODEC_FLAG_LOW_DELAY); avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); break; case AV_CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; - s->low_delay = !!(s->flags & CODEC_FLAG_LOW_DELAY); + s->low_delay = !!(s->avctx->flags & CODEC_FLAG_LOW_DELAY); avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode = 1; break; @@ -1422,7 +1420,7 @@ static int select_input_picture(MpegEncContext *s) } else { int b_frames; - if (s->flags & CODEC_FLAG_PASS2) { + if (s->avctx->flags & CODEC_FLAG_PASS2) { for (i = 0; i < s->max_b_frames + 1; i++) { int pict_num = s->input_picture[0]->f->display_picture_number + i; @@ -1491,13 +1489,13 @@ static int select_input_picture(MpegEncContext *s) s->gop_size > s->picture_in_gop_number) { b_frames = s->gop_size - s->picture_in_gop_number - 1; } else { - if (s->flags & CODEC_FLAG_CLOSED_GOP) + if (s->avctx->flags & CODEC_FLAG_CLOSED_GOP) b_frames = 0; s->input_picture[b_frames]->f->pict_type = AV_PICTURE_TYPE_I; } } - if ((s->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && + if ((s->avctx->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_I) b_frames--; @@ -1811,7 +1809,7 @@ vbv_retry: av_assert0(s->avctx->rc_max_rate); } - if (s->flags & CODEC_FLAG_PASS1) + if (s->avctx->flags & CODEC_FLAG_PASS1) ff_write_pass1_stats(s); for (i = 0; i < 4; i++) { @@ -1821,7 +1819,7 @@ vbv_retry: avctx->error[i] += s->current_picture_ptr->f->error[i]; } - if (s->flags & CODEC_FLAG_PASS1) + if (s->avctx->flags & CODEC_FLAG_PASS1) assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb)); @@ -2123,7 +2121,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, } if (s->mb_intra) { - if (s->flags & CODEC_FLAG_INTERLACED_DCT) { + if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; @@ -2154,7 +2152,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, s->pdsp.get_pixels(s->block[2], ptr_y + dct_offset, wrap_y); s->pdsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y); - if (s->flags & CODEC_FLAG_GRAY) { + if (s->avctx->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { @@ -2202,7 +2200,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, op_pix, op_qpix); } - if (s->flags & CODEC_FLAG_INTERLACED_DCT) { + if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; @@ -2240,7 +2238,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, s->pdsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); - if (s->flags & CODEC_FLAG_GRAY) { + if (s->avctx->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { @@ -2350,7 +2348,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, } } - if ((s->flags & CODEC_FLAG_GRAY) && s->mb_intra) { + if ((s->avctx->flags & CODEC_FLAG_GRAY) && s->mb_intra) { s->block_last_index[4] = s->block_last_index[5] = 0; s->block[4][0] = @@ -2674,7 +2672,7 @@ static void write_slice_end(MpegEncContext *s){ avpriv_align_put_bits(&s->pb); flush_put_bits(&s->pb); - if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame) + if ((s->avctx->flags & CODEC_FLAG_PASS1) && !s->partitioned_frame) s->misc_bits+= get_bits_diff(s); } @@ -2918,7 +2916,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ break; } - if(s->flags&CODEC_FLAG_PASS1){ + if (s->avctx->flags & CODEC_FLAG_PASS1) { int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; @@ -3338,7 +3336,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->p_mv_table[xy][1]=0; } - if(s->flags&CODEC_FLAG_PSNR){ + if (s->avctx->flags & CODEC_FLAG_PSNR) { int w= 16; int h= 16; @@ -3503,11 +3501,11 @@ static int encode_picture(MpegEncContext *s, int picture_number) s->no_rounding ^= 1; } - if(s->flags & CODEC_FLAG_PASS2){ + if (s->avctx->flags & CODEC_FLAG_PASS2) { if (estimate_qp(s,1) < 0) return -1; ff_get_2pass_fcode(s); - }else if(!(s->flags & CODEC_FLAG_QSCALE)){ + } else if (!(s->avctx->flags & CODEC_FLAG_QSCALE)) { if(s->pict_type==AV_PICTURE_TYPE_B) s->lambda= s->last_lambda_for[s->pict_type]; else @@ -3574,7 +3572,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) if(s->pict_type==AV_PICTURE_TYPE_P || s->pict_type==AV_PICTURE_TYPE_S) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER); - if(s->flags & CODEC_FLAG_INTERLACED_ME){ + if (s->avctx->flags & CODEC_FLAG_INTERLACED_ME) { int a,b; a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I); @@ -3583,7 +3581,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) ff_fix_long_p_mvs(s); ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0); - if(s->flags & CODEC_FLAG_INTERLACED_ME){ + if (s->avctx->flags & CODEC_FLAG_INTERLACED_ME) { int j; for(i=0; i<2; i++){ for(j=0; j<2; j++) @@ -3608,7 +3606,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1); ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1); ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1); - if(s->flags & CODEC_FLAG_INTERLACED_ME){ + if (s->avctx->flags & CODEC_FLAG_INTERLACED_ME) { int dir, j; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ @@ -3627,7 +3625,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) if (estimate_qp(s, 0) < 0) return -1; - if(s->qscale < 3 && s->max_qcoeff<=128 && s->pict_type==AV_PICTURE_TYPE_I && !(s->flags & CODEC_FLAG_QSCALE)) + if (s->qscale < 3 && s->max_qcoeff <= 128 && + s->pict_type == AV_PICTURE_TYPE_I && + !(s->avctx->flags & CODEC_FLAG_QSCALE)) s->qscale= 3; //reduce clipping problems if (s->out_format == FMT_MJPEG) { diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 4fea847ef9..0d75ffa9ce 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -87,7 +87,7 @@ static void gmc1_motion(MpegEncContext *s, } } - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) return; motion_x = s->sprite_offset[1][0]; @@ -164,7 +164,7 @@ static void gmc_motion(MpegEncContext *s, a + 1, (1 << (2 * a + 1)) - s->no_rounding, s->h_edge_pos, s->v_edge_pos); - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) return; ox = s->sprite_offset[1][0] + s->sprite_delta[0][0] * s->mb_x * 8 + @@ -323,7 +323,7 @@ void mpeg_motion_internal(MpegEncContext *s, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *vbuf = ubuf + 9 * s->uvlinesize; uvsrc_y = (unsigned)uvsrc_y << field_based; @@ -358,7 +358,7 @@ void mpeg_motion_internal(MpegEncContext *s, pix_op[0][dxy](dest_y, ptr_y, linesize, h); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { pix_op[s->chroma_x_shift][uvdxy] (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy] @@ -546,7 +546,7 @@ static inline void qpel_motion(MpegEncContext *s, src_x, src_y << field_based, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *vbuf = ubuf + 9 * s->uvlinesize; s->vdsp.emulated_edge_mc(ubuf, ptr_cb, @@ -583,7 +583,7 @@ static inline void qpel_motion(MpegEncContext *s, qpix_op[1][dxy](dest_y, ptr_y, linesize); qpix_op[1][dxy](dest_y + 8, ptr_y + 8, linesize); } - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1); pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1); } @@ -739,7 +739,7 @@ static inline void apply_obmc(MpegEncContext *s, mx += mv[0][0]; my += mv[0][1]; } - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); @@ -812,7 +812,7 @@ static inline void apply_8x8(MpegEncContext *s, } } - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); } diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c index d4631cba1e..10475e0559 100644 --- a/libavcodec/mpegvideo_xvmc.c +++ b/libavcodec/mpegvideo_xvmc.c @@ -298,7 +298,7 @@ static void ff_xvmc_decode_mb(struct MpegEncContext *s) cbp++; } - if (s->flags & CODEC_FLAG_GRAY) { + if (s->avctx->flags & CODEC_FLAG_GRAY) { if (s->mb_intra) { // intra frames are always full chroma blocks for (i = 4; i < blocks_per_mb; i++) { memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 178e193b70..4eb363013c 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -161,7 +161,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) if (!rcc->buffer_index) rcc->buffer_index = s->avctx->rc_buffer_size * 3 / 4; - if (s->flags & CODEC_FLAG_PASS2) { + if (s->avctx->flags & CODEC_FLAG_PASS2) { int i; char *p; @@ -227,7 +227,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) return -1; // FIXME maybe move to end - if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { + if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { #if CONFIG_LIBXVID return ff_xvid_rate_control_init(s); #else @@ -238,7 +238,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) } } - if (!(s->flags & CODEC_FLAG_PASS2)) { + if (!(s->avctx->flags & CODEC_FLAG_PASS2)) { rcc->short_term_qsum = 0.001; rcc->short_term_qcount = 0.001; @@ -307,7 +307,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s) av_freep(&rcc->entry); #if CONFIG_LIBXVID - if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) + if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) ff_xvid_rate_control_uninit(s); #endif } @@ -760,7 +760,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) emms_c(); #if CONFIG_LIBXVID - if ((s->flags & CODEC_FLAG_PASS2) && + if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) return ff_xvid_rate_estimate_qscale(s, dry_run); #endif @@ -780,7 +780,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) s->frame_bits - s->stuffing_bits); } - if (s->flags & CODEC_FLAG_PASS2) { + if (s->avctx->flags & CODEC_FLAG_PASS2) { av_assert0(picture_number >= 0); if (picture_number >= rcc->num_entries) { av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); @@ -814,7 +814,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; short_term_q = 0; /* avoid warning */ - if (s->flags & CODEC_FLAG_PASS2) { + if (s->avctx->flags & CODEC_FLAG_PASS2) { if (pict_type != AV_PICTURE_TYPE_I) av_assert0(pict_type == rce->new_pict_type); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index e9365045da..707b38e3aa 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -707,8 +707,6 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *slices_hdr = NULL; ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); - s->flags = avctx->flags; - s->flags2 = avctx->flags2; /* no supplementary picture */ if (buf_size == 0) { diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index a7de16a358..aab7146714 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -69,7 +69,6 @@ static av_cold int encode_init(AVCodecContext *avctx) s->version=0; s->m.avctx = avctx; - s->m.flags = avctx->flags; s->m.bit_rate= avctx->bit_rate; s->m.me.temp = @@ -1655,7 +1654,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, s->m.me_method= s->avctx->me_method; s->m.me.scene_change_score=0; s->m.me.dia_size = avctx->dia_size; - s->m.flags= s->avctx->flags; s->m.quarter_sample= (s->avctx->flags & CODEC_FLAG_QPEL)!=0; s->m.out_format= FMT_H263; s->m.unrestricted_mv= 1; diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index ec540a25e3..a1bab4261d 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -283,7 +283,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, s->m.pict_type = f->pict_type; s->m.me_method = s->avctx->me_method; s->m.me.scene_change_score = 0; - s->m.flags = s->avctx->flags; // s->m.out_format = FMT_H263; // s->m.unrestricted_mv = 1; s->m.lambda = f->quality; diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 65b4ccfa50..3541ba787e 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -99,7 +99,7 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][3], s->dest[0] - v_dist * s->linesize - 8, stride_y); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][4], s->dest[1] - 8 * s->uvlinesize - 8, s->uvlinesize); @@ -126,7 +126,7 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][3], s->dest[0] - v_dist * s->linesize + 8, stride_y); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][4], s->dest[1] - 8 * s->uvlinesize, s->uvlinesize); @@ -1327,7 +1327,7 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) @@ -1348,7 +1348,7 @@ static int vc1_decode_p_mb(VC1Context *v) } else if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; @@ -1438,7 +1438,7 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) @@ -1460,7 +1460,7 @@ static int vc1_decode_p_mb(VC1Context *v) pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) @@ -1586,7 +1586,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (i < 4) { stride_y = s->linesize << fieldtx; @@ -1672,7 +1673,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; @@ -1751,7 +1752,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); @@ -1805,7 +1806,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) @@ -1952,7 +1953,7 @@ static void vc1_decode_b_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) @@ -1966,7 +1967,7 @@ static void vc1_decode_b_mb(VC1Context *v) vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), NULL); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; @@ -2027,7 +2028,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && (i>3) && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) @@ -2125,7 +2126,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), NULL); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; @@ -2250,7 +2251,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); - if (CONFIG_GRAY && i > 3 && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && i > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (i < 4) { @@ -2416,7 +2417,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), - CONFIG_GRAY && (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + CONFIG_GRAY && (i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; @@ -2559,7 +2560,7 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_decode_i_block(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2); - if (CONFIG_GRAY && k > 3 && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && k > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); if (v->pq >= 9 && v->overlap) { @@ -2583,7 +2584,7 @@ static void vc1_decode_i_blocks(VC1Context *v) if (s->mb_x) { v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } @@ -2593,7 +2594,7 @@ static void vc1_decode_i_blocks(VC1Context *v) if (!s->first_slice_line) { v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } @@ -2722,7 +2723,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_decode_i_block_adv(v, block[k], k, val, (k < 4) ? v->codingset : v->codingset2, mquant); - if (CONFIG_GRAY && k > 3 && (s->flags & CODEC_FLAG_GRAY)) + if (CONFIG_GRAY && k > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(block[k]); } diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c index f7eec17e25..ad0945ff3a 100644 --- a/libavcodec/vc1_loopfilter.c +++ b/libavcodec/vc1_loopfilter.c @@ -40,7 +40,7 @@ void ff_vc1_loop_filter_iblk(VC1Context *v, int pq) if (s->mb_x) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) for (j = 0; j < 2; j++) { v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1], s->uvlinesize, pq); if (s->mb_x) @@ -52,7 +52,7 @@ void ff_vc1_loop_filter_iblk(VC1Context *v, int pq) if (s->mb_y == s->end_mb_y - 1) { if (s->mb_x) { v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); v->vc1dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq); } @@ -76,7 +76,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x >= 2) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 16, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 8, s->linesize, pq); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) for (j = 0; j < 2; j++) { v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); if (s->mb_x >= 2) { @@ -94,7 +94,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize + 8, s->linesize, pq); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) for (j = 0; j < 2; j++) { v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); if (s->mb_x >= 2) { @@ -110,7 +110,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x >= 2) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 16, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 8, s->linesize, pq); - if (s->mb_x >= 2 && (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))) { + if (s->mb_x >= 2 && (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY))) { for (j = 0; j < 2; j++) { v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); } @@ -121,7 +121,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq); - if (s->mb_x && (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))) { + if (s->mb_x && (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY))) { for (j = 0; j < 2; j++) { v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); } @@ -155,7 +155,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) v->block[v->cur_blk_idx][0]); v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][3], v->block[v->cur_blk_idx][2]); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][4], v->block[v->cur_blk_idx][4]); v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][5], @@ -174,7 +174,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) v->block[v->cur_blk_idx][0]); v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][3], v->block[v->cur_blk_idx][1]); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][4], v->block[v->cur_blk_idx][4]); v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][5], @@ -194,7 +194,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) v->block[v->left_blk_idx][0]); v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][3], v->block[v->left_blk_idx][1]); - if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + if (!CONFIG_GRAY || !(s->avctx->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][4], v->block[v->left_blk_idx][4]); v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][5], @@ -336,7 +336,7 @@ void ff_vc1_apply_p_loop_filter(VC1Context *v) { MpegEncContext *s = &v->s; int i; - int block_count = CONFIG_GRAY && (s->flags & CODEC_FLAG_GRAY) ? 4 : 6; + int block_count = CONFIG_GRAY && (s->avctx->flags & CODEC_FLAG_GRAY) ? 4 : 6; for (i = 0; i < block_count; i++) { vc1_apply_p_v_loop_filter(v, i); diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 6236036dbf..1a78c178db 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -270,7 +270,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) } /* for grayscale we should not try to read from unknown area */ - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) { + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } @@ -332,7 +332,8 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) s->hdsp.put_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); } - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) return; + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) + return; /* Chroma MC always uses qpel bilinear */ uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; @@ -517,7 +518,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) if (!v->field_mode && !v->s.last_picture.f->data[0]) return; - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) return; /* calculate chroma MV vector from four luma MVs */ @@ -654,7 +655,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) int use_ic; uint8_t (*lutuv)[256]; - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) return; for (i = 0; i < 4; i++) { @@ -800,7 +801,7 @@ void ff_vc1_interp_mc(VC1Context *v) } /* for grayscale we should not try to read from unknown area */ - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) { + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } @@ -864,7 +865,8 @@ void ff_vc1_interp_mc(VC1Context *v) s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0], srcY, s->linesize, 16); } - if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) return; + if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY) + return; /* Chroma MC always uses qpel blilinear */ uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 99c3d0ce27..d39f344102 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -190,7 +190,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) } alpha = av_clip_uint16(sd->coefs[1][6]); - for (plane = 0; plane < (CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) { + for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++) { int width = v->output_width>>!!plane; for (row = 0; row < v->output_height>>!!plane; row++) { @@ -311,7 +311,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) wrong but it looks better than doing nothing. */ if (f && f->data[0]) - for (plane = 0; plane < (CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) + for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++) for (i = 0; i < v->sprite_height>>!!plane; i++) memset(f->data[plane] + i * f->linesize[plane], plane ? 128 : 0, f->linesize[plane]); @@ -629,7 +629,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, v->second_field = 0; - if(s->flags & CODEC_FLAG_LOW_DELAY) + if(s->avctx->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; /* no supplementary picture */ diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index d102f361c9..1cfb7eb0e4 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -88,7 +88,7 @@ void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize, s->linesize, 2); wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3); - if (s->flags & CODEC_FLAG_GRAY) + if (s->avctx->flags & CODEC_FLAG_GRAY) return; wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); @@ -140,7 +140,7 @@ void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y, w->wdsp.put_mspel_pixels_tab[dxy](dest_y + 8 * linesize, ptr + 8 * linesize, linesize); w->wdsp.put_mspel_pixels_tab[dxy](dest_y + 8 + 8 * linesize, ptr + 8 + 8 * linesize, linesize); - if (s->flags & CODEC_FLAG_GRAY) + if (s->avctx->flags & CODEC_FLAG_GRAY) return; dxy = 0; diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c index b0028ce276..133ae80a27 100644 --- a/libavcodec/x86/mpegvideo.c +++ b/libavcodec/x86/mpegvideo.c @@ -454,7 +454,7 @@ av_cold void ff_mpv_common_init_x86(MpegEncContext *s) s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx; - if(!(s->flags & CODEC_FLAG_BITEXACT)) + if (!(s->avctx->flags & CODEC_FLAG_BITEXACT)) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; } |