You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mpegvideo: Move mb_num_left to {H263,RV34}DecContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -50,6 +50,8 @@ typedef struct H263DecContext {
|
|||||||
|
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
|
|
||||||
|
int mb_num_left; ///< number of MBs left in this video packet (for partitioned slices only)
|
||||||
|
|
||||||
int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
|
int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
|
||||||
|
|
||||||
/* motion compensation */
|
/* motion compensation */
|
||||||
|
@ -1061,7 +1061,7 @@ intra:
|
|||||||
return -1;
|
return -1;
|
||||||
if (h->c.obmc && !h->c.mb_intra) {
|
if (h->c.obmc && !h->c.mb_intra) {
|
||||||
if (h->c.pict_type == AV_PICTURE_TYPE_P &&
|
if (h->c.pict_type == AV_PICTURE_TYPE_P &&
|
||||||
h->c.mb_x + 1 < h->c.mb_width && h->c.mb_num_left != 1)
|
h->c.mb_x + 1 < h->c.mb_width && h->mb_num_left != 1)
|
||||||
preview_obmc(h);
|
preview_obmc(h);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
|
@ -1335,7 +1335,7 @@ int ff_mpeg4_decode_partitions(H263DecContext *const h)
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
h->c.mb_num_left = mb_num;
|
h->mb_num_left = mb_num;
|
||||||
|
|
||||||
if (h->c.pict_type == AV_PICTURE_TYPE_I) {
|
if (h->c.pict_type == AV_PICTURE_TYPE_I) {
|
||||||
while (show_bits(&h->gb, 9) == 1)
|
while (show_bits(&h->gb, 9) == 1)
|
||||||
@ -1723,7 +1723,7 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* per-MB end of slice check */
|
/* per-MB end of slice check */
|
||||||
if (--h->c.mb_num_left <= 0) {
|
if (--h->mb_num_left <= 0) {
|
||||||
if (mpeg4_is_resync(ctx))
|
if (mpeg4_is_resync(ctx))
|
||||||
return SLICE_END;
|
return SLICE_END;
|
||||||
else
|
else
|
||||||
|
@ -214,7 +214,6 @@ typedef struct MpegEncContext {
|
|||||||
/* error concealment / resync */
|
/* error concealment / resync */
|
||||||
int resync_mb_x; ///< x position of last resync marker
|
int resync_mb_x; ///< x position of last resync marker
|
||||||
int resync_mb_y; ///< y position of last resync marker
|
int resync_mb_y; ///< y position of last resync marker
|
||||||
int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only)
|
|
||||||
|
|
||||||
/* H.263 specific */
|
/* H.263 specific */
|
||||||
int gob_index;
|
int gob_index;
|
||||||
|
@ -481,7 +481,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
|
|||||||
ff_init_block_index(&h->c);
|
ff_init_block_index(&h->c);
|
||||||
|
|
||||||
/* decode each macroblock */
|
/* decode each macroblock */
|
||||||
for (h->c.mb_num_left = mb_count; h->c.mb_num_left > 0; h->c.mb_num_left--) {
|
for (h->mb_num_left = mb_count; h->mb_num_left > 0; h->mb_num_left--) {
|
||||||
int ret;
|
int ret;
|
||||||
ff_update_block_index(&h->c, 8, h->c.avctx->lowres, 1);
|
ff_update_block_index(&h->c, 8, h->c.avctx->lowres, 1);
|
||||||
ff_tlog(avctx, "**mb x=%d y=%d\n", h->c.mb_x, h->c.mb_y);
|
ff_tlog(avctx, "**mb x=%d y=%d\n", h->c.mb_x, h->c.mb_y);
|
||||||
|
@ -1362,7 +1362,7 @@ static int check_slice_end(RV34DecContext *r, MpegEncContext *s)
|
|||||||
int bits;
|
int bits;
|
||||||
if(s->mb_y >= s->mb_height)
|
if(s->mb_y >= s->mb_height)
|
||||||
return 1;
|
return 1;
|
||||||
if(!s->mb_num_left)
|
if (!r->mb_num_left)
|
||||||
return 1;
|
return 1;
|
||||||
if(r->s.mb_skip_run > 1)
|
if(r->s.mb_skip_run > 1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1446,7 +1446,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
|
|||||||
|
|
||||||
r->si.end = end;
|
r->si.end = end;
|
||||||
s->qscale = r->si.quant;
|
s->qscale = r->si.quant;
|
||||||
s->mb_num_left = r->si.end - r->si.start;
|
r->mb_num_left = r->si.end - r->si.start;
|
||||||
r->s.mb_skip_run = 0;
|
r->s.mb_skip_run = 0;
|
||||||
|
|
||||||
mb_pos = s->mb_x + s->mb_y * s->mb_width;
|
mb_pos = s->mb_x + s->mb_y * s->mb_width;
|
||||||
@ -1492,7 +1492,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
|
|||||||
}
|
}
|
||||||
if(s->mb_x == s->resync_mb_x)
|
if(s->mb_x == s->resync_mb_x)
|
||||||
s->first_slice_line=0;
|
s->first_slice_line=0;
|
||||||
s->mb_num_left--;
|
r->mb_num_left--;
|
||||||
}
|
}
|
||||||
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
|
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
|
||||||
|
|
||||||
@ -1579,7 +1579,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict)
|
|||||||
|
|
||||||
ff_er_frame_end(&s->er, NULL);
|
ff_er_frame_end(&s->er, NULL);
|
||||||
ff_mpv_frame_end(s);
|
ff_mpv_frame_end(s);
|
||||||
s->mb_num_left = 0;
|
r->mb_num_left = 0;
|
||||||
|
|
||||||
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
|
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
|
||||||
ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX);
|
ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX);
|
||||||
@ -1667,9 +1667,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
|||||||
|
|
||||||
/* first slice */
|
/* first slice */
|
||||||
if (si.start == 0) {
|
if (si.start == 0) {
|
||||||
if (s->mb_num_left > 0 && s->cur_pic.ptr) {
|
if (r->mb_num_left > 0 && s->cur_pic.ptr) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n",
|
av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n",
|
||||||
s->mb_num_left);
|
r->mb_num_left);
|
||||||
if (!s->context_reinit)
|
if (!s->context_reinit)
|
||||||
ff_er_frame_end(&s->er, NULL);
|
ff_er_frame_end(&s->er, NULL);
|
||||||
ff_mpv_frame_end(s);
|
ff_mpv_frame_end(s);
|
||||||
@ -1772,7 +1772,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
|||||||
size = offset1 - offset;
|
size = offset1 - offset;
|
||||||
|
|
||||||
r->si.end = s->mb_width * s->mb_height;
|
r->si.end = s->mb_width * s->mb_height;
|
||||||
s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
|
r->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
|
||||||
|
|
||||||
if(i+1 < slice_count){
|
if(i+1 < slice_count){
|
||||||
int offset2 = get_slice_offset(avctx, slices_hdr, i+2, slice_count, buf_size);
|
int offset2 = get_slice_offset(avctx, slices_hdr, i+2, slice_count, buf_size);
|
||||||
@ -1808,7 +1808,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
|||||||
* only complete frames */
|
* only complete frames */
|
||||||
ff_er_frame_end(&s->er, NULL);
|
ff_er_frame_end(&s->er, NULL);
|
||||||
ff_mpv_frame_end(s);
|
ff_mpv_frame_end(s);
|
||||||
s->mb_num_left = 0;
|
r->mb_num_left = 0;
|
||||||
ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX);
|
ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,8 @@ typedef struct RV34DecContext{
|
|||||||
H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
|
H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction
|
||||||
SliceInfo si; ///< current slice information
|
SliceInfo si; ///< current slice information
|
||||||
|
|
||||||
|
int mb_num_left; ///< number of MBs left in this video packet
|
||||||
|
|
||||||
int *mb_type; ///< internal macroblock types
|
int *mb_type; ///< internal macroblock types
|
||||||
int block_type; ///< current block type
|
int block_type; ///< current block type
|
||||||
int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
|
int luma_vlc; ///< which VLC set will be used for decoding of luma blocks
|
||||||
|
Reference in New Issue
Block a user