It is just a duplicate of AVCodecContext member so use it directly.
---
libavcodec/h261dec.c | 2 -
libavcodec/h263dec.c | 25 +++++------
libavcodec/ituh263dec.c | 10 ++---
libavcodec/ituh263enc.c | 4 +-
libavcodec/motion_est.c | 15 ++++---
libavcodec/mpeg12dec.c | 14 +++---
libavcodec/mpeg12enc.c | 20 ++++-----
libavcodec/mpeg4videodec.c | 2 +-
libavcodec/mpegvideo.c | 36 ++++++++-------
libavcodec/mpegvideo.h | 1 -
libavcodec/mpegvideo_enc.c | 100 +++++++++++++++++++++++-------------------
libavcodec/mpegvideo_motion.c | 6 +--
libavcodec/ratecontrol.c | 2 +-
libavcodec/rv10.c | 5 +--
libavcodec/rv34.c | 5 +--
15 files changed, 127 insertions(+), 120 deletions(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 8e97309..60ff97c 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -78,11 +78,9 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->width = s->avctx->coded_width;
s->height = s->avctx->coded_height;
- s->codec_id = s->avctx->codec->id;
s->out_format = FMT_H261;
s->low_delay = 1;
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- s->codec_id = avctx->codec->id;
ff_h261_common_init();
h261_decode_init_vlc(h);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 93d9c55..62e6503 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -113,7 +113,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
avctx->codec->id);
return AVERROR(ENOSYS);
}
- s->codec_id = avctx->codec->id;
/* for h263, we allocate the images after having read the header */
if (avctx->codec->id != AV_CODEC_ID_H263 &&
@@ -193,7 +192,7 @@ static int decode_slice(MpegEncContext *s)
if (s->partitioned_frame) {
const int qscale = s->qscale;
- if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4)
+ if (CONFIG_MPEG4_DECODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4)
if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0)
return ret;
@@ -288,7 +287,7 @@ static int decode_slice(MpegEncContext *s)
assert(s->mb_x == 0 && s->mb_y == s->mb_height);
- if (s->codec_id == AV_CODEC_ID_MPEG4 &&
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
(s->workaround_bugs & FF_BUG_AUTODETECT) &&
get_bits_left(&s->gb) >= 48 &&
show_bits(&s->gb, 24) == 0x4010 &&
@@ -296,7 +295,7 @@ static int decode_slice(MpegEncContext *s)
s->padding_bug_score += 32;
/* try to detect the padding bug */
- if (s->codec_id == AV_CODEC_ID_MPEG4 &&
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
(s->workaround_bugs & FF_BUG_AUTODETECT) &&
get_bits_left(&s->gb) >= 0 &&
get_bits_left(&s->gb) < 48 &&
@@ -321,7 +320,7 @@ static int decode_slice(MpegEncContext *s)
}
if (s->workaround_bugs & FF_BUG_AUTODETECT) {
- if (s->codec_id == AV_CODEC_ID_H263 ||
+ if (s->avctx->codec_id == AV_CODEC_ID_H263 ||
(s->padding_bug_score > -2 && !s->data_partitioning))
s->workaround_bugs |= FF_BUG_NO_PADDING;
else
@@ -394,9 +393,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
if (s->avctx->flags & CODEC_FLAG_TRUNCATED) {
int next;
- if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {
+ if (CONFIG_MPEG4_DECODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4) {
next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
- } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {
+ } else if (CONFIG_H263_DECODER && s->avctx->codec_id ==
AV_CODEC_ID_H263) {
next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
} else {
av_log(s->avctx, AV_LOG_ERROR,
@@ -428,7 +427,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
ret = ff_wmv2_decode_picture_header(s);
} else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
ret = ff_msmpeg4_decode_picture_header(s);
- } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
+ } else if (CONFIG_MPEG4_DECODER && s->avctx->codec_id ==
AV_CODEC_ID_MPEG4) {
if (s->avctx->extradata_size && s->picture_number == 0) {
GetBitContext gb;
@@ -439,7 +438,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
ff_mpeg4_decode_picture_header(avctx->priv_data, &gb);
}
ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb);
- } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
+ } else if (CONFIG_H263I_DECODER && s->avctx->codec_id ==
AV_CODEC_ID_H263I) {
ret = ff_intel_h263_decode_picture_header(s);
} else if (CONFIG_FLV_DECODER && s->h263_flv) {
ret = ff_flv_decode_picture_header(s);
@@ -518,9 +517,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
}
}
- if (s->codec_id == AV_CODEC_ID_H263 ||
- s->codec_id == AV_CODEC_ID_H263P ||
- s->codec_id == AV_CODEC_ID_H263I)
+ if (s->avctx->codec_id == AV_CODEC_ID_H263 ||
+ s->avctx->codec_id == AV_CODEC_ID_H263P ||
+ s->avctx->codec_id == AV_CODEC_ID_H263I)
s->gob_index = ff_h263_get_gob_height(s);
// for skipping the frame
@@ -612,7 +611,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
assert(s->bitstream_buffer_size == 0);
- if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
+ if (CONFIG_MPEG4_DECODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4)
ff_mpeg4_frame_end(avctx, buf, buf_size);
intrax8_decoded:
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index e9e4a35..5cce58f 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -229,14 +229,14 @@ const uint8_t *ff_h263_find_resync_marker(const uint8_t
*restrict p, const uint8
int ff_h263_resync(MpegEncContext *s){
int left, pos, ret;
- if(s->codec_id==AV_CODEC_ID_MPEG4){
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4) {
skip_bits1(&s->gb);
align_get_bits(&s->gb);
}
if(show_bits(&s->gb, 16)==0){
pos= get_bits_count(&s->gb);
- if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
+ if (CONFIG_MPEG4_DECODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4)
ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data);
else
ret= h263_decode_gob_header(s);
@@ -253,7 +253,7 @@ int ff_h263_resync(MpegEncContext *s){
GetBitContext bak= s->gb;
pos= get_bits_count(&s->gb);
- if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
+ if (CONFIG_MPEG4_DECODER && s->avctx->codec_id ==
AV_CODEC_ID_MPEG4)
ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data);
else
ret= h263_decode_gob_header(s);
@@ -457,7 +457,7 @@ static int h263_decode_block(MpegEncContext * s, int16_t *
block,
}
} else if (s->mb_intra) {
/* DC coef */
- if (CONFIG_RV10_DECODER && s->codec_id == AV_CODEC_ID_RV10) {
+ if (CONFIG_RV10_DECODER && s->avctx->codec_id == AV_CODEC_ID_RV10) {
if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) {
int component, diff;
component = (n <= 3 ? 0 : n - 4 + 1);
@@ -514,7 +514,7 @@ retry:
run = get_bits(&s->gb, 6);
level = (int8_t)get_bits(&s->gb, 8);
if(level == -128){
- if (s->codec_id == AV_CODEC_ID_RV10) {
+ if (s->avctx->codec_id == AV_CODEC_ID_RV10) {
/* XXX: should patch encoder too */
level = get_sbits(&s->gb, 12);
}else{
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index a37e744..6acc189 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -285,7 +285,7 @@ void ff_clean_h263_qscales(MpegEncContext *s){
qscale_table[ s->mb_index2xy[i] ]= qscale_table[
s->mb_index2xy[i+1] ]+2;
}
- if(s->codec_id != AV_CODEC_ID_H263P){
+ if (s->avctx->codec_id != AV_CODEC_ID_H263P) {
for(i=1; i<s->mb_num; i++){
int mb_xy= s->mb_index2xy[i];
@@ -791,7 +791,7 @@ av_cold void ff_h263_encode_init(MpegEncContext *s)
s->ac_esc_length= 7+1+6+8;
// use fcodes >1 only for mpeg4 & h263 & h263p FIXME
- switch(s->codec_id){
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_MPEG4:
s->fcode_tab= fcode_tab;
break;
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index c51be8d..74dacd2 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -372,7 +372,7 @@ int ff_init_me(MpegEncContext *s){
c->hpel_put[2][0]= c->hpel_put[2][1]=
c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
- if(s->codec_id == AV_CODEC_ID_H261){
+ if (s->avctx->codec_id == AV_CODEC_ID_H261) {
c->sub_motion_search= no_sub_motion_search;
}
@@ -1496,7 +1496,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
c->skip=0;
- if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
s->next_picture.mbskip_table[xy]) {
int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0
score= ((unsigned)(score*score + 128*256))>>16;
@@ -1507,7 +1507,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
return;
}
- if (s->codec_id == AV_CODEC_ID_MPEG4)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4)
dmin= direct_search(s, mb_x, mb_y);
else
dmin= INT_MAX;
@@ -1580,7 +1580,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
}
//FIXME something smarter
if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //do not try
direct mode if it is invalid for this MB
- if (s->codec_id == AV_CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT
&&
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
+ (type & CANDIDATE_MB_TYPE_DIRECT) &&
s->mpv_flags & FF_MPV_FLAG_MV0 &&
*(uint32_t*)s->b_direct_mv_table[xy])
type |= CANDIDATE_MB_TYPE_DIRECT0;
}
@@ -1600,7 +1601,7 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t
(*mv_table)[2], int type)
if(s->msmpeg4_version)
range= FFMIN(range, 16);
- else if(s->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
+ else if(s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
range= FFMIN(range, 256);
for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
@@ -1652,7 +1653,9 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) <<
f_code);
assert(range <= 16 || !s->msmpeg4_version);
- assert(range <=256 || !(s->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL));
+ assert(range <=256 ||
+ !(s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
+ s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL));
if(c->avctx->me_range && range > c->avctx->me_range) range=
c->avctx->me_range;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c6847ec..6b997de 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -822,7 +822,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->avctx->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++)
mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i);
@@ -1040,7 +1040,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->avctx->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
if (cbp & 32)
@@ -1112,7 +1112,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
s->mpeg_enc_ctx_allocated = 0;
s->mpeg_enc_ctx.picture_number = 0;
s->repeat_field = 0;
- s->mpeg_enc_ctx.codec_id = avctx->codec->id;
avctx->color_range = AVCOL_RANGE_MPEG;
if (avctx->codec->id == AV_CODEC_ID_MPEG1VIDEO)
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
@@ -1254,7 +1253,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
* that behave like P-frames. */
avctx->has_b_frames = !s->low_delay;
- if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
// MPEG-1 fps
avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
// MPEG-1 aspect
@@ -1408,7 +1407,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context
*s1)
s1->frame_rate_ext.den = get_bits(&s->gb, 5) + 1;
ff_dlog(s->avctx, "sequence extension\n");
- s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
+ s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG,
@@ -2129,7 +2128,6 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
s->picture_structure = PICT_FRAME;
s->frame_pred_frame_dct = 1;
s->chroma_format = 1;
- s->codec_id =
s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
s->out_format = FMT_MPEG1;
if (s->avctx->flags & CODEC_FLAG_LOW_DELAY)
@@ -2189,7 +2187,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
s->picture_structure = PICT_FRAME;
s->frame_pred_frame_dct = 1;
s->chroma_format = 1;
- s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
+ s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
s1->save_width = s->width;
s1->save_height = s->height;
s1->save_progressive_seq = s->progressive_sequence;
@@ -2538,7 +2536,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame
*picture,
if (!s->mpeg_enc_ctx_allocated)
break;
- if (s2->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s2->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (mb_y < avctx->skip_top ||
mb_y >= s2->mb_height - avctx->skip_bottom)
break;
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 29438f3..7d1583a 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -215,7 +215,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
for (i = 1; i < 15; i++) {
float error = aspect_ratio;
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || i <= 1)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO || i <= 1)
error -= 1.0 / ff_mpeg1_aspect[i];
else
error -= av_q2d(ff_mpeg2_aspect[i]) * s->height / s->width;
@@ -233,7 +233,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
if (s->avctx->rc_max_rate) {
v = (s->avctx->rc_max_rate + 399) / 400;
- if (v > 0x3ffff && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
+ if (v > 0x3ffff && s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO)
v = 0x3ffff;
} else {
v = 0x3FFFF;
@@ -261,14 +261,14 @@ static void mpeg1_encode_sequence_header(MpegEncContext
*s)
s->avctx->me_range < 128 &&
vbv_buffer_size <= 20 &&
v <= 1856000 / 400 &&
- s->codec_id == AV_CODEC_ID_MPEG1VIDEO;
+ s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO;
put_bits(&s->pb, 1, constraint_parameter_flag);
ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
put_header(s, EXT_START_CODE);
put_bits(&s->pb, 4, 1); // seq ext
@@ -384,7 +384,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int
picture_number)
if (s->pict_type == AV_PICTURE_TYPE_P ||
s->pict_type == AV_PICTURE_TYPE_B) {
put_bits(&s->pb, 1, 0); /* half pel coordinates */
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO)
put_bits(&s->pb, 3, s->f_code); /* forward_f_code */
else
put_bits(&s->pb, 3, 7); /* forward_f_code */
@@ -393,7 +393,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int
picture_number)
// RAL: Backward f_code necessary for B-frames
if (s->pict_type == AV_PICTURE_TYPE_B) {
put_bits(&s->pb, 1, 0); /* half pel coordinates */
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO)
put_bits(&s->pb, 3, s->b_code); /* backward_f_code */
else
put_bits(&s->pb, 3, 7); /* backward_f_code */
@@ -402,7 +402,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int
picture_number)
put_bits(&s->pb, 1, 0); /* extra bit picture */
s->frame_pred_frame_dct = 1;
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
put_header(s, EXT_START_CODE);
put_bits(&s->pb, 4, 8); /* pic ext */
if (s->pict_type == AV_PICTURE_TYPE_P ||
@@ -637,7 +637,7 @@ next_coef:
put_bits(&s->pb, table_vlc[111][1], table_vlc[111][0]);
/* escape: only clip in this case */
put_bits(&s->pb, 6, run);
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
if (alevel < 128) {
put_sbits(&s->pb, 8, level);
} else {
@@ -675,7 +675,7 @@ static av_always_inline void
mpeg1_encode_mb_internal(MpegEncContext *s,
if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 &&
(mb_x != s->mb_width - 1 ||
- (mb_y != s->mb_height - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO))
&&
+ (mb_y != s->mb_height - 1 && s->avctx->codec_id ==
AV_CODEC_ID_MPEG1VIDEO)) &&
((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) ||
(s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir &&
(((s->mv_dir & MV_DIR_FORWARD)
@@ -1024,7 +1024,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
}
s->me.mv_penalty = mv_penalty;
s->fcode_tab = fcode_tab;
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
s->min_qcoeff = -255;
s->max_qcoeff = 255;
} else {
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index ec03aac..9b0507d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1607,7 +1607,7 @@ intra:
end:
/* per-MB end of slice check */
- if (s->codec_id == AV_CODEC_ID_MPEG4) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4) {
if (mpeg4_is_resync(s)) {
const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 90629e9..124d565 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -458,9 +458,9 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture
*pic)
int r, ret;
pic->tf.f = pic->f;
- if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
- s->codec_id != AV_CODEC_ID_VC1IMAGE &&
- s->codec_id != AV_CODEC_ID_MSS2) {
+ if (s->avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
+ s->avctx->codec_id != AV_CODEC_ID_VC1IMAGE &&
+ s->avctx->codec_id != AV_CODEC_ID_MSS2) {
if (edges_needed) {
pic->f->width = s->avctx->width + 2 * EDGE_WIDTH;
pic->f->height = s->avctx->height + 2 * EDGE_WIDTH;
@@ -674,9 +674,9 @@ void ff_mpeg_unref_picture(MpegEncContext *s, Picture *pic)
pic->tf.f = pic->f;
/* WM Image / Screen codecs allocate internal buffers with different
* dimensions / colorspaces; ignore user-defined callbacks for these. */
- if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
- s->codec_id != AV_CODEC_ID_VC1IMAGE &&
- s->codec_id != AV_CODEC_ID_MSS2)
+ if (s->avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
+ s->avctx->codec_id != AV_CODEC_ID_VC1IMAGE &&
+ s->avctx->codec_id != AV_CODEC_ID_MSS2)
ff_thread_release_buffer(s->avctx, &pic->tf);
else if (pic->f)
av_frame_unref(pic->f);
@@ -1173,7 +1173,7 @@ static int init_context_frame(MpegEncContext *s)
}
- if (s->codec_id == AV_CODEC_ID_MPEG4 ||
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 ||
(s->avctx->flags & CODEC_FLAG_INTERLACED_ME)) {
/* interlaced direct mode decoding tables */
for (i = 0; i < 2; i++) {
@@ -1249,7 +1249,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
if (s->encoding && s->avctx->slices)
nb_slices = s->avctx->slices;
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
!s->progressive_sequence)
s->mb_height = (s->height + 31) / 32 * 2;
else
s->mb_height = (s->height + 15) / 16;
@@ -1428,7 +1428,7 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s)
s->current_picture_ptr = NULL;
// init
- if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
!s->progressive_sequence)
s->mb_height = (s->height + 31) / 32 * 2;
else
s->mb_height = (s->height + 15) / 16;
@@ -1730,8 +1730,8 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext
*avctx)
s->current_picture_ptr = pic;
// FIXME use only the vars from current_pic
s->current_picture_ptr->f->top_field_first = s->top_field_first;
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
- s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->picture_structure != PICT_FRAME)
s->current_picture_ptr->f->top_field_first =
(s->picture_structure == PICT_TOP_FIELD) == s->first_field;
@@ -1863,7 +1863,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext
*avctx)
/* set dequantizer, we can't do it during init as
* it might change for mpeg4 and we can't do it in the header
* decode as init is not called for mpeg4 there yet */
- if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->mpeg_quant || s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
} else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) {
@@ -2239,8 +2239,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
/* add dct residue */
- if(s->encoding || !( s->msmpeg4_version ||
s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO
- || (s->codec_id==AV_CODEC_ID_MPEG4 &&
!s->mpeg_quant))){
+ if(s->encoding || !(s->msmpeg4_version ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
+ !s->mpeg_quant))) {
add_dequant_dct(s, block[0], 0, dest_y
, dct_linesize, s->qscale);
add_dequant_dct(s, block[1], 1, dest_y +
block_size, dct_linesize, s->qscale);
add_dequant_dct(s, block[2], 2, dest_y + dct_offset
, dct_linesize, s->qscale);
@@ -2259,7 +2262,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
add_dequant_dct(s, block[7], 7, dest_cr + dct_offset,
dct_linesize, s->chroma_qscale);
}
}
- } else if(is_mpeg12 || (s->codec_id != AV_CODEC_ID_WMV2)){
+ } else if (is_mpeg12 || (s->avctx->codec_id != AV_CODEC_ID_WMV2)){
add_dct(s, block[0], 0, dest_y ,
dct_linesize);
add_dct(s, block[1], 1, dest_y + block_size,
dct_linesize);
add_dct(s, block[2], 2, dest_y + dct_offset ,
dct_linesize);
@@ -2292,7 +2295,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
} else {
/* dct only in intra block */
- if(s->encoding || !(s->codec_id==AV_CODEC_ID_MPEG1VIDEO ||
s->codec_id==AV_CODEC_ID_MPEG2VIDEO)){
+ if(s->encoding || !(s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO)){
put_dct(s, block[0], 0, dest_y ,
dct_linesize, s->qscale);
put_dct(s, block[1], 1, dest_y + block_size,
dct_linesize, s->qscale);
put_dct(s, block[2], 2, dest_y + dct_offset ,
dct_linesize, s->qscale);
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 35c75e4..fc76984 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -234,7 +234,6 @@ typedef struct MpegEncContext {
int h263_plus; ///< h263 plus headers
int h263_flv; ///< use flv h263 header
- enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
int fixed_qscale; ///< fixed qscale if non zero
int encoding; ///< true if we are encoding (vs decoding)
int max_b_frames; ///< max number of b-frames for encoding
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 6510535..ba2cc92 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -239,9 +239,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
MpegEncContext *s = avctx->priv_data;
int i, ret, format_supported;
+ s->avctx = avctx;
mpv_encode_defaults(s);
- switch (avctx->codec_id) {
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_MPEG2VIDEO:
if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
avctx->pix_fmt != AV_PIX_FMT_YUV422P) {
@@ -305,7 +306,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
"is %d.\n", MAX_B_FRAMES);
}
s->max_b_frames = avctx->max_b_frames;
- s->codec_id = avctx->codec->id;
s->strict_std_compliance = avctx->strict_std_compliance;
s->quarter_sample = (avctx->flags & CODEC_FLAG_QPEL) != 0;
s->mpeg_quant = avctx->mpeg_quant;
@@ -389,8 +389,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
if (s->avctx->rc_max_rate &&
s->avctx->rc_min_rate == s->avctx->rc_max_rate &&
- (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
- s->codec_id == AV_CODEC_ID_MPEG2VIDEO) &&
+ (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) &&
90000LL * (avctx->rc_buffer_size - 1) >
s->avctx->rc_max_rate * 0xFFFFLL) {
av_log(avctx, AV_LOG_INFO,
@@ -398,9 +398,11 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
"specified vbv buffer is too large for the given bitrate!\n");
}
- if ((s->avctx->flags & CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4
&&
- s->codec_id != AV_CODEC_ID_H263 && s->codec_id != AV_CODEC_ID_H263P &&
- s->codec_id != AV_CODEC_ID_FLV1) {
+ if ((s->avctx->flags & CODEC_FLAG_4MV) &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->avctx->codec_id != AV_CODEC_ID_H263 &&
+ s->avctx->codec_id != AV_CODEC_ID_H263P &&
+ s->avctx->codec_id != AV_CODEC_ID_FLV1) {
av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
return -1;
}
@@ -411,22 +413,22 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
return -1;
}
- if (s->quarter_sample && s->codec_id != AV_CODEC_ID_MPEG4) {
+ if (s->quarter_sample && s->avctx->codec_id != AV_CODEC_ID_MPEG4) {
av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
return -1;
}
if (s->max_b_frames &&
- s->codec_id != AV_CODEC_ID_MPEG4 &&
- s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
- s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
+ s->avctx->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
return -1;
}
- if ((s->codec_id == AV_CODEC_ID_MPEG4 ||
- s->codec_id == AV_CODEC_ID_H263 ||
- s->codec_id == AV_CODEC_ID_H263P) &&
+ if ((s->avctx->codec_id == AV_CODEC_ID_MPEG4 ||
+ s->avctx->codec_id == AV_CODEC_ID_H263 ||
+ s->avctx->codec_id == AV_CODEC_ID_H263P) &&
(avctx->sample_aspect_ratio.num > 255 ||
avctx->sample_aspect_ratio.den > 255)) {
av_log(avctx, AV_LOG_ERROR,
@@ -436,13 +438,14 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
}
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->avctx->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");
return -1;
}
// FIXME mpeg2 uses that too
- if (s->mpeg_quant && s->codec_id != AV_CODEC_ID_MPEG4) {
+ if (s->mpeg_quant && s->avctx->codec_id != AV_CODEC_ID_MPEG4) {
av_log(avctx, AV_LOG_ERROR,
"mpeg2 style quantization not supported by codec\n");
return -1;
@@ -468,7 +471,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
}
if (s->avctx->flags & CODEC_FLAG_LOW_DELAY) {
- if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR,
"low delay forcing is only available for mpeg2\n");
return -1;
@@ -489,10 +492,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
}
if (s->avctx->thread_count > 1 &&
- s->codec_id != AV_CODEC_ID_MPEG4 &&
- s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
- s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
- (s->codec_id != AV_CODEC_ID_H263P)) {
+ s->avctx->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
+ s->avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
+ (s->avctx->codec_id != AV_CODEC_ID_H263P)) {
av_log(avctx, AV_LOG_ERROR,
"multi threaded encoding not supported by codec\n");
return -1;
@@ -527,8 +530,9 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
//return -1;
}
- if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
- s->codec_id == AV_CODEC_ID_MPEG2VIDEO || s->codec_id ==
AV_CODEC_ID_MJPEG) {
+ if (s->mpeg_quant || s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MJPEG) {
// (a + x * 3 / 8) / x
s->intra_quant_bias = 3 << (QUANT_BIAS_SHIFT - 3);
s->inter_quant_bias = 0;
@@ -543,7 +547,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
if (avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
s->inter_quant_bias = avctx->inter_quant_bias;
- if (avctx->codec_id == AV_CODEC_ID_MPEG4 &&
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
s->avctx->time_base.den > (1 << 16) - 1) {
av_log(avctx, AV_LOG_ERROR,
"timebase %d/%d not supported by MPEG 4 standard, "
@@ -767,7 +771,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
/* init q matrix */
for (i = 0; i < 64; i++) {
int j = s->idsp.idct_permutation[i];
- if (CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4 &&
+ if (CONFIG_MPEG4_ENCODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
s->mpeg_quant) {
s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i];
s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i];
@@ -1538,7 +1542,7 @@ static int frame_start(MpegEncContext *s)
}
}
- if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+ if (s->mpeg_quant || s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
} else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) {
@@ -1639,8 +1643,8 @@ vbv_retry:
// done in encode_picture() so we must undo it
if (s->pict_type == AV_PICTURE_TYPE_P) {
if (s->flipflop_rounding ||
- s->codec_id == AV_CODEC_ID_H263P ||
- s->codec_id == AV_CODEC_ID_MPEG4)
+ s->avctx->codec_id == AV_CODEC_ID_H263P ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG4)
s->no_rounding ^= 1;
}
if (s->pict_type != AV_PICTURE_TYPE_B) {
@@ -1680,7 +1684,7 @@ vbv_retry:
return -1;
}
- switch (s->codec_id) {
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
while (stuffing_count--) {
@@ -1908,7 +1912,7 @@ static av_always_inline void
encode_mb_internal(MpegEncContext *s,
if (s->out_format == FMT_H263) {
s->dquant = av_clip(s->dquant, -2, 2);
- if (s->codec_id == AV_CODEC_ID_MPEG4) {
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG4) {
if (!s->mb_intra) {
if (s->pict_type == AV_PICTURE_TYPE_B) {
if (s->dquant & 1 || s->mv_dir & MV_DIRECT)
@@ -2194,7 +2198,7 @@ static av_always_inline void
encode_mb_internal(MpegEncContext *s,
}
/* huffman encode */
- switch(s->codec_id){ //FIXME funct ptr could be slightly faster
+ switch (s->avctx->codec_id) { //FIXME funct ptr could be slightly faster
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
@@ -2471,7 +2475,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
}
static void write_slice_end(MpegEncContext *s){
- if(CONFIG_MPEG4_ENCODER && s->codec_id==AV_CODEC_ID_MPEG4){
+ if(CONFIG_MPEG4_ENCODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4) {
if(s->partitioned_frame){
ff_mpeg4_merge_partitions(s);
}
@@ -2570,7 +2574,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->last_mv_dir = 0;
- switch(s->codec_id){
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_H263:
case AV_CODEC_ID_H263P:
case AV_CODEC_ID_FLV1:
@@ -2617,7 +2621,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->mb_y = mb_y; // moved into loop, can get changed by H.261
ff_update_block_index(s);
- if(CONFIG_H261_ENCODER && s->codec_id == AV_CODEC_ID_H261){
+ if (CONFIG_H261_ENCODER && s->avctx->codec_id == AV_CODEC_ID_H261)
{
ff_h261_reorder_mb_index(s);
xy= s->mb_y*s->mb_stride + s->mb_x;
mb_type= s->mb_type[xy];
@@ -2633,7 +2637,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0)
is_gob_start=1;
- switch(s->codec_id){
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_H263:
case AV_CODEC_ID_H263P:
if(!s->h263_slice_structured)
@@ -2650,7 +2654,9 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->start_mb_y != mb_y || mb_x!=0){
write_slice_end(s);
- if(CONFIG_MPEG4_ENCODER &&
s->codec_id==AV_CODEC_ID_MPEG4 && s->partitioned_frame){
+ if (CONFIG_MPEG4_ENCODER &&
+ s->avctx->codec_id == AV_CODEC_ID_MPEG4 &&
+ s->partitioned_frame) {
ff_mpeg4_init_partitions(s);
}
}
@@ -2674,7 +2680,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
update_mb_info(s, 1);
- switch(s->codec_id){
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER) {
ff_mpeg4_encode_video_packet_header(s);
@@ -3210,7 +3216,7 @@ static int estimate_qp(MpegEncContext *s, int dry_run){
}
if(s->adaptive_quant){
- switch(s->codec_id){
+ switch (s->avctx->codec_id) {
case AV_CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER)
ff_clean_mpeg4_qscales(s);
@@ -3262,9 +3268,11 @@ static int encode_picture(MpegEncContext *s, int
picture_number)
/* we need to initialize some time vars before we can encode b-frames */
// RAL: Condition added for MPEG1VIDEO
- if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || s->codec_id ==
AV_CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->msmpeg4_version))
+ if (s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ (s->h263_pred && !s->msmpeg4_version))
set_frame_distances(s);
- if(CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4)
+ if(CONFIG_MPEG4_ENCODER && s->avctx->codec_id == AV_CODEC_ID_MPEG4)
ff_set_mpeg4_time(s);
s->me.scene_change_score=0;
@@ -3275,7 +3283,8 @@ static int encode_picture(MpegEncContext *s, int
picture_number)
if(s->msmpeg4_version >= 3) s->no_rounding=1;
else s->no_rounding=0;
}else if(s->pict_type!=AV_PICTURE_TYPE_B){
- if(s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P ||
s->codec_id == AV_CODEC_ID_MPEG4)
+ if(s->flipflop_rounding || s->avctx->codec_id == AV_CODEC_ID_H263P ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG4)
s->no_rounding ^= 1;
}
@@ -3435,20 +3444,19 @@ static int encode_picture(MpegEncContext *s, int
picture_number)
ff_h261_encode_picture_header(s, picture_number);
break;
case FMT_H263:
- if (CONFIG_WMV2_ENCODER && s->codec_id == AV_CODEC_ID_WMV2)
+ if (CONFIG_WMV2_ENCODER && s->avctx->codec_id == AV_CODEC_ID_WMV2)
ff_wmv2_encode_picture_header(s, picture_number);
else if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
ff_msmpeg4_encode_picture_header(s, picture_number);
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
ff_mpeg4_encode_picture_header(s, picture_number);
- else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
+ else if (CONFIG_RV10_ENCODER && s->avctx->codec_id == AV_CODEC_ID_RV10)
ret = ff_rv10_encode_picture_header(s, picture_number);
if (ret < 0)
return ret;
- }
- else if (CONFIG_RV20_ENCODER && s->codec_id == AV_CODEC_ID_RV20)
+ else if (CONFIG_RV20_ENCODER && s->avctx->codec_id == AV_CODEC_ID_RV20)
ff_rv20_encode_picture_header(s, picture_number);
- else if (CONFIG_FLV_ENCODER && s->codec_id == AV_CODEC_ID_FLV1)
+ else if (CONFIG_FLV_ENCODER && s->avctx->codec_id == AV_CODEC_ID_FLV1)
ff_flv_encode_picture_header(s, picture_number);
else if (CONFIG_H263_ENCODER)
ff_h263_encode_picture_header(s, picture_number);
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 95414d1..a04175a 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -310,8 +310,8 @@ void mpeg_motion_internal(MpegEncContext *s,
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 16, 0) ||
(unsigned)src_y > FFMAX(v_edge_pos - (motion_y & 1) - h, 0)) {
if (is_mpeg12 ||
- s->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
- s->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+ s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ s->avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
av_log(s->avctx, AV_LOG_DEBUG,
"MPEG motion vector out of boundary (%d %d)\n", src_x,
src_y);
@@ -862,7 +862,7 @@ static av_always_inline void
mpv_motion_internal(MpegEncContext *s,
ref_picture, pix_op, qpix_op,
s->mv[dir][0][0], s->mv[dir][0][1], 16);
} else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER)
&&
- s->mspel && s->codec_id == AV_CODEC_ID_WMV2) {
+ s->mspel && s->avctx->codec_id == AV_CODEC_ID_WMV2) {
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
ref_picture, pix_op,
s->mv[dir][0][0], s->mv[dir][0][1], 16);
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 620c854..8b51014 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -325,7 +325,7 @@ int ff_vbv_update(MpegEncContext *s, int frame_size)
if (rcc->buffer_index > buffer_size) {
int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
- if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
+ if (stuffing < 4 && s->avctx->codec_id == AV_CODEC_ID_MPEG4)
stuffing = 4;
rcc->buffer_index -= 8 * stuffing;
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 20230f4..b147a98 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -459,7 +459,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->out_format = FMT_H263;
- s->codec_id = avctx->codec_id;
rv->orig_width =
s->width = avctx->coded_width;
@@ -536,7 +535,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const
uint8_t *buf,
active_bits_size = buf_size * 8;
init_get_bits(&s->gb, buf, FFMAX(buf_size, buf_size2) * 8);
- if (s->codec_id == AV_CODEC_ID_RV10)
+ if (s->avctx->codec_id == AV_CODEC_ID_RV10)
mb_count = rv10_decode_picture_header(s);
else
mb_count = rv20_decode_picture_header(rv);
@@ -577,7 +576,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const
uint8_t *buf,
ff_dlog(avctx, "qscale=%d\n", s->qscale);
/* default quantization values */
- if (s->codec_id == AV_CODEC_ID_RV10) {
+ if (s->avctx->codec_id == AV_CODEC_ID_RV10) {
if (s->mb_y == 0)
s->first_slice_line = 1;
} else {
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 26ab7e4..08f9799 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1478,7 +1478,6 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
ff_mpv_decode_defaults(s);
s->avctx = avctx;
s->out_format = FMT_H263;
- s->codec_id = avctx->codec_id;
s->width = avctx->width;
s->height = avctx->height;
@@ -1495,11 +1494,11 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
ff_h264_pred_init(&r->h, AV_CODEC_ID_RV40, 8, 1);
#if CONFIG_RV30_DECODER
- if (avctx->codec_id == AV_CODEC_ID_RV30)
+ if (s->avctx->codec_id == AV_CODEC_ID_RV30)
ff_rv30dsp_init(&r->rdsp);
#endif
#if CONFIG_RV40_DECODER
- if (avctx->codec_id == AV_CODEC_ID_RV40)
+ if (s->avctx->codec_id == AV_CODEC_ID_RV40)
ff_rv40dsp_init(&r->rdsp);
#endif
--
1.9.5 (Apple Git-50.3)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel