Advanced profile never uses "range reduction", so vc1_put_block() quite literally just calls put_pixels_clamped() from vc1_decode_i_blocks_adv(). By inlining the function, we can prevent calling IDCT8x8 if CODEC_FLAG_GRAY is set, and we don't have to scale the coeffs in the [0,256] range, but can instead use put_signed_pixels_clamped(). (cherry picked from commit 70aa916e4630bcec14439a2d703074b6d4c890a8)
Unified · Split
| @@ -2704,7 +2704,7 @@ static void vc1_decode_i_blocks(VC1Context *v) · 2703 unmodified lines | ||
| 2704 | 2704 | */ |
| 2705 | 2705 | static void vc1_decode_i_blocks_adv(VC1Context *v) |
| 2706 | 2706 | { |
| 2707 | − int k, j; | |
| 2707 | + int k; | |
| 2708 | 2708 | MpegEncContext *s = &v->s; |
| 2709 | 2709 | int cbp, val; |
| 2710 | 2710 | uint8_t *coded_val; |
| @@ -2747,7 +2747,14 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) · 36 unmodified lines | ||
| 2747 | 2747 | s->mb_x = 0; |
| 2748 | 2748 | ff_init_block_index(s); |
| 2749 | 2749 | for(;s->mb_x < s->mb_width; s->mb_x++) { |
| 2750 | + uint8_t *dst[6]; | |
| 2750 | 2751 | ff_update_block_index(s); |
| 2752 | + dst[0] = s->dest[0]; | |
| 2753 | + dst[1] = dst[0] + 8; | |
| 2754 | + dst[2] = s->dest[0] + s->linesize * 8; | |
| 2755 | + dst[3] = dst[2] + 8; | |
| 2756 | + dst[4] = s->dest[1]; | |
| 2757 | + dst[5] = s->dest[2]; | |
| 2751 | 2758 | s->dsp.clear_blocks(s->block[0]); |
| 2752 | 2759 | mb_pos = s->mb_x + s->mb_y * s->mb_stride; |
| 2753 | 2760 | s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; |
| @@ -2791,11 +2798,12 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) · 37 unmodified lines | ||
| 2791 | 2798 | |
| 2792 | 2799 | vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); |
| 2793 | 2800 | |
| 2801 | + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; | |
| 2794 | 2802 | v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); |
| 2795 | − for(j = 0; j < 64; j++) s->block[k][j] += 128; | |
| 2803 | + s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], | |
| 2804 | + k & 4 ? s->uvlinesize : s->linesize); | |
| 2796 | 2805 | } |
| 2797 | 2806 | |
| 2798 | − vc1_put_block(v, s->block); | |
| 2799 | 2807 | if(overlap) { |
| 2800 | 2808 | if(s->mb_x) { |
| 2801 | 2809 | v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); |