Index: source/libvpx/vp9/decoder/vp9_dequantize.c |
=================================================================== |
--- source/libvpx/vp9/decoder/vp9_dequantize.c (revision 177019) |
+++ source/libvpx/vp9/decoder/vp9_dequantize.c (working copy) |
@@ -13,20 +13,14 @@ |
#include "vp9/decoder/vp9_dequantize.h" |
#include "vpx_mem/vpx_mem.h" |
#include "vp9/decoder/vp9_onyxd_int.h" |
+#include "vp9/common/vp9_common.h" |
static void add_residual(const int16_t *diff, const uint8_t *pred, int pitch, |
uint8_t *dest, int stride, int width, int height) { |
int r, c; |
for (r = 0; r < height; r++) { |
for (c = 0; c < width; c++) { |
- int a = diff[c] + pred[c]; |
- |
- if (a < 0) |
- a = 0; |
- else if (a > 255) |
- a = 255; |
- |
- dest[c] = (uint8_t) a; |
+ dest[c] = clip_pixel(diff[c] + pred[c]); |
} |
dest += stride; |
@@ -42,14 +36,7 @@ |
for (r = 0; r < height; r++) { |
for (c = 0; c < width; c++) { |
- int a = diff + pred[c]; |
- |
- if (a < 0) |
- a = 0; |
- else if (a > 255) |
- a = 255; |
- |
- dest[c] = (uint8_t) a; |
+ dest[c] = clip_pixel(diff + pred[c]); |
} |
dest += stride; |
@@ -204,7 +191,7 @@ |
void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq, |
uint8_t *pred, uint8_t *dest, int pitch, |
- int stride, int dc, uint16_t eobs) { |
+ int stride, int dc, int eob) { |
int16_t output[64]; |
int16_t *diff_ptr = output; |
int i; |
@@ -220,10 +207,10 @@ |
* TODO(yunqingwang): "eobs = 1" case is also handled in vp9_short_idct8x8_c. |
* Combine that with code here. |
*/ |
- if (eobs == 0) { |
+ if (eob == 0) { |
/* All 0 DCT coefficient */ |
vp9_copy_mem8x8(pred, pitch, dest, stride); |
- } else if (eobs == 1) { |
+ } else if (eob == 1) { |
/* DC only DCT coefficient. */ |
int16_t out; |
@@ -236,7 +223,7 @@ |
input[0] = 0; |
add_constant_residual(out, pred, pitch, dest, stride, 8, 8); |
- } else if (eobs <= 10) { |
+ } else if (eob <= 10) { |
input[1] = input[1] * dq[1]; |
input[2] = input[2] * dq[1]; |
input[3] = input[3] * dq[1]; |
@@ -301,17 +288,17 @@ |
void vp9_dequant_idct_add_16x16_c(int16_t *input, const int16_t *dq, |
uint8_t *pred, uint8_t *dest, int pitch, |
- int stride, uint16_t eobs) { |
+ int stride, int eob) { |
int16_t output[256]; |
int16_t *diff_ptr = output; |
int i; |
/* The calculation can be simplified if there are not many non-zero dct |
* coefficients. Use eobs to separate different cases. */ |
- if (eobs == 0) { |
+ if (eob == 0) { |
/* All 0 DCT coefficient */ |
vp9_copy_mem16x16(pred, pitch, dest, stride); |
- } else if (eobs == 1) { |
+ } else if (eob == 1) { |
/* DC only DCT coefficient. */ |
int16_t out; |
@@ -324,7 +311,7 @@ |
input[0] = 0; |
add_constant_residual(out, pred, pitch, dest, stride, 16, 16); |
- } else if (eobs <= 10) { |
+ } else if (eob <= 10) { |
input[0]= input[0] * dq[0]; |
input[1] = input[1] * dq[1]; |
input[2] = input[2] * dq[1]; |
@@ -360,3 +347,28 @@ |
add_residual(diff_ptr, pred, pitch, dest, stride, 16, 16); |
} |
} |
+ |
+void vp9_dequant_idct_add_32x32_c(int16_t *input, const int16_t *dq, |
+ uint8_t *pred, uint8_t *dest, int pitch, |
+ int stride, int eob) { |
+ int16_t output[1024]; |
+ int i; |
+ |
+ input[0]= input[0] * dq[0] / 2; |
+ for (i = 1; i < 1024; i++) |
+ input[i] = input[i] * dq[1] / 2; |
+ vp9_short_idct32x32_c(input, output, 64); |
+ vpx_memset(input, 0, 2048); |
+ |
+ add_residual(output, pred, pitch, dest, stride, 32, 32); |
+} |
+ |
+void vp9_dequant_idct_add_uv_block_16x16_c(int16_t *q, const int16_t *dq, |
+ uint8_t *dstu, |
+ uint8_t *dstv, |
+ int stride, |
+ uint16_t *eobs) { |
+ vp9_dequant_idct_add_16x16_c(q, dq, dstu, dstu, stride, stride, eobs[0]); |
+ vp9_dequant_idct_add_16x16_c(q + 256, dq, |
+ dstv, dstv, stride, stride, eobs[4]); |
+} |