X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsimple_idct.c;h=5812a877058822399263d8e417d5aa85ad8d8e73;hb=c318626ce248e55df032146b16e8e0f4ed1d99fb;hp=c6cd9080df90175a801c18fd0d03fdd98a647383;hpb=92fb52d9060a146f31da6f07ea9ce7867294e153;p=ffmpeg diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c index c6cd9080df9..5812a877058 100644 --- a/libavcodec/simple_idct.c +++ b/libavcodec/simple_idct.c @@ -53,7 +53,6 @@ static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = col[8*0]; a1 = col[8*2]; @@ -63,13 +62,13 @@ static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; - dest[0] = cm[(c0 + c1) >> C_SHIFT]; + dest[0] = av_clip_uint8((c0 + c1) >> C_SHIFT); dest += line_size; - dest[0] = cm[(c2 + c3) >> C_SHIFT]; + dest[0] = av_clip_uint8((c2 + c3) >> C_SHIFT); dest += line_size; - dest[0] = cm[(c2 - c3) >> C_SHIFT]; + dest[0] = av_clip_uint8((c2 - c3) >> C_SHIFT); dest += line_size; - dest[0] = cm[(c0 - c1) >> C_SHIFT]; + dest[0] = av_clip_uint8((c0 - c1) >> C_SHIFT); } #define BF(k) \ @@ -108,7 +107,7 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block) /* IDCT8 on each line */ for(i=0; i<8; i++) { - idctRowCondDC_8(block + i*8); + idctRowCondDC_8(block + i*8, 0); } /* IDCT4 and store */ @@ -133,7 +132,6 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block) static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = col[8*0]; a1 = col[8*1]; @@ -143,13 +141,13 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; - dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)]; + dest[0] = av_clip_uint8(dest[0] + ((c0 + c1) >> C_SHIFT)); dest += line_size; - dest[0] = cm[dest[0] + ((c2 + c3) >> C_SHIFT)]; + dest[0] = av_clip_uint8(dest[0] + ((c2 + c3) >> C_SHIFT)); dest += line_size; - dest[0] = cm[dest[0] + ((c2 - c3) >> C_SHIFT)]; + dest[0] = av_clip_uint8(dest[0] + ((c2 - c3) >> C_SHIFT)); dest += line_size; - dest[0] = cm[dest[0] + ((c0 - c1) >> C_SHIFT)]; + dest[0] = av_clip_uint8(dest[0] + ((c0 - c1) >> C_SHIFT)); } #define RN_SHIFT 15 @@ -161,7 +159,6 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; - //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = row[0]; a1 = row[1]; @@ -183,7 +180,7 @@ void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block) /* IDCT8 on each line */ for(i=0; i<4; i++) { - idctRowCondDC_8(block + i*8); + idctRowCondDC_8(block + i*8, 0); } /* IDCT4 and store */ @@ -230,10 +227,7 @@ void ff_prores_idct(DCTELEM *block, const int16_t *qmat) block[i] *= qmat[i]; for (i = 0; i < 8; i++) - idctRowCondDC_10(block + i*8); - - for (i = 0; i < 64; i++) - block[i] >>= 2; + idctRowCondDC_10(block + i*8, 2); for (i = 0; i < 8; i++) idctSparseCol_10(block + i);