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

Showing the changes to libavcodec (7 of 7 files). Show all

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
256256 get_bits_count(&h->c.gb), show_bits(&h->c.gb, 24));
257257
258258 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);
260260
261261 if (h->c.h263_pred || h->c.h263_aic) {
262262 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
4646 typedef struct H263DecContext {
4747 MPVContext c;
4848
49− int (*decode_mb)(struct H263DecContext *h, int16_t block[6][64]);
49+ int (*decode_mb)(struct H263DecContext *h);
5050 } H263DecContext;
5151
5252 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); · 11 unmodified lines
6464 void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus);
6565
6666 int ff_intel_h263_decode_picture_header(H263DecContext *const h);
67−int ff_h263_decode_mb(H263DecContext *const h,
68− int16_t block[6][64]);
67+int ff_h263_decode_mb(H263DecContext *const h);
6968
7069 int ff_h263_resync(H263DecContext *const h);
7170
libavcodec/ituh263dec.c+4−4
@@ -776,7 +776,7 @@ static int set_direct_mv(MpegEncContext *s) · 775 unmodified lines
776776 }
777777 }
778778
779−int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64])
779+int ff_h263_decode_mb(H263DecContext *const h)
780780 {
781781 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
782782 int16_t *mot_val;
@@ -947,7 +947,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 164 unmodified lines
947947 //FIXME UMV
948948
949949 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);
951951 h->c.mv_dir = MV_DIR_FORWARD;
952952
953953 if (h->c.umvplus)
@@ -974,7 +974,7 @@ int ff_h263_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 20 unmodified lines
974974 }
975975
976976 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);
978978 h->c.mv_dir |= MV_DIR_BACKWARD;
979979
980980 if (h->c.umvplus)
@@ -1051,7 +1051,7 @@ intra: · 70 unmodified lines
10511051
10521052 /* decode each block */
10531053 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)
10551055 return -1;
10561056 cbp+=cbp;
10571057 }
libavcodec/mpeg4videodec.c+6−6
@@ -1651,7 +1651,7 @@ not_coded: · 1650 unmodified lines
16511651 * decode partition C of one MB.
16521652 * @return <0 if an error occurred
16531653 */
1654−static int mpeg4_decode_partitioned_mb(H263DecContext *const h, int16_t block[6][64])
1654+static int mpeg4_decode_partitioned_mb(H263DecContext *const h)
16551655 {
16561656 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
16571657 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
17111711 h->c.bdsp.clear_blocks(h->c.block[0]);
17121712 /* decode each block */
17131713 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,
17151715 use_intra_dc_vlc, ctx->rvlc) < 0) {
17161716 av_log(h->c.avctx, AV_LOG_ERROR,
17171717 "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
17381738 }
17391739 }
17401740
1741−static int mpeg4_decode_mb(H263DecContext *const h, int16_t block[6][64])
1741+static int mpeg4_decode_mb(H263DecContext *const h)
17421742 {
17431743 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
17441744 int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
@@ -2076,7 +2076,7 @@ intra: · 331 unmodified lines
20762076 h->c.bdsp.clear_blocks(h->c.block[0]);
20772077 /* decode each block */
20782078 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,
20802080 1, use_intra_dc_vlc, 0) < 0)
20812081 return AVERROR_INVALIDDATA;
20822082 cbp += cbp;
@@ -2086,7 +2086,7 @@ intra: · 3 unmodified lines
20862086
20872087 /* decode each block */
20882088 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)
20902090 return AVERROR_INVALIDDATA;
20912091 cbp += cbp;
20922092 }
@@ -2353,7 +2353,7 @@ static int mpeg4_decode_dpcm_macroblock(Mpeg4DecContext *const ctx, · 260 unmodified lines
23532353 return 0;
23542354 }
23552355
2356−static int mpeg4_decode_studio_mb(H263DecContext *const h, int16_t block_[12][64])
2356+static int mpeg4_decode_studio_mb(H263DecContext *const h)
23572357 {
23582358 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
23592359 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
106106 return val;
107107 }
108108
109−static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64])
109+static int msmpeg4v12_decode_mb(H263DecContext *const h)
110110 {
111111 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
112112 int cbp, code, i;
@@ -203,7 +203,7 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 90 unmodified lines
203203
204204 h->c.bdsp.clear_blocks(h->c.block[0]);
205205 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)
207207 {
208208 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
209209 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
213213 return 0;
214214 }
215215
216−static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64])
216+static int msmpeg4v34_decode_mb(H263DecContext *const h)
217217 {
218218 MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
219219 int cbp, code, i;
@@ -294,7 +294,7 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h, int16_t block[6][64]) · 74 unmodified lines
294294
295295 h->c.bdsp.clear_blocks(h->c.block[0]);
296296 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)
298298 {
299299 av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n",
300300 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
488488
489489 h->c.mv_dir = MV_DIR_FORWARD;
490490 h->c.mv_type = MV_TYPE_16X16;
491− ret = ff_h263_decode_mb(h, h->c.block);
491+ ret = ff_h263_decode_mb(h);
492492
493493 // Repeat the slice end check from ff_h263_decode_mb with our active
494494 // 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
442442 }
443443 }
444444
445−static int wmv2_decode_mb(H263DecContext *const h, int16_t block[6][64])
445+static int wmv2_decode_mb(H263DecContext *const h)
446446 {
447447 /* The following is only allowed because this decoder
448448 * 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
522522 h->c.mv[0][0][1] = my;
523523
524524 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) {
526526 av_log(h->c.avctx, AV_LOG_ERROR,
527527 "\nerror while decoding inter block: %d x %d (%d)\n",
528528 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
549549
550550 h->c.bdsp.clear_blocks(h->c.block[0]);
551551 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);
553553 if (ret < 0) {
554554 av_log(h->c.avctx, AV_LOG_ERROR,
555555 "\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