History

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.

Andreas Rheinhardt committed 1 year ago

Commit b2be3421 parent 584d50c7 files · +21 −22Browse files

Unified · Split

7 files
  1. libavcodec/h263dec.c +1 −1
  2. libavcodec/h263dec.h +2 −3
  3. libavcodec/ituh263dec.c +4 −4
  4. libavcodec/mpeg4videodec.c +6 −6
  5. libavcodec/msmpeg4dec.c +4 −4
  6. libavcodec/rv10.c +1 −1
  7. libavcodec/wmv2dec.c +3 −3
libavcodec/h263dec.c+1−1
@@ -256,7 +256,7 @@ static int decode_slice(H263DecContext *const h) · 255 unmodified lines
256 get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24));256 get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24));
257 257
258 ff_tlog(NULL, "Decoding MB at %dx%d\n", h->c.mb_x, h->c.mb_y);258 ff_tlog(NULL, "Decoding MB at %dx%d\n", h->c.mb_x, h->c.mb_y);
259 ret = h->decode_mb(h, h->c.block);259 ret = h->decode_mb(h);
260 260
261 if (h->c.h263_pred || h->c.h263_aic) {261 if (h->c.h263_pred || h->c.h263_aic) {
262 int mb_xy = h->c.mb_y * h->c.mb_stride + h->c.mb_x;262 int mb_xy = h->c.mb_y * h->c.mb_stride + h->c.mb_x;
libavcodec/h263dec.h+2−3
@@ -46,7 +46,7 @@ extern VLCElem ff_h263_mv_vlc[]; · 45 unmodified lines
46typedef struct H263DecContext {46typedef struct H263DecContext {
47 MPVContext c;47 MPVContext c;
48 48
49 int (*decode_mb)(struct H263DecContext *h, int16_t block[6][64]);49 int (*decode_mb)(struct H263DecContext *h);
50} H263DecContext;50} H263DecContext;
51 51
52int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code);52int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code);
@@ -64,8 +64,7 @@ int ff_h263_decode_mba(H263DecContext *const h); · 11 unmodified lines
64void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus);64void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus);
65 65
66int ff_intel_h263_decode_picture_header(H263DecContext *const h);66int ff_intel_h263_decode_picture_header(H263DecContext *const h);
67int ff_h263_decode_mb(H263DecContext *const h,67int ff_h263_decode_mb(H263DecContext *const h);
68 int16_t block[6][64]);
69 68
70int ff_h263_resync(H263DecContext *const h);69int ff_h263_resync(H263DecContext *const h);
71 70
libavcodec/ituh263dec.c+4−4
@@ -776,7 +776,7 @@ static int set_direct_mv(MpegEncContext *s) · 775 unmodified lines
776 }776 }
777}777}
778 778
779int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64])779int ff_h263_decode_mb(H263DecContext *const h)
780{780{
781 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;781 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
782 int16_t *mot_val;782 int16_t *mot_val;
@@ -947,7 +947,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 164 unmodified lines
947//FIXME UMV947//FIXME UMV
948 948
949 if (HAS_FORWARD_MV(mb_type)) {949 if (HAS_FORWARD_MV(mb_type)) {
950 int16_t *mot_val= ff_h263_pred_motion(&h->c, 0, 0, &pred_x, &pred_y);950 int16_t *mot_val = ff_h263_pred_motion(&h->c, 0, 0, &pred_x, &pred_y);
951 h->c.mv_dir = MV_DIR_FORWARD;951 h->c.mv_dir = MV_DIR_FORWARD;
952 952
953 if (h->c.umvplus)953 if (h->c.umvplus)
@@ -974,7 +974,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 20 unmodified lines
974 }974 }
975 975
976 if (HAS_BACKWARD_MV(mb_type)) {976 if (HAS_BACKWARD_MV(mb_type)) {
977 int16_t *mot_val= ff_h263_pred_motion(&h->c, 0, 1, &pred_x, &pred_y);977 int16_t *mot_val = ff_h263_pred_motion(&h->c, 0, 1, &pred_x, &pred_y);
978 h->c.mv_dir |= MV_DIR_BACKWARD;978 h->c.mv_dir |= MV_DIR_BACKWARD;
979 979
980 if (h->c.umvplus)980 if (h->c.umvplus)
@@ -1051,7 +1051,7 @@ intra: · 70 unmodified lines
1051 1051
1052 /* decode each block */1052 /* decode each block */
1053 for (i = 0; i < 6; i++) {1053 for (i = 0; i < 6; i++) {
1054 if (h263_decode_block(h, block[i], i, cbp&32) < 0)1054 if (h263_decode_block(h, h->c.block[i], i, cbp&32) < 0)
1055 return -1;1055 return -1;
1056 cbp+=cbp;1056 cbp+=cbp;
1057 }1057 }
libavcodec/mpeg4videodec.c+6−6
@@ -1651,7 +1651,7 @@ not_coded: · 1650 unmodified lines
1651 * decode partition C of one MB.1651 * decode partition C of one MB.
1652 * @return <0 if an error occurred1652 * @return <0 if an error occurred
1653 */1653 */
1654static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6][64])1654static int mpeg4_decode_partitioned_mb(H263DecContext *const h)
1655{1655{
1656 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);1656 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
1657 const int xy = h->c.mb_x + h->c.mb_y * h->c.mb_stride;1657 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] · 53 unmodified lines
1711 h->c.bdsp.clear_blocks(h->c.block[0]);1711 h->c.bdsp.clear_blocks(h->c.block[0]);
1712 /* decode each block */1712 /* decode each block */
1713 for (i = 0; i < 6; i++) {1713 for (i = 0; i < 6; i++) {
1714 if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, h->c.mb_intra,1714 if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, h->c.mb_intra,
1715 use_intra_dc_vlc, ctx->rvlc) < 0) {1715 use_intra_dc_vlc, ctx->rvlc) < 0) {
1716 av_log(h->c.avctx, AV_LOG_ERROR,1716 av_log(h->c.avctx, AV_LOG_ERROR,
1717 "texture corrupted at %d %d %d\n",1717 "texture corrupted at %d %d %d\n",
@@ -1738,7 +1738,7 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6] · 20 unmodified lines
1738 }1738 }
1739}1739}
1740 1740
1741static int mpeg4_decode_mb(H263DecContext *const h, int16_t block[6][64])1741static int mpeg4_decode_mb(H263DecContext *const h)
1742{1742{
1743 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);1743 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
1744 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;1744 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
@@ -2076,7 +2076,7 @@ intra: · 331 unmodified lines
2076 h->c.bdsp.clear_blocks(h->c.block[0]);2076 h->c.bdsp.clear_blocks(h->c.block[0]);
2077 /* decode each block */2077 /* decode each block */
2078 for (i = 0; i < 6; i++) {2078 for (i = 0; i < 6; i++) {
2079 if (mpeg4_decode_block(ctx, block[i], i, cbp & 32,2079 if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32,
2080 1, use_intra_dc_vlc, 0) < 0)2080 1, use_intra_dc_vlc, 0) < 0)
2081 return AVERROR_INVALIDDATA;2081 return AVERROR_INVALIDDATA;
2082 cbp += cbp;2082 cbp += cbp;
@@ -2086,7 +2086,7 @@ intra: · 3 unmodified lines
2086 2086
2087 /* decode each block */2087 /* decode each block */
2088 for (i = 0; i < 6; i++) {2088 for (i = 0; i < 6; i++) {
2089 if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 0, 0, 0) < 0)2089 if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, 0, 0, 0) < 0)
2090 return AVERROR_INVALIDDATA;2090 return AVERROR_INVALIDDATA;
2091 cbp += cbp;2091 cbp += cbp;
2092 }2092 }
@@ -2353,7 +2353,7 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx, · 260 unmodified lines
2353 return 0;2353 return 0;
2354}2354}
2355 2355
2356static int mpeg4_decode_studio_mb(H263DecContext *const h, int16_t block_[12][64])2356static int mpeg4_decode_studio_mb(H263DecContext *const h)
2357{2357{
2358 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);2358 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
2359 int i;2359 int i;
libavcodec/msmpeg4dec.c+4−4
@@ -106,7 +106,7 @@ static int msmpeg4v2_decode_motion(H263DecContext *const h, int pred, int f_code · 105 unmodified lines
106 return val;106 return val;
107}107}
108 108
109static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64])109static int msmpeg4v12_decode_mb(H263DecContext *const h)
110{110{
111 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);111 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
112 int cbp, code, i;112 int cbp, code, i;
@@ -203,7 +203,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 90 unmodified lines
203 203
204 h->c.bdsp.clear_blocks(h->c.block[0]);204 h->c.bdsp.clear_blocks(h->c.block[0]);
205 for (i = 0; i < 6; i++) {205 for (i = 0; i < 6; i++) {
206 if (ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)206 if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
207 {207 {
208 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",208 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
209 h->c.mb_x, h->c.mb_y, i);209 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]) · 3 unmodified lines
213 return 0;213 return 0;
214}214}
215 215
216static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64])216static int msmpeg4v34_decode_mb(H263DecContext *const h)
217{217{
218 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);218 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
219 int cbp, code, i;219 int cbp, code, i;
@@ -294,7 +294,7 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 74 unmodified lines
294 294
295 h->c.bdsp.clear_blocks(h->c.block[0]);295 h->c.bdsp.clear_blocks(h->c.block[0]);
296 for (i = 0; i < 6; i++) {296 for (i = 0; i < 6; i++) {
297 if (ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)297 if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
298 {298 {
299 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",299 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
300 h->c.mb_x, h->c.mb_y, i);300 h->c.mb_x, h->c.mb_y, i);
libavcodec/rv10.c+1−1
@@ -488,7 +488,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 487 unmodified lines
488 488
489 h->c.mv_dir = MV_DIR_FORWARD;489 h->c.mv_dir = MV_DIR_FORWARD;
490 h->c.mv_type = MV_TYPE_16X16;490 h->c.mv_type = MV_TYPE_16X16;
491 ret = ff_h263_decode_mb(h, h->c.block);491 ret = ff_h263_decode_mb(h);
492 492
493 // Repeat the slice end check from ff_h263_decode_mb with our active493 // Repeat the slice end check from ff_h263_decode_mb with our active
494 // bitstream size494 // bitstream size
libavcodec/wmv2dec.c+3−3
@@ -442,7 +442,7 @@ static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, · 441 unmodified lines
442 }442 }
443}443}
444 444
445static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64])445static int wmv2_decode_mb(H263DecContext *const h)
446{446{
447 /* The following is only allowed because this decoder447 /* The following is only allowed because this decoder
448 * does not use slice threading. */448 * does not use slice threading. */
@@ -522,7 +522,7 @@ static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 73 unmodified lines
522 h->c.mv[0][0][1] = my;522 h->c.mv[0][0][1] = my;
523 523
524 for (i = 0; i < 6; i++) {524 for (i = 0; i < 6; i++) {
525 if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {525 if ((ret = wmv2_decode_inter_block(w, h->c.block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
526 av_log(h->c.avctx, AV_LOG_ERROR,526 av_log(h->c.avctx, AV_LOG_ERROR,
527 "\nerror while decoding inter block: %d x %d (%d)\n",527 "\nerror while decoding inter block: %d x %d (%d)\n",
528 h->c.mb_x, h->c.mb_y, i);528 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]) · 20 unmodified lines
549 549
550 h->c.bdsp.clear_blocks(h->c.block[0]);550 h->c.bdsp.clear_blocks(h->c.block[0]);
551 for (i = 0; i < 6; i++) {551 for (i = 0; i < 6; i++) {
552 ret = ff_msmpeg4_decode_block(ms, block[i], i, (cbp >> (5 - i)) & 1, NULL);552 ret = ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL);
553 if (ret < 0) {553 if (ret < 0) {
554 av_log(h->c.avctx, AV_LOG_ERROR,554 av_log(h->c.avctx, AV_LOG_ERROR,
555 "\nerror while decoding intra block: %d x %d (%d)\n",555 "\nerror while decoding intra block: %d x %d (%d)\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t