1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/h263dec: Remove redundant block parameter from decode_mb

With the exception of mpeg4_decode_studio_mb(), all decode_mb
functions implicitly presumed that the block provided as
argument coincides with MpegEncContext.block (they zeroed the latter
and then used the former to decode the block); mpeg4_decode_studio_mb()
meanwhile did not use the provided block at all (it uses blocks of
int32_t). So remove said parameter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-19 19:39:25 +02:00
parent 584d50c5f3
commit b2be342ab6
7 changed files with 21 additions and 22 deletions

View File

@@ -256,7 +256,7 @@ static int decode_slice(H263DecContext *const h)
get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24)); get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24));
ff_tlog(NULL, "Decoding MB at %dx%d\n", h->c.mb_x, h->c.mb_y); ff_tlog(NULL, "Decoding MB at %dx%d\n", h->c.mb_x, h->c.mb_y);
ret = h->decode_mb(h, h->c.block); ret = h->decode_mb(h);
if (h->c.h263_pred || h->c.h263_aic) { if (h->c.h263_pred || h->c.h263_aic) {
int mb_xy = h->c.mb_y * h->c.mb_stride + h->c.mb_x; int mb_xy = h->c.mb_y * h->c.mb_stride + h->c.mb_x;

View File

@@ -46,7 +46,7 @@ extern VLCElem ff_h263_mv_vlc[];
typedef struct H263DecContext { typedef struct H263DecContext {
MPVContext c; MPVContext c;
int (*decode_mb)(struct H263DecContext *h, int16_t block[6][64]); int (*decode_mb)(struct H263DecContext *h);
} H263DecContext; } H263DecContext;
int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code); int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code);
@@ -64,8 +64,7 @@ int ff_h263_decode_mba(H263DecContext *const h);
void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus); void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus);
int ff_intel_h263_decode_picture_header(H263DecContext *const h); int ff_intel_h263_decode_picture_header(H263DecContext *const h);
int ff_h263_decode_mb(H263DecContext *const h, int ff_h263_decode_mb(H263DecContext *const h);
int16_t block[6][64]);
int ff_h263_resync(H263DecContext *const h); int ff_h263_resync(H263DecContext *const h);

View File

@@ -776,7 +776,7 @@ static int set_direct_mv(MpegEncContext *s)
} }
} }
int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64]) int ff_h263_decode_mb(H263DecContext *const h)
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
int16_t *mot_val; int16_t *mot_val;
@@ -947,7 +947,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64])
//FIXME UMV //FIXME UMV
if (HAS_FORWARD_MV(mb_type)) { if (HAS_FORWARD_MV(mb_type)) {
int16_t *mot_val= ff_h263_pred_motion(&h->c, 0, 0, &pred_x, &pred_y); int16_t *mot_val = ff_h263_pred_motion(&h->c, 0, 0, &pred_x, &pred_y);
h->c.mv_dir = MV_DIR_FORWARD; h->c.mv_dir = MV_DIR_FORWARD;
if (h->c.umvplus) if (h->c.umvplus)
@@ -974,7 +974,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64])
} }
if (HAS_BACKWARD_MV(mb_type)) { if (HAS_BACKWARD_MV(mb_type)) {
int16_t *mot_val= ff_h263_pred_motion(&h->c, 0, 1, &pred_x, &pred_y); int16_t *mot_val = ff_h263_pred_motion(&h->c, 0, 1, &pred_x, &pred_y);
h->c.mv_dir |= MV_DIR_BACKWARD; h->c.mv_dir |= MV_DIR_BACKWARD;
if (h->c.umvplus) if (h->c.umvplus)
@@ -1051,7 +1051,7 @@ intra:
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (h263_decode_block(h, block[i], i, cbp&32) < 0) if (h263_decode_block(h, h->c.block[i], i, cbp&32) < 0)
return -1; return -1;
cbp+=cbp; cbp+=cbp;
} }

View File

@@ -1651,7 +1651,7 @@ not_coded:
* decode partition C of one MB. * decode partition C of one MB.
* @return <0 if an error occurred * @return <0 if an error occurred
*/ */
static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6][64]) static int mpeg4_decode_partitioned_mb(H263DecContext *const h)
{ {
Mpeg4DecContext *const ctx = h263_to_mpeg4(h); Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
const int xy = h->c.mb_x + h->c.mb_y * h->c.mb_stride; const int xy = h->c.mb_x + h->c.mb_y * h->c.mb_stride;
@@ -1711,7 +1711,7 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6]
h->c.bdsp.clear_blocks(h->c.block[0]); h->c.bdsp.clear_blocks(h->c.block[0]);
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, h->c.mb_intra, if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, h->c.mb_intra,
use_intra_dc_vlc, ctx->rvlc) < 0) { use_intra_dc_vlc, ctx->rvlc) < 0) {
av_log(h->c.avctx, AV_LOG_ERROR, av_log(h->c.avctx, AV_LOG_ERROR,
"texture corrupted at %d %d %d\n", "texture corrupted at %d %d %d\n",
@@ -1738,7 +1738,7 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6]
} }
} }
static int mpeg4_decode_mb(H263DecContext *const h, int16_t block[6][64]) static int mpeg4_decode_mb(H263DecContext *const h)
{ {
Mpeg4DecContext *const ctx = h263_to_mpeg4(h); Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
@@ -2076,7 +2076,7 @@ intra:
h->c.bdsp.clear_blocks(h->c.block[0]); h->c.bdsp.clear_blocks(h->c.block[0]);
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32,
1, use_intra_dc_vlc, 0) < 0) 1, use_intra_dc_vlc, 0) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
cbp += cbp; cbp += cbp;
@@ -2086,7 +2086,7 @@ intra:
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 0, 0, 0) < 0) if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, 0, 0, 0) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
cbp += cbp; cbp += cbp;
} }
@@ -2353,7 +2353,7 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx,
return 0; return 0;
} }
static int mpeg4_decode_studio_mb(H263DecContext *const h, int16_t block_[12][64]) static int mpeg4_decode_studio_mb(H263DecContext *const h)
{ {
Mpeg4DecContext *const ctx = h263_to_mpeg4(h); Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
int i; int i;

View File

@@ -106,7 +106,7 @@ static int msmpeg4v2_decode_motion(H263DecContext *const h, int pred, int f_code
return val; return val;
} }
static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64]) static int msmpeg4v12_decode_mb(H263DecContext *const h)
{ {
MSMP4DecContext *const ms = mpv_to_msmpeg4(h); MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
int cbp, code, i; int cbp, code, i;
@@ -203,7 +203,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64])
h->c.bdsp.clear_blocks(h->c.block[0]); h->c.bdsp.clear_blocks(h->c.block[0]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
h->c.mb_x, h->c.mb_y, i); h->c.mb_x, h->c.mb_y, i);
@@ -213,7 +213,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64])
return 0; return 0;
} }
static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64]) static int msmpeg4v34_decode_mb(H263DecContext *const h)
{ {
MSMP4DecContext *const ms = mpv_to_msmpeg4(h); MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
int cbp, code, i; int cbp, code, i;
@@ -294,7 +294,7 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64])
h->c.bdsp.clear_blocks(h->c.block[0]); h->c.bdsp.clear_blocks(h->c.block[0]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
h->c.mb_x, h->c.mb_y, i); h->c.mb_x, h->c.mb_y, i);

View File

@@ -488,7 +488,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
h->c.mv_dir = MV_DIR_FORWARD; h->c.mv_dir = MV_DIR_FORWARD;
h->c.mv_type = MV_TYPE_16X16; h->c.mv_type = MV_TYPE_16X16;
ret = ff_h263_decode_mb(h, h->c.block); ret = ff_h263_decode_mb(h);
// Repeat the slice end check from ff_h263_decode_mb with our active // Repeat the slice end check from ff_h263_decode_mb with our active
// bitstream size // bitstream size

View File

@@ -442,7 +442,7 @@ static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
} }
} }
static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64]) static int wmv2_decode_mb(H263DecContext *const h)
{ {
/* The following is only allowed because this decoder /* The following is only allowed because this decoder
* does not use slice threading. */ * does not use slice threading. */
@@ -522,7 +522,7 @@ static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64])
h->c.mv[0][0][1] = my; h->c.mv[0][0][1] = my;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) { if ((ret = wmv2_decode_inter_block(w, h->c.block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
av_log(h->c.avctx, AV_LOG_ERROR, av_log(h->c.avctx, AV_LOG_ERROR,
"\nerror while decoding inter block: %d x %d (%d)\n", "\nerror while decoding inter block: %d x %d (%d)\n",
h->c.mb_x, h->c.mb_y, i); h->c.mb_x, h->c.mb_y, i);
@@ -549,7 +549,7 @@ static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64])
h->c.bdsp.clear_blocks(h->c.block[0]); h->c.bdsp.clear_blocks(h->c.block[0]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
ret = ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL); ret = ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL);
if (ret < 0) { if (ret < 0) {
av_log(h->c.avctx, AV_LOG_ERROR, av_log(h->c.avctx, AV_LOG_ERROR,
"\nerror while decoding intra block: %d x %d (%d)\n", "\nerror while decoding intra block: %d x %d (%d)\n",