2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-09-15 14:34:12 +02:00
|
|
|
#include "vpx_config.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
#include "dequantize.h"
|
2011-02-10 20:41:38 +01:00
|
|
|
#include "vp8/common/idct.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
#include "vpx_mem/vpx_mem.h"
|
|
|
|
|
|
|
|
extern void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) ;
|
|
|
|
extern void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch);
|
|
|
|
|
|
|
|
|
|
|
|
void vp8_dequantize_b_c(BLOCKD *d)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
short *DQ = d->dqcoeff;
|
|
|
|
short *Q = d->qcoeff;
|
2010-10-22 02:04:30 +02:00
|
|
|
short *DQC = d->dequant;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
|
|
|
DQ[i] = Q[i] * DQC[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *pred,
|
|
|
|
unsigned char *dest, int pitch, int stride)
|
2010-05-18 17:58:33 +02:00
|
|
|
{
|
2010-07-23 19:42:30 +02:00
|
|
|
short output[16];
|
2010-05-28 20:28:12 +02:00
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
2010-05-18 17:58:33 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/* the idct halves ( >> 1) the pitch */
|
2010-07-23 19:42:30 +02:00
|
|
|
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
vpx_memset(input, 0, 32);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dest[c] = (unsigned char) a;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest += stride;
|
2010-07-23 19:42:30 +02:00
|
|
|
diff_ptr += 4;
|
2010-05-28 20:28:12 +02:00
|
|
|
pred += pitch;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
void vp8_dequant_dc_idct_add_c(short *input, short *dq, unsigned char *pred,
|
|
|
|
unsigned char *dest, int pitch, int stride,
|
|
|
|
int Dc)
|
2010-05-18 17:58:33 +02:00
|
|
|
{
|
|
|
|
int i;
|
2010-07-23 19:42:30 +02:00
|
|
|
short output[16];
|
2010-05-28 20:28:12 +02:00
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
|
|
|
input[0] = (short)Dc;
|
|
|
|
|
|
|
|
for (i = 1; i < 16; i++)
|
|
|
|
{
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/* the idct halves ( >> 1) the pitch */
|
2010-07-23 19:42:30 +02:00
|
|
|
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
vpx_memset(input, 0, 32);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dest[c] = (unsigned char) a;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest += stride;
|
2010-07-23 19:42:30 +02:00
|
|
|
diff_ptr += 4;
|
2010-05-28 20:28:12 +02:00
|
|
|
pred += pitch;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|