They are just duplicates of AVCodecContext members so use those instead.tags/n2.7
@@ -573,8 +573,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, "*****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]); | 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; | h->gob_start_code_skipped = 0; | ||||
@@ -145,7 +145,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){ | 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, | skip_put_bits(&s->pb, | ||||
h263_get_motion_length(s, x, f_code) | h263_get_motion_length(s, x, f_code) | ||||
+h263_get_motion_length(s, y, f_code)); | +h263_get_motion_length(s, y, f_code)); | ||||
@@ -150,7 +150,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) | |||||
/* We would have to scan through the whole buf to handle the weird | /* We would have to scan through the whole buf to handle the weird | ||||
* reordering ... */ | * reordering ... */ | ||||
return buf_size; | return buf_size; | ||||
} else if (s->flags & CODEC_FLAG_TRUNCATED) { | |||||
} else if (s->avctx->flags & CODEC_FLAG_TRUNCATED) { | |||||
pos -= s->parse_context.last_index; | pos -= s->parse_context.last_index; | ||||
// padding is not really read so this might be -1 | // padding is not really read so this might be -1 | ||||
if (pos < 0) | if (pos < 0) | ||||
@@ -377,9 +377,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, | |||||
int ret; | int ret; | ||||
AVFrame *pict = data; | AVFrame *pict = data; | ||||
s->flags = avctx->flags; | |||||
s->flags2 = avctx->flags2; | |||||
/* no supplementary picture */ | /* no supplementary picture */ | ||||
if (buf_size == 0) { | if (buf_size == 0) { | ||||
/* special case for last picture */ | /* special case for last picture */ | ||||
@@ -394,7 +391,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, | |||||
return 0; | return 0; | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_TRUNCATED) { | |||||
if (s->avctx->flags & CODEC_FLAG_TRUNCATED) { | |||||
int next; | int next; | ||||
if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { | if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { | ||||
@@ -459,7 +459,7 @@ void ff_h263_encode_mb(MpegEncContext * s, | |||||
int16_t pred_dc; | int16_t pred_dc; | ||||
int16_t rec_intradc[6]; | int16_t rec_intradc[6]; | ||||
int16_t *dc_ptr[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) { | if (!s->mb_intra) { | ||||
/* compute cbp */ | /* compute cbp */ | ||||
@@ -331,7 +331,7 @@ int ff_init_me(MpegEncContext *s){ | |||||
c->mb_flags = get_flags(c, 0, c->avctx->mb_cmp &FF_CMP_CHROMA); | c->mb_flags = get_flags(c, 0, c->avctx->mb_cmp &FF_CMP_CHROMA); | ||||
/*FIXME s->no_rounding b_type*/ | /*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->sub_motion_search= qpel_motion_search; | ||||
c->qpel_avg = s->qdsp.avg_qpel_pixels_tab; | c->qpel_avg = s->qdsp.avg_qpel_pixels_tab; | ||||
if (s->no_rounding) | if (s->no_rounding) | ||||
@@ -968,7 +968,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, | |||||
mx <<=shift; | mx <<=shift; | ||||
my <<=shift; | my <<=shift; | ||||
} | } | ||||
if((s->flags&CODEC_FLAG_4MV) | |||||
if ((s->avctx->flags & CODEC_FLAG_4MV) | |||||
&& !c->skip && varc>50<<8 && vard>10<<8){ | && !c->skip && varc>50<<8 && vard>10<<8){ | ||||
if(h263_mv4_search(s, mx, my, shift) < INT_MAX) | if(h263_mv4_search(s, mx, my, shift) < INT_MAX) | ||||
mb_type|=CANDIDATE_MB_TYPE_INTER4V; | mb_type|=CANDIDATE_MB_TYPE_INTER4V; | ||||
@@ -976,7 +976,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, | |||||
set_p_mv_tables(s, mx, my, 0); | set_p_mv_tables(s, mx, my, 0); | ||||
}else | }else | ||||
set_p_mv_tables(s, mx, my, 1); | 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 | && !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) | 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; | mb_type |= CANDIDATE_MB_TYPE_INTER_I; | ||||
@@ -989,7 +989,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, | |||||
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | ||||
dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1); | 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){ | && !c->skip && varc>50<<8 && vard>10<<8){ | ||||
int dmin4= h263_mv4_search(s, mx, my, shift); | int dmin4= h263_mv4_search(s, mx, my, shift); | ||||
if(dmin4 < dmin){ | if(dmin4 < dmin){ | ||||
@@ -997,7 +997,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, | |||||
dmin=dmin4; | dmin=dmin4; | ||||
} | } | ||||
} | } | ||||
if((s->flags&CODEC_FLAG_INTERLACED_ME) | |||||
if ((s->avctx->flags & CODEC_FLAG_INTERLACED_ME) | |||||
&& !c->skip){ //FIXME varc/d checks | && !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); | int dmin_i= interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0); | ||||
if(dmin_i < dmin){ | if(dmin_i < dmin){ | ||||
@@ -1525,7 +1525,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, | |||||
fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; | fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; | ||||
ff_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin); | 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 | //FIXME mb type penalty | ||||
c->skip=0; | c->skip=0; | ||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; | c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; | ||||
@@ -1656,7 +1656,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(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; | const int wrap= s->b8_stride; | ||||
/* clip / convert to intra 8x8 type MVs */ | /* clip / convert to intra 8x8 type MVs */ | ||||
@@ -823,7 +823,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
#endif /* FF_API_XVMC */ | #endif /* FF_API_XVMC */ | ||||
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { | 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++) | for (i = 0; i < 6; i++) | ||||
mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i); | mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i); | ||||
} else { | } else { | ||||
@@ -1041,7 +1041,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
#endif /* FF_API_XVMC */ | #endif /* FF_API_XVMC */ | ||||
if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { | 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++) { | for (i = 0; i < 6; i++) { | ||||
if (cbp & 32) | if (cbp & 32) | ||||
mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i); | mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i); | ||||
@@ -1063,7 +1063,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
if (s->flags2 & CODEC_FLAG2_FAST) { | |||||
if (s->avctx->flags2 & CODEC_FLAG2_FAST) { | |||||
for (i = 0; i < 6; i++) { | for (i = 0; i < 6; i++) { | ||||
if (cbp & 32) | if (cbp & 32) | ||||
mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i); | mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i); | ||||
@@ -1102,8 +1102,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) | |||||
ff_mpv_decode_defaults(s2); | ff_mpv_decode_defaults(s2); | ||||
s->mpeg_enc_ctx.avctx = avctx; | s->mpeg_enc_ctx.avctx = avctx; | ||||
s->mpeg_enc_ctx.flags = avctx->flags; | |||||
s->mpeg_enc_ctx.flags2 = avctx->flags2; | |||||
/* we need some permutation to store matrices, | /* we need some permutation to store matrices, | ||||
* until the decoder sets the real permutation. */ | * until the decoder sets the real permutation. */ | ||||
@@ -1403,7 +1401,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) | |||||
s->avctx->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10; | s->avctx->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10; | ||||
s->low_delay = get_bits1(&s->gb); | 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; | s->low_delay = 1; | ||||
s1->frame_rate_ext.num = get_bits(&s->gb, 2) + 1; | s1->frame_rate_ext.num = get_bits(&s->gb, 2) + 1; | ||||
@@ -2134,7 +2132,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, | |||||
s->codec_id = | s->codec_id = | ||||
s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; | s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; | ||||
s->out_format = FMT_MPEG1; | s->out_format = FMT_MPEG1; | ||||
if (s->flags & CODEC_FLAG_LOW_DELAY) | |||||
if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) | |||||
s->low_delay = 1; | s->low_delay = 1; | ||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO) | if (s->avctx->debug & FF_DEBUG_PICT_INFO) | ||||
@@ -2633,7 +2631,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, | |||||
return buf_size; | 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, | int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, | ||||
buf_size, NULL); | buf_size, NULL); | ||||
@@ -324,7 +324,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) | |||||
put_bits(&s->pb, 1, 1); | 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) % 60)); | ||||
put_bits(&s->pb, 6, (uint32_t)((time_code % fps))); | put_bits(&s->pb, 6, (uint32_t)((time_code % fps))); | ||||
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 | put_bits(&s->pb, 1, 0); // broken link | ||||
} | } | ||||
} | } | ||||
@@ -2078,7 +2078,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 */ | 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 && | 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"); | av_log(s->avctx, AV_LOG_ERROR, "low_delay flag set incorrectly, clearing it\n"); | ||||
s->low_delay = 0; | s->low_delay = 0; | ||||
} | } | ||||
@@ -2420,7 +2420,7 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) | |||||
} | } | ||||
end: | end: | ||||
if (s->flags & CODEC_FLAG_LOW_DELAY) | |||||
if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) | |||||
s->low_delay = 1; | s->low_delay = 1; | ||||
s->avctx->has_b_frames = !s->low_delay; | s->avctx->has_b_frames = !s->low_delay; | ||||
@@ -430,7 +430,7 @@ static inline void mpeg4_encode_blocks(MpegEncContext *s, int16_t block[6][64], | |||||
int i; | int i; | ||||
if (scan_table) { | if (scan_table) { | ||||
if (s->flags2 & CODEC_FLAG2_NO_OUTPUT) { | |||||
if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT) { | |||||
for (i = 0; i < 6; i++) | for (i = 0; i < 6; i++) | ||||
skip_put_bits(&s->pb, | skip_put_bits(&s->pb, | ||||
mpeg4_get_block_length(s, block[i], i, | 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); | intra_dc[i], scan_table[i], dc_pb, ac_pb); | ||||
} | } | ||||
} else { | } else { | ||||
if (s->flags2 & CODEC_FLAG2_NO_OUTPUT) { | |||||
if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT) { | |||||
for (i = 0; i < 6; i++) | for (i = 0; i < 6; i++) | ||||
skip_put_bits(&s->pb, | skip_put_bits(&s->pb, | ||||
mpeg4_get_block_length(s, block[i], i, 0, | 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 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 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; | 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) { | if (!s->mb_intra) { | ||||
int i, cbp; | int i, cbp; | ||||
@@ -822,7 +822,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], | |||||
for (i = 0; i < 6; i++) | for (i = 0; i < 6; i++) | ||||
dc_diff[i] = ff_mpeg4_pred_dc(s, i, block[i][0], &dir[i], 1); | 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); | s->ac_pred = decide_ac_pred(s, block, dir, scan_table, zigzag_last_index); | ||||
} else { | } else { | ||||
for (i = 0; i < 6; i++) | for (i = 0; i < 6; i++) | ||||
@@ -923,7 +923,7 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) | |||||
put_bits(&s->pb, 1, 1); | put_bits(&s->pb, 1, 1); | ||||
put_bits(&s->pb, 6, seconds); | 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 | put_bits(&s->pb, 1, 0); // broken link == NO | ||||
s->last_time_base = time / s->avctx->time_base.den; | s->last_time_base = time / s->avctx->time_base.den; | ||||
@@ -1069,7 +1069,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s, | |||||
ff_mpeg4_stuffing(&s->pb); | ff_mpeg4_stuffing(&s->pb); | ||||
/* user data */ | /* 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, 0); | ||||
put_bits(&s->pb, 16, 0x1B2); /* user_data */ | put_bits(&s->pb, 16, 0x1B2); /* user_data */ | ||||
avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0); | avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0); | ||||
@@ -1083,7 +1083,7 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) | |||||
int time_div, time_mod; | int time_div, time_mod; | ||||
if (s->pict_type == AV_PICTURE_TYPE_I) { | 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 | if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) // HACK, the reference sw is buggy | ||||
mpeg4_encode_visual_object_header(s); | mpeg4_encode_visual_object_header(s); | ||||
if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number == 0) // HACK, the reference sw is buggy | if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number == 0) // HACK, the reference sw is buggy | ||||
@@ -1312,7 +1312,7 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; | s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; | ||||
s->c_dc_scale_table = ff_mpeg4_c_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); | s->avctx->extradata = av_malloc(1024); | ||||
init_put_bits(&s->pb, s->avctx->extradata, 1024); | init_put_bits(&s->pb, s->avctx->extradata, 1024); | ||||
@@ -389,7 +389,7 @@ static av_cold int dct_init(MpegEncContext *s) | |||||
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; | s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; | ||||
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; | s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; | ||||
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_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_intra = dct_unquantize_mpeg2_intra_bitexact; | ||||
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; | s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; | ||||
@@ -1174,7 +1174,7 @@ static int init_context_frame(MpegEncContext *s) | |||||
} | } | ||||
if (s->codec_id == AV_CODEC_ID_MPEG4 || | 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 */ | /* interlaced direct mode decoding tables */ | ||||
for (i = 0; i < 2; i++) { | for (i = 0; i < 2; i++) { | ||||
int j, k; | int j, k; | ||||
@@ -1277,9 +1277,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) | |||||
dct_init(s); | dct_init(s); | ||||
s->flags = s->avctx->flags; | |||||
s->flags2 = s->avctx->flags2; | |||||
/* set chroma shifts */ | /* set chroma shifts */ | ||||
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, | av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, | ||||
&s->chroma_x_shift, | &s->chroma_x_shift, | ||||
@@ -1744,7 +1741,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->field_picture = s->picture_structure != PICT_FRAME; | ||||
s->current_picture_ptr->f->pict_type = s->pict_type; | 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->quality = s->new_picture_ptr->quality; | ||||
s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; | s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; | ||||
@@ -2158,7 +2155,9 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) | else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) | ||||
s->mbintra_table[mb_xy]=1; | s->mbintra_table[mb_xy]=1; | ||||
if ((s->flags&CODEC_FLAG_PSNR) || !(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->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; | uint8_t *dest_y, *dest_cb, *dest_cr; | ||||
int dct_linesize, dct_offset; | int dct_linesize, dct_offset; | ||||
op_pixels_func (*op_pix)[4]; | op_pixels_func (*op_pix)[4]; | ||||
@@ -2247,7 +2246,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); | 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); | 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){ | if (s->chroma_y_shift){ | ||||
add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); | 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); | add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); | ||||
@@ -2266,7 +2265,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); | 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); | 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 | if(s->chroma_y_shift){//Chroma420 | ||||
add_dct(s, block[4], 4, dest_cb, uvlinesize); | add_dct(s, block[4], 4, dest_cb, uvlinesize); | ||||
add_dct(s, block[5], 5, dest_cr, uvlinesize); | add_dct(s, block[5], 5, dest_cr, uvlinesize); | ||||
@@ -2299,7 +2298,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); | 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); | 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){ | if(s->chroma_y_shift){ | ||||
put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); | put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); | ||||
put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); | put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); | ||||
@@ -2318,7 +2317,7 @@ FF_ENABLE_DEPRECATION_WARNINGS | |||||
s->idsp.idct_put(dest_y + dct_offset, dct_linesize, block[2]); | 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]); | 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){ | if(s->chroma_y_shift){ | ||||
s->idsp.idct_put(dest_cb, uvlinesize, block[4]); | s->idsp.idct_put(dest_cb, uvlinesize, block[4]); | ||||
s->idsp.idct_put(dest_cr, uvlinesize, block[5]); | s->idsp.idct_put(dest_cr, uvlinesize, block[5]); | ||||
@@ -237,8 +237,6 @@ typedef struct MpegEncContext { | |||||
enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ | enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ | ||||
int fixed_qscale; ///< fixed qscale if non zero | int fixed_qscale; ///< fixed qscale if non zero | ||||
int encoding; ///< true if we are encoding (vs decoding) | 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 max_b_frames; ///< max number of b-frames for encoding | ||||
int luma_elim_threshold; | int luma_elim_threshold; | ||||
int chroma_elim_threshold; | int chroma_elim_threshold; | ||||
@@ -300,8 +300,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
} | } | ||||
s->gop_size = avctx->gop_size; | s->gop_size = avctx->gop_size; | ||||
s->avctx = avctx; | s->avctx = avctx; | ||||
s->flags = avctx->flags; | |||||
s->flags2 = avctx->flags2; | |||||
if (avctx->max_b_frames > MAX_B_FRAMES) { | if (avctx->max_b_frames > MAX_B_FRAMES) { | ||||
av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum " | av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum " | ||||
"is %d.\n", MAX_B_FRAMES); | "is %d.\n", MAX_B_FRAMES); | ||||
@@ -343,7 +341,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
(s->mpv_flags & FF_MPV_FLAG_QP_RD)) && | (s->mpv_flags & FF_MPV_FLAG_QP_RD)) && | ||||
!s->fixed_qscale; | !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) { | if (avctx->rc_max_rate && !avctx->rc_buffer_size) { | ||||
av_log(avctx, AV_LOG_ERROR, | av_log(avctx, AV_LOG_ERROR, | ||||
@@ -400,7 +398,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
"specified vbv buffer is too large for the given bitrate!\n"); | "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_H263 && s->codec_id != AV_CODEC_ID_H263P && | ||||
s->codec_id != AV_CODEC_ID_FLV1) { | s->codec_id != AV_CODEC_ID_FLV1) { | ||||
av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); | av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); | ||||
@@ -437,7 +435,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
return -1; | 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) { | 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"); | av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); | ||||
return -1; | return -1; | ||||
@@ -462,14 +460,14 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
} | } | ||||
if (s->avctx->scenechange_threshold < 1000000000 && | 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, | av_log(avctx, AV_LOG_ERROR, | ||||
"closed gop with scene change detection are not supported yet, " | "closed gop with scene change detection are not supported yet, " | ||||
"set threshold to 1000000000\n"); | "set threshold to 1000000000\n"); | ||||
return -1; | 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) { | if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { | ||||
av_log(avctx, AV_LOG_ERROR, | av_log(avctx, AV_LOG_ERROR, | ||||
"low delay forcing is only available for mpeg2\n"); | "low delay forcing is only available for mpeg2\n"); | ||||
@@ -559,12 +557,12 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) | |||||
switch (avctx->codec->id) { | switch (avctx->codec->id) { | ||||
case AV_CODEC_ID_MPEG1VIDEO: | case AV_CODEC_ID_MPEG1VIDEO: | ||||
s->out_format = FMT_MPEG1; | 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); | avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); | ||||
break; | break; | ||||
case AV_CODEC_ID_MPEG2VIDEO: | case AV_CODEC_ID_MPEG2VIDEO: | ||||
s->out_format = FMT_MPEG1; | 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); | avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); | ||||
s->rtp_mode = 1; | s->rtp_mode = 1; | ||||
break; | break; | ||||
@@ -1273,7 +1271,7 @@ static int select_input_picture(MpegEncContext *s) | |||||
} | } | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_PASS2) { | |||||
if (s->avctx->flags & CODEC_FLAG_PASS2) { | |||||
for (i = 0; i < s->max_b_frames + 1; i++) { | for (i = 0; i < s->max_b_frames + 1; i++) { | ||||
int pict_num = s->input_picture[0]->f->display_picture_number + i; | int pict_num = s->input_picture[0]->f->display_picture_number + i; | ||||
@@ -1342,13 +1340,13 @@ static int select_input_picture(MpegEncContext *s) | |||||
s->gop_size > s->picture_in_gop_number) { | s->gop_size > s->picture_in_gop_number) { | ||||
b_frames = s->gop_size - s->picture_in_gop_number - 1; | b_frames = s->gop_size - s->picture_in_gop_number - 1; | ||||
} else { | } else { | ||||
if (s->flags & CODEC_FLAG_CLOSED_GOP) | |||||
if (s->avctx->flags & CODEC_FLAG_CLOSED_GOP) | |||||
b_frames = 0; | b_frames = 0; | ||||
s->input_picture[b_frames]->f->pict_type = AV_PICTURE_TYPE_I; | 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) | s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_I) | ||||
b_frames--; | b_frames--; | ||||
@@ -1659,7 +1657,7 @@ vbv_retry: | |||||
assert(s->avctx->rc_max_rate); | assert(s->avctx->rc_max_rate); | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_PASS1) | |||||
if (s->avctx->flags & CODEC_FLAG_PASS1) | |||||
ff_write_pass1_stats(s); | ff_write_pass1_stats(s); | ||||
for (i = 0; i < 4; i++) { | for (i = 0; i < 4; i++) { | ||||
@@ -1667,7 +1665,7 @@ vbv_retry: | |||||
avctx->error[i] += s->current_picture_ptr->f->error[i]; | 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 + | assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + | ||||
avctx->i_tex_bits + avctx->p_tex_bits == | avctx->i_tex_bits + avctx->p_tex_bits == | ||||
put_bits_count(&s->pb)); | put_bits_count(&s->pb)); | ||||
@@ -1955,7 +1953,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, | |||||
} | } | ||||
if (s->mb_intra) { | if (s->mb_intra) { | ||||
if (s->flags & CODEC_FLAG_INTERLACED_DCT) { | |||||
if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) { | |||||
int progressive_score, interlaced_score; | int progressive_score, interlaced_score; | ||||
s->interlaced_dct = 0; | s->interlaced_dct = 0; | ||||
@@ -1984,7 +1982,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[2], ptr_y + dct_offset, wrap_y); | ||||
s->pdsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, 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[4] = 1; | ||||
skip_dct[5] = 1; | skip_dct[5] = 1; | ||||
} else { | } else { | ||||
@@ -2027,7 +2025,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, | |||||
op_pix, op_qpix); | op_pix, op_qpix); | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_INTERLACED_DCT) { | |||||
if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) { | |||||
int progressive_score, interlaced_score; | int progressive_score, interlaced_score; | ||||
s->interlaced_dct = 0; | s->interlaced_dct = 0; | ||||
@@ -2064,7 +2062,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, | |||||
s->pdsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, | s->pdsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, | ||||
dest_y + dct_offset + 8, wrap_y); | 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[4] = 1; | ||||
skip_dct[5] = 1; | skip_dct[5] = 1; | ||||
} else { | } else { | ||||
@@ -2174,7 +2172,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[4] = | ||||
s->block_last_index[5] = 0; | s->block_last_index[5] = 0; | ||||
s->block[4][0] = | s->block[4][0] = | ||||
@@ -2486,7 +2484,7 @@ static void write_slice_end(MpegEncContext *s){ | |||||
avpriv_align_put_bits(&s->pb); | avpriv_align_put_bits(&s->pb); | ||||
flush_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); | s->misc_bits+= get_bits_diff(s); | ||||
} | } | ||||
@@ -2697,7 +2695,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ | |||||
break; | break; | ||||
} | } | ||||
if(s->flags&CODEC_FLAG_PASS1){ | |||||
if (s->avctx->flags & CODEC_FLAG_PASS1) { | |||||
int bits= put_bits_count(&s->pb); | int bits= put_bits_count(&s->pb); | ||||
s->misc_bits+= bits - s->last_bits; | s->misc_bits+= bits - s->last_bits; | ||||
s->last_bits= bits; | s->last_bits= bits; | ||||
@@ -3116,7 +3114,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ | |||||
s->p_mv_table[xy][1]=0; | s->p_mv_table[xy][1]=0; | ||||
} | } | ||||
if(s->flags&CODEC_FLAG_PSNR){ | |||||
if (s->avctx->flags & CODEC_FLAG_PSNR) { | |||||
int w= 16; | int w= 16; | ||||
int h= 16; | int h= 16; | ||||
@@ -3281,11 +3279,11 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
s->no_rounding ^= 1; | s->no_rounding ^= 1; | ||||
} | } | ||||
if(s->flags & CODEC_FLAG_PASS2){ | |||||
if (s->avctx->flags & CODEC_FLAG_PASS2) { | |||||
if (estimate_qp(s,1) < 0) | if (estimate_qp(s,1) < 0) | ||||
return -1; | return -1; | ||||
ff_get_2pass_fcode(s); | 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) | if(s->pict_type==AV_PICTURE_TYPE_B) | ||||
s->lambda= s->last_lambda_for[s->pict_type]; | s->lambda= s->last_lambda_for[s->pict_type]; | ||||
else | else | ||||
@@ -3343,7 +3341,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) { | 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); | 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; | int a,b; | ||||
a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select | 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); | b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I); | ||||
@@ -3352,7 +3350,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
ff_fix_long_p_mvs(s); | 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); | 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; | int j; | ||||
for(i=0; i<2; i++){ | for(i=0; i<2; i++){ | ||||
for(j=0; j<2; j++) | for(j=0; j<2; j++) | ||||
@@ -3377,7 +3375,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_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_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); | 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; | int dir, j; | ||||
for(dir=0; dir<2; dir++){ | for(dir=0; dir<2; dir++){ | ||||
for(i=0; i<2; i++){ | for(i=0; i<2; i++){ | ||||
@@ -3396,7 +3394,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) | |||||
if (estimate_qp(s, 0) < 0) | if (estimate_qp(s, 0) < 0) | ||||
return -1; | 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 | s->qscale= 3; //reduce clipping problems | ||||
if (s->out_format == FMT_MJPEG) { | if (s->out_format == FMT_MJPEG) { | ||||
@@ -86,7 +86,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; | return; | ||||
motion_x = s->sprite_offset[1][0]; | motion_x = s->sprite_offset[1][0]; | ||||
@@ -163,7 +163,7 @@ static void gmc_motion(MpegEncContext *s, | |||||
a + 1, (1 << (2 * a + 1)) - s->no_rounding, | a + 1, (1 << (2 * a + 1)) - s->no_rounding, | ||||
s->h_edge_pos, s->v_edge_pos); | 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; | return; | ||||
ox = s->sprite_offset[1][0] + s->sprite_delta[0][0] * s->mb_x * 8 + | 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 << field_based, | src_x, src_y << field_based, | ||||
s->h_edge_pos, s->v_edge_pos); | s->h_edge_pos, s->v_edge_pos); | ||||
ptr_y = s->edge_emu_buffer; | 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 *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | ||||
s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, | s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, | ||||
s->uvlinesize, s->uvlinesize, | s->uvlinesize, s->uvlinesize, | ||||
@@ -356,7 +356,7 @@ void mpeg_motion_internal(MpegEncContext *s, | |||||
pix_op[0][dxy](dest_y, ptr_y, linesize, h); | 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] | pix_op[s->chroma_x_shift][uvdxy] | ||||
(dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); | (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); | ||||
pix_op[s->chroma_x_shift][uvdxy] | pix_op[s->chroma_x_shift][uvdxy] | ||||
@@ -544,7 +544,7 @@ static inline void qpel_motion(MpegEncContext *s, | |||||
src_x, src_y << field_based, | src_x, src_y << field_based, | ||||
s->h_edge_pos, s->v_edge_pos); | s->h_edge_pos, s->v_edge_pos); | ||||
ptr_y = s->edge_emu_buffer; | 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 *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | ||||
s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, | s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, | ||||
s->uvlinesize, s->uvlinesize, | s->uvlinesize, s->uvlinesize, | ||||
@@ -580,7 +580,7 @@ static inline void qpel_motion(MpegEncContext *s, | |||||
qpix_op[1][dxy](dest_y, ptr_y, linesize); | qpix_op[1][dxy](dest_y, ptr_y, linesize); | ||||
qpix_op[1][dxy](dest_y + 8, ptr_y + 8, 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_cr, ptr_cr, uvlinesize, h >> 1); | ||||
pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1); | pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1); | ||||
} | } | ||||
@@ -736,7 +736,7 @@ static inline void apply_obmc(MpegEncContext *s, | |||||
mx += mv[0][0]; | mx += mv[0][0]; | ||||
my += mv[0][1]; | 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, | chroma_4mv_motion(s, dest_cb, dest_cr, | ||||
ref_picture, pix_op[1], | ref_picture, pix_op[1], | ||||
mx, my); | mx, my); | ||||
@@ -809,7 +809,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, | chroma_4mv_motion(s, dest_cb, dest_cr, | ||||
ref_picture, pix_op[1], mx, my); | ref_picture, pix_op[1], mx, my); | ||||
} | } | ||||
@@ -285,7 +285,7 @@ void ff_xvmc_decode_mb(MpegEncContext *s) | |||||
cbp++; | 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 | if (s->mb_intra) { // intra frames are always full chroma blocks | ||||
for (i = 4; i < blocks_per_mb; i++) { | for (i = 4; i < blocks_per_mb; i++) { | ||||
memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them | memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them | ||||
@@ -150,7 +150,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) | |||||
} | } | ||||
rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; | rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; | ||||
if (s->flags & CODEC_FLAG_PASS2) { | |||||
if (s->avctx->flags & CODEC_FLAG_PASS2) { | |||||
int i; | int i; | ||||
char *p; | char *p; | ||||
@@ -214,7 +214,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) | |||||
return -1; | return -1; | ||||
// FIXME maybe move to end | // 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 | #if CONFIG_LIBXVID | ||||
return ff_xvid_rate_control_init(s); | return ff_xvid_rate_control_init(s); | ||||
#else | #else | ||||
@@ -225,7 +225,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_qsum = 0.001; | ||||
rcc->short_term_qcount = 0.001; | rcc->short_term_qcount = 0.001; | ||||
@@ -294,7 +294,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s) | |||||
av_freep(&rcc->entry); | av_freep(&rcc->entry); | ||||
#if CONFIG_LIBXVID | #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); | ff_xvid_rate_control_uninit(s); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -744,7 +744,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) | |||||
emms_c(); | emms_c(); | ||||
#if CONFIG_LIBXVID | #if CONFIG_LIBXVID | ||||
if ((s->flags & CODEC_FLAG_PASS2) && | |||||
if ((s->avctx->flags & CODEC_FLAG_PASS2) && | |||||
s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) | s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) | ||||
return ff_xvid_rate_estimate_qscale(s, dry_run); | return ff_xvid_rate_estimate_qscale(s, dry_run); | ||||
#endif | #endif | ||||
@@ -761,7 +761,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) | |||||
sqrt(last_var), s->frame_bits); | sqrt(last_var), s->frame_bits); | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_PASS2) { | |||||
if (s->avctx->flags & CODEC_FLAG_PASS2) { | |||||
assert(picture_number >= 0); | assert(picture_number >= 0); | ||||
assert(picture_number < rcc->num_entries); | assert(picture_number < rcc->num_entries); | ||||
rce = &rcc->entry[picture_number]; | rce = &rcc->entry[picture_number]; | ||||
@@ -792,7 +792,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; | var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; | ||||
short_term_q = 0; /* avoid warning */ | 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) | if (pict_type != AV_PICTURE_TYPE_I) | ||||
assert(pict_type == rce->new_pict_type); | assert(pict_type == rce->new_pict_type); | ||||
@@ -275,7 +275,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, | |||||
s->m.pict_type = f->pict_type; | s->m.pict_type = f->pict_type; | ||||
s->m.me_method = s->avctx->me_method; | s->m.me_method = s->avctx->me_method; | ||||
s->m.me.scene_change_score = 0; | s->m.me.scene_change_score = 0; | ||||
s->m.flags = s->avctx->flags; | |||||
// s->m.out_format = FMT_H263; | // s->m.out_format = FMT_H263; | ||||
// s->m.unrestricted_mv = 1; | // s->m.unrestricted_mv = 1; | ||||
s->m.lambda = f->quality; | s->m.lambda = f->quality; | ||||
@@ -1416,7 +1416,7 @@ static int vc1_decode_p_mb(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (v->rangeredfrm) | if (v->rangeredfrm) | ||||
@@ -1437,7 +1437,7 @@ static int vc1_decode_p_mb(VC1Context *v) | |||||
} else if (val) { | } else if (val) { | ||||
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, | 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, | s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
block_cbp |= pat << (i << 2); | block_cbp |= pat << (i << 2); | ||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
ttmb = -1; | ttmb = -1; | ||||
@@ -1527,7 +1527,7 @@ static int vc1_decode_p_mb(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, | vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (v->rangeredfrm) | if (v->rangeredfrm) | ||||
@@ -1549,7 +1549,7 @@ static int vc1_decode_p_mb(VC1Context *v) | |||||
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : s->linesize, | (i & 4) ? s->uvlinesize : s->linesize, | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), | |||||
&block_tt); | &block_tt); | ||||
block_cbp |= pat << (i << 2); | block_cbp |= pat << (i << 2); | ||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
@@ -1675,7 +1675,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | |||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (i < 4) { | if (i < 4) { | ||||
stride_y = s->linesize << fieldtx; | stride_y = s->linesize << fieldtx; | ||||
@@ -1766,7 +1767,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) | |||||
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx), | (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
block_cbp |= pat << (i << 2); | block_cbp |= pat << (i << 2); | ||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
ttmb = -1; | ttmb = -1; | ||||
@@ -1845,7 +1846,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | ||||
@@ -1902,7 +1903,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) | |||||
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : s->linesize, | (i & 4) ? s->uvlinesize : s->linesize, | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), | |||||
&block_tt); | &block_tt); | ||||
block_cbp |= pat << (i << 2); | block_cbp |= pat << (i << 2); | ||||
if (!v->ttmbf && ttmb < 8) ttmb = -1; | if (!v->ttmbf && ttmb < 8) ttmb = -1; | ||||
@@ -2048,7 +2049,7 @@ static void vc1_decode_b_mb(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (v->rangeredfrm) | if (v->rangeredfrm) | ||||
@@ -2062,7 +2063,7 @@ static void vc1_decode_b_mb(VC1Context *v) | |||||
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : s->linesize, | (i & 4) ? s->uvlinesize : s->linesize, | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), NULL); | |||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
ttmb = -1; | ttmb = -1; | ||||
first_block = 0; | first_block = 0; | ||||
@@ -2123,7 +2124,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) | |||||
if ((i > 3) && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (v->rangeredfrm) | if (v->rangeredfrm) | ||||
@@ -2218,7 +2219,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) | |||||
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : s->linesize, | (i & 4) ? s->uvlinesize : s->linesize, | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), NULL); | |||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
ttmb = -1; | ttmb = -1; | ||||
first_block = 0; | first_block = 0; | ||||
@@ -2341,7 +2342,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) | |||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant, | vc1_decode_intra_block(v, s->block[i], i, val, mquant, | ||||
(i & 4) ? v->codingset2 : v->codingset); | (i & 4) ? v->codingset2 : v->codingset); | ||||
if (i > 3 && (s->flags & CODEC_FLAG_GRAY)) | |||||
if (i > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | ||||
if (i < 4) { | if (i < 4) { | ||||
@@ -2507,7 +2508,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) | |||||
pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | ||||
first_block, s->dest[dst_idx] + off, | first_block, s->dest[dst_idx] + off, | ||||
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx), | (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), | ||||
(i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
(i & 4) && (s->avctx->flags & CODEC_FLAG_GRAY), &block_tt); | |||||
block_cbp |= pat << (i << 2); | block_cbp |= pat << (i << 2); | ||||
if (!v->ttmbf && ttmb < 8) | if (!v->ttmbf && ttmb < 8) | ||||
ttmb = -1; | ttmb = -1; | ||||
@@ -2650,7 +2651,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); | vc1_decode_i_block(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2); | ||||
if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) | |||||
if (k > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); | v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); | ||||
if (v->pq >= 9 && v->overlap) { | if (v->pq >= 9 && v->overlap) { | ||||
@@ -2674,7 +2675,7 @@ static void vc1_decode_i_blocks(VC1Context *v) | |||||
if (s->mb_x) { | if (s->mb_x) { | ||||
v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); | v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); | ||||
v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); | v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); | ||||
if (!(s->flags & CODEC_FLAG_GRAY)) { | |||||
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { | |||||
v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); | v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); | ||||
v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); | v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); | ||||
} | } | ||||
@@ -2684,7 +2685,7 @@ static void vc1_decode_i_blocks(VC1Context *v) | |||||
if (!s->first_slice_line) { | if (!s->first_slice_line) { | ||||
v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); | v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); | ||||
v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); | v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); | ||||
if (!(s->flags & CODEC_FLAG_GRAY)) { | |||||
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { | |||||
v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); | v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); | ||||
v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); | v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); | ||||
} | } | ||||
@@ -2813,7 +2814,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) | |||||
vc1_decode_i_block_adv(v, block[k], k, val, | vc1_decode_i_block_adv(v, block[k], k, val, | ||||
(k < 4) ? v->codingset : v->codingset2, mquant); | (k < 4) ? v->codingset : v->codingset2, mquant); | ||||
if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) | |||||
if (k > 3 && (s->avctx->flags & CODEC_FLAG_GRAY)) | |||||
continue; | continue; | ||||
v->vc1dsp.vc1_inv_trans_8x8(block[k]); | v->vc1dsp.vc1_inv_trans_8x8(block[k]); | ||||
} | } | ||||
@@ -150,7 +150,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) | |||||
v->block[v->cur_blk_idx][0]); | v->block[v->cur_blk_idx][0]); | ||||
v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][3], | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][3], | ||||
v->block[v->cur_blk_idx][2]); | v->block[v->cur_blk_idx][2]); | ||||
if (!(s->flags & CODEC_FLAG_GRAY)) { | |||||
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { | |||||
v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][4], | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][4], | ||||
v->block[v->cur_blk_idx][4]); | v->block[v->cur_blk_idx][4]); | ||||
v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][5], | v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][5], | ||||
@@ -169,7 +169,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) | |||||
v->block[v->cur_blk_idx][0]); | v->block[v->cur_blk_idx][0]); | ||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][3], | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][3], | ||||
v->block[v->cur_blk_idx][1]); | v->block[v->cur_blk_idx][1]); | ||||
if (!(s->flags & CODEC_FLAG_GRAY)) { | |||||
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { | |||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][4], | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][4], | ||||
v->block[v->cur_blk_idx][4]); | v->block[v->cur_blk_idx][4]); | ||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][5], | v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][5], | ||||
@@ -189,7 +189,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) | |||||
v->block[v->left_blk_idx][0]); | v->block[v->left_blk_idx][0]); | ||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][3], | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][3], | ||||
v->block[v->left_blk_idx][1]); | v->block[v->left_blk_idx][1]); | ||||
if (!(s->flags & CODEC_FLAG_GRAY)) { | |||||
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { | |||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][4], | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][4], | ||||
v->block[v->left_blk_idx][4]); | v->block[v->left_blk_idx][4]); | ||||
v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][5], | v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][5], | ||||
@@ -136,7 +136,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) | |||||
} | } | ||||
/* for grayscale we should not try to read from unknown area */ | /* for grayscale we should not try to read from unknown area */ | ||||
if (s->flags & CODEC_FLAG_GRAY) { | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) { | |||||
srcU = s->edge_emu_buffer + 18 * s->linesize; | srcU = s->edge_emu_buffer + 18 * s->linesize; | ||||
srcV = s->edge_emu_buffer + 18 * s->linesize; | srcV = s->edge_emu_buffer + 18 * s->linesize; | ||||
} | } | ||||
@@ -228,7 +228,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); | s->hdsp.put_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_GRAY) return; | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) | |||||
return; | |||||
/* Chroma MC always uses qpel bilinear */ | /* Chroma MC always uses qpel bilinear */ | ||||
uvmx = (uvmx & 3) << 1; | uvmx = (uvmx & 3) << 1; | ||||
uvmy = (uvmy & 3) << 1; | uvmy = (uvmy & 3) << 1; | ||||
@@ -514,7 +515,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) | |||||
if (!v->field_mode && !v->s.last_picture.f->data[0]) | if (!v->field_mode && !v->s.last_picture.f->data[0]) | ||||
return; | return; | ||||
if (s->flags & CODEC_FLAG_GRAY) | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) | |||||
return; | return; | ||||
for (k = 0; k < 4; k++) { | for (k = 0; k < 4; k++) { | ||||
@@ -685,7 +686,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) | |||||
int use_ic; | int use_ic; | ||||
uint8_t (*lutuv)[256]; | uint8_t (*lutuv)[256]; | ||||
if (s->flags & CODEC_FLAG_GRAY) | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) | |||||
return; | return; | ||||
for (i = 0; i < 4; i++) { | for (i = 0; i < 4; i++) { | ||||
@@ -836,7 +837,7 @@ void ff_vc1_interp_mc(VC1Context *v) | |||||
} | } | ||||
/* for grayscale we should not try to read from unknown area */ | /* for grayscale we should not try to read from unknown area */ | ||||
if (s->flags & CODEC_FLAG_GRAY) { | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) { | |||||
srcU = s->edge_emu_buffer + 18 * s->linesize; | srcU = s->edge_emu_buffer + 18 * s->linesize; | ||||
srcV = s->edge_emu_buffer + 18 * s->linesize; | srcV = s->edge_emu_buffer + 18 * s->linesize; | ||||
} | } | ||||
@@ -933,7 +934,8 @@ void ff_vc1_interp_mc(VC1Context *v) | |||||
s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); | s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); | ||||
} | } | ||||
if (s->flags & CODEC_FLAG_GRAY) return; | |||||
if (s->avctx->flags & CODEC_FLAG_GRAY) | |||||
return; | |||||
/* Chroma MC always uses qpel blilinear */ | /* Chroma MC always uses qpel blilinear */ | ||||
uvmx = (uvmx & 3) << 1; | uvmx = (uvmx & 3) << 1; | ||||
uvmy = (uvmy & 3) << 1; | uvmy = (uvmy & 3) << 1; | ||||
@@ -183,7 +183,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) | |||||
} | } | ||||
alpha = av_clip_uint16(sd->coefs[1][6]); | alpha = av_clip_uint16(sd->coefs[1][6]); | ||||
for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) { | |||||
for (plane = 0; plane < (s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++) { | |||||
int width = v->output_width>>!!plane; | int width = v->output_width>>!!plane; | ||||
for (row = 0; row < v->output_height>>!!plane; row++) { | for (row = 0; row < v->output_height>>!!plane; row++) { | ||||
@@ -301,7 +301,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) | |||||
wrong but it looks better than doing nothing. */ | wrong but it looks better than doing nothing. */ | ||||
if (f && f->data[0]) | if (f && f->data[0]) | ||||
for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) | |||||
for (plane = 0; plane < (s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++) | |||||
for (i = 0; i < v->sprite_height>>!!plane; i++) | for (i = 0; i < v->sprite_height>>!!plane; i++) | ||||
memset(f->data[plane] + i * f->linesize[plane], | memset(f->data[plane] + i * f->linesize[plane], | ||||
plane ? 128 : 0, f->linesize[plane]); | plane ? 128 : 0, f->linesize[plane]); | ||||
@@ -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[2], dest_y + 8 * s->linesize, s->linesize, 2); | ||||
wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3); | 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; | return; | ||||
wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); | 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 * linesize, ptr + 8 * linesize, linesize); | ||||
w->wdsp.put_mspel_pixels_tab[dxy](dest_y + 8 + 8 * linesize, ptr + 8 + 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; | return; | ||||
if (s->out_format == FMT_H263) { | if (s->out_format == FMT_H263) { | ||||
@@ -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_h263_inter = dct_unquantize_h263_inter_mmx; | ||||
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; | s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; | ||||
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_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_intra = dct_unquantize_mpeg2_intra_mmx; | ||||
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; | s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; | ||||
} | } | ||||