Commit d9b264bc authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '848e86f7'

* commit '848e86f7':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 337aa17e 848e86f7
...@@ -594,8 +594,6 @@ static int h261_decode_frame(AVCodecContext *avctx, void *data, ...@@ -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, "*****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;
......
...@@ -144,7 +144,7 @@ static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code ...@@ -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){ 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));
......
...@@ -163,7 +163,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) ...@@ -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 /* 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)
...@@ -414,9 +414,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -414,9 +414,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int slice_ret = 0; int slice_ret = 0;
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 */
...@@ -431,7 +428,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -431,7 +428,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) {
......
...@@ -451,7 +451,7 @@ void ff_h263_encode_mb(MpegEncContext * s, ...@@ -451,7 +451,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 */
......
...@@ -336,7 +336,7 @@ int ff_init_me(MpegEncContext *s){ ...@@ -336,7 +336,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)
...@@ -996,7 +996,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -996,7 +996,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;
...@@ -1004,7 +1004,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1004,7 +1004,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;
...@@ -1017,7 +1017,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1017,7 +1017,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){
...@@ -1025,7 +1025,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1025,7 +1025,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){
...@@ -1553,7 +1553,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, ...@@ -1553,7 +1553,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;
...@@ -1684,7 +1684,7 @@ void ff_fix_long_p_mvs(MpegEncContext * s) ...@@ -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(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 */
......
...@@ -843,7 +843,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) ...@@ -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 ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
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 {
...@@ -1063,7 +1063,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) ...@@ -1063,7 +1063,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
ff_xvmc_pack_pblocks(s, cbp); ff_xvmc_pack_pblocks(s, cbp);
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);
...@@ -1085,7 +1085,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) ...@@ -1085,7 +1085,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
} }
} }
} 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);
...@@ -1469,7 +1469,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) ...@@ -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->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;
...@@ -2192,7 +2192,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, ...@@ -2192,7 +2192,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
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;
s->swap_uv = 0; // AFAIK VCR2 does not have SEQ_HEADER 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; s->low_delay = 1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO) if (s->avctx->debug & FF_DEBUG_PICT_INFO)
...@@ -2645,7 +2645,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, ...@@ -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; s->sync = 1;
if (!s2->next_picture_ptr) { if (!s2->next_picture_ptr) {
/* Skip P-frames if we do not have a reference frame or /* 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, ...@@ -2766,7 +2766,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);
......
...@@ -384,7 +384,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) ...@@ -384,7 +384,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) || 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 put_bits(&s->pb, 1, 0); // broken link
} }
} }
......
...@@ -2222,7 +2222,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) ...@@ -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 */ 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;
} }
...@@ -2601,7 +2601,7 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) ...@@ -2601,7 +2601,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], ...@@ -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], ...@@ -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], ...@@ -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;
...@@ -832,7 +832,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], ...@@ -832,7 +832,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++)
...@@ -932,7 +932,7 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) ...@@ -932,7 +932,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
ff_mpeg4_stuffing(&s->pb); ff_mpeg4_stuffing(&s->pb);
...@@ -1078,7 +1078,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s, ...@@ -1078,7 +1078,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);
...@@ -1092,7 +1092,7 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) ...@@ -1092,7 +1092,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
...@@ -1325,7 +1325,7 @@ static av_cold int encode_init(AVCodecContext *avctx) ...@@ -1325,7 +1325,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);
......
...@@ -405,7 +405,7 @@ static av_cold int dct_init(MpegEncContext *s) ...@@ -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_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;
...@@ -1122,8 +1122,6 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1122,8 +1122,6 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
s->height = avctx->coded_height; s->height = avctx->coded_height;
s->codec_id = avctx->codec->id; s->codec_id = avctx->codec->id;
s->workaround_bugs = avctx->workaround_bugs; s->workaround_bugs = avctx->workaround_bugs;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
/* convert fourcc to upper case */ /* convert fourcc to upper case */
s->codec_tag = avpriv_toupper4(avctx->codec_tag); s->codec_tag = avpriv_toupper4(avctx->codec_tag);
...@@ -1234,7 +1232,7 @@ static int init_context_frame(MpegEncContext *s) ...@@ -1234,7 +1232,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;
...@@ -1330,9 +1328,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) ...@@ -1330,9 +1328,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 */
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
&s->chroma_x_shift, &s->chroma_x_shift,
...@@ -1839,7 +1834,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -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->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;
...@@ -2683,7 +2678,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ...@@ -2683,7 +2678,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
src_x, src_y << field_based, h_edge_pos, src_x, src_y << field_based, h_edge_pos,
v_edge_pos); 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 *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf =ubuf + 9 * s->uvlinesize; uint8_t *vbuf =ubuf + 9 * s->uvlinesize;
s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
...@@ -2718,7 +2713,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ...@@ -2718,7 +2713,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
sy = (sy << 2) >> lowres; sy = (sy << 2) >> lowres;
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy); 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; int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
uvsx = (uvsx << 2) >> lowres; uvsx = (uvsx << 2) >> lowres;
uvsy = (uvsy << 2) >> lowres; uvsy = (uvsy << 2) >> lowres;
...@@ -2838,7 +2833,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, ...@@ -2838,7 +2833,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s,
my += s->mv[dir][i][1]; 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, chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture,
pix_op, mx, my); pix_op, mx, my);
break; break;
...@@ -3078,9 +3073,9 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -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)) 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) if ((s->avctx->flags & CODEC_FLAG_PSNR) || s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor ||
|| s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor !(s->encoding && (s->intra_only || s->pict_type == AV_PICTURE_TYPE_B) &&
|| !(s->encoding && (s->intra_only || s->pict_type==AV_PICTURE_TYPE_B) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc 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];
...@@ -3181,7 +3176,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -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[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);
...@@ -3200,7 +3195,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -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[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);
...@@ -3233,7 +3228,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -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[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);
...@@ -3252,7 +3247,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -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, 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]);
...@@ -3278,7 +3273,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], ...@@ -3278,7 +3273,7 @@ void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
skip_idct: skip_idct:
if(!readable){ if(!readable){
s->hdsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); 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[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); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift);
} }
......
...@@ -243,8 +243,6 @@ typedef struct MpegEncContext { ...@@ -243,8 +243,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;
......
This diff is collapsed.
...@@ -87,7 +87,7 @@ static void gmc1_motion(MpegEncContext *s, ...@@ -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; return;
motion_x = s->sprite_offset[1][0]; motion_x = s->sprite_offset[1][0];
...@@ -164,7 +164,7 @@ static void gmc_motion(MpegEncContext *s, ...@@ -164,7 +164,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, ...@@ -323,7 +323,7 @@ void mpeg_motion_internal(MpegEncContext *s,
src_x, src_y, src_x, src_y,
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 *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf = ubuf + 9 * s->uvlinesize; uint8_t *vbuf = ubuf + 9 * s->uvlinesize;
uvsrc_y = (unsigned)uvsrc_y << field_based; uvsrc_y = (unsigned)uvsrc_y << field_based;
...@@ -358,7 +358,7 @@ void mpeg_motion_internal(MpegEncContext *s, ...@@ -358,7 +358,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]
...@@ -546,7 +546,7 @@ static inline void qpel_motion(MpegEncContext *s, ...@@ -546,7 +546,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 *ubuf = s->edge_emu_buffer + 18 * s->linesize; uint8_t *ubuf = s->edge_emu_buffer + 18 * s->linesize;
uint8_t *vbuf = ubuf + 9 * s->uvlinesize; uint8_t *vbuf = ubuf + 9 * s->uvlinesize;
s->vdsp.emulated_edge_mc(ubuf, ptr_cb, s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
...@@ -583,7 +583,7 @@ static inline void qpel_motion(MpegEncContext *s, ...@@ -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, 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);
} }
...@@ -739,7 +739,7 @@ static inline void apply_obmc(MpegEncContext *s, ...@@ -739,7 +739,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);
...@@ -812,7 +812,7 @@ static inline void apply_8x8(MpegEncContext *s, ...@@ -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, chroma_4mv_motion(s, dest_cb, dest_cr,
ref_picture, pix_op[1], mx, my); ref_picture, pix_op[1], mx, my);
} }
......
...@@ -298,7 +298,7 @@ static void ff_xvmc_decode_mb(struct MpegEncContext *s) ...@@ -298,7 +298,7 @@ static void ff_xvmc_decode_mb(struct 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
......
...@@ -161,7 +161,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) ...@@ -161,7 +161,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
if (!rcc->buffer_index) if (!rcc->buffer_index)
rcc->buffer_index = s->avctx->rc_buffer_size * 3 / 4; 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; int i;
char *p; char *p;
...@@ -227,7 +227,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) ...@@ -227,7 +227,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
...@@ -238,7 +238,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) ...@@ -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_qsum = 0.001;
rcc->short_term_qcount = 0.001; rcc->short_term_qcount = 0.001;
...@@ -307,7 +307,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s) ...@@ -307,7 +307,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
} }
...@@ -760,7 +760,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) ...@@ -760,7 +760,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
...@@ -780,7 +780,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) ...@@ -780,7 +780,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
s->frame_bits - s->stuffing_bits); s->frame_bits - s->stuffing_bits);
} }
if (s->flags & CODEC_FLAG_PASS2) { if (s->avctx->flags & CODEC_FLAG_PASS2) {
av_assert0(picture_number >= 0); av_assert0(picture_number >= 0);
if (picture_number >= rcc->num_entries) { if (picture_number >= rcc->num_entries) {
av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); 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) ...@@ -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; 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)
av_assert0(pict_type == rce->new_pict_type); av_assert0(pict_type == rce->new_pict_type);
......
...@@ -707,8 +707,6 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -707,8 +707,6 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
const uint8_t *slices_hdr = NULL; const uint8_t *slices_hdr = NULL;
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);
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
/* no supplementary picture */ /* no supplementary picture */
if (buf_size == 0) { if (buf_size == 0) {
......
...@@ -69,7 +69,6 @@ static av_cold int encode_init(AVCodecContext *avctx) ...@@ -69,7 +69,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->version=0; s->version=0;
s->m.avctx = avctx; s->m.avctx = avctx;
s->m.flags = avctx->flags;
s->m.bit_rate= avctx->bit_rate; s->m.bit_rate= avctx->bit_rate;
s->m.me.temp = s->m.me.temp =
...@@ -1655,7 +1654,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -1655,7 +1654,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
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.me.dia_size = avctx->dia_size; 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.quarter_sample= (s->avctx->flags & CODEC_FLAG_QPEL)!=0;
s->m.out_format= FMT_H263; s->m.out_format= FMT_H263;
s->m.unrestricted_mv= 1; s->m.unrestricted_mv= 1;
......
...@@ -283,7 +283,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, ...@@ -283,7 +283,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;
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ void ff_vc1_loop_filter_iblk(VC1Context *v, int pq) ...@@ -40,7 +40,7 @@ void ff_vc1_loop_filter_iblk(VC1Context *v, int pq)
if (s->mb_x) 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, s->linesize, pq);
v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, 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++) { for (j = 0; j < 2; j++) {
v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1], s->uvlinesize, pq); v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1], s->uvlinesize, pq);
if (s->mb_x) if (s->mb_x)
...@@ -52,7 +52,7 @@ void ff_vc1_loop_filter_iblk(VC1Context *v, int pq) ...@@ -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_y == s->end_mb_y - 1) {
if (s->mb_x) { if (s->mb_x) {
v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); 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[1], s->uvlinesize, pq);
v->vc1dsp.vc1_h_loop_filter8(s->dest[2], 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) ...@@ -76,7 +76,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq)
if (s->mb_x >= 2) 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 - 16, s->linesize, pq);
v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 8, 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++) { for (j = 0; j < 2; j++) {
v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq);
if (s->mb_x >= 2) { if (s->mb_x >= 2) {
...@@ -94,7 +94,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) ...@@ -94,7 +94,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq)
if (s->mb_x) 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, s->linesize, pq);
v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize + 8, 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++) { for (j = 0; j < 2; j++) {
v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq);
if (s->mb_x >= 2) { if (s->mb_x >= 2) {
...@@ -110,7 +110,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) ...@@ -110,7 +110,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq)
if (s->mb_x >= 2) 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 - 16, s->linesize, pq);
v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 8, 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++) { for (j = 0; j < 2; j++) {
v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); 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) ...@@ -121,7 +121,7 @@ void ff_vc1_loop_filter_iblk_delayed(VC1Context *v, int pq)
if (s->mb_x) 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, s->linesize, pq);
v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, 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++) { for (j = 0; j < 2; j++) {
v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); 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) ...@@ -155,7 +155,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 (!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->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],
...@@ -174,7 +174,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) ...@@ -174,7 +174,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 (!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->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],
...@@ -194,7 +194,7 @@ void ff_vc1_smooth_overlap_filter_iblk(VC1Context *v) ...@@ -194,7 +194,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 (!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->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],
...@@ -336,7 +336,7 @@ void ff_vc1_apply_p_loop_filter(VC1Context *v) ...@@ -336,7 +336,7 @@ void ff_vc1_apply_p_loop_filter(VC1Context *v)
{ {
MpegEncContext *s = &v->s; MpegEncContext *s = &v->s;
int i; 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++) { for (i = 0; i < block_count; i++) {
vc1_apply_p_v_loop_filter(v, i); vc1_apply_p_v_loop_filter(v, i);
......
...@@ -270,7 +270,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) ...@@ -270,7 +270,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 (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) { if (CONFIG_GRAY && 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;
} }
...@@ -332,7 +332,8 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) ...@@ -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); 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 */ /* Chroma MC always uses qpel bilinear */
uvmx = (uvmx & 3) << 1; uvmx = (uvmx & 3) << 1;
uvmy = (uvmy & 3) << 1; uvmy = (uvmy & 3) << 1;
...@@ -517,7 +518,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) ...@@ -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]) if (!v->field_mode && !v->s.last_picture.f->data[0])
return; return;
if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY)
return; return;
/* calculate chroma MV vector from four luma MVs */ /* 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) ...@@ -654,7 +655,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 (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) if (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY)
return; return;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
...@@ -800,7 +801,7 @@ void ff_vc1_interp_mc(VC1Context *v) ...@@ -800,7 +801,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 (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY) { if (CONFIG_GRAY && 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;
} }
...@@ -864,7 +865,8 @@ void ff_vc1_interp_mc(VC1Context *v) ...@@ -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); 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 */ /* Chroma MC always uses qpel blilinear */
uvmx = (uvmx & 3) << 1; uvmx = (uvmx & 3) << 1;
uvmy = (uvmy & 3) << 1; uvmy = (uvmy & 3) << 1;
......
...@@ -190,7 +190,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) ...@@ -190,7 +190,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 < (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; int width = v->output_width>>!!plane;
for (row = 0; row < v->output_height>>!!plane; row++) { for (row = 0; row < v->output_height>>!!plane; row++) {
...@@ -311,7 +311,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) ...@@ -311,7 +311,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 < (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++) 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]);
...@@ -629,7 +629,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -629,7 +629,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
v->second_field = 0; v->second_field = 0;
if(s->flags & CODEC_FLAG_LOW_DELAY) if(s->avctx->flags & CODEC_FLAG_LOW_DELAY)
s->low_delay = 1; s->low_delay = 1;
/* no supplementary picture */ /* no supplementary picture */
......
...@@ -88,7 +88,7 @@ void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], ...@@ -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, ...@@ -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;
dxy = 0; dxy = 0;
......
...@@ -454,7 +454,7 @@ av_cold void ff_mpv_common_init_x86(MpegEncContext *s) ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment