aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rv34dsp.c
diff options
context:
space:
mode:
authorChristophe GISQUET <christophe.gisquet@gmail.com>2012-01-03 20:38:29 +0100
committerJanne Grunau <janne-libav@jannau.net>2012-01-16 19:26:41 +0100
commit9ba9c3402499d90e54f8aa111b62c278206d11af (patch)
treeac059d08bf032cfbf7454c02e72bd5175a2e5b70 /libavcodec/rv34dsp.c
parentffa0923eee7707acf07a0847b6bac89b86e227dc (diff)
downloadffmpeg-9ba9c3402499d90e54f8aa111b62c278206d11af.tar.gz
rv34: 1-pass inter MB reconstruction
Implement 1-pass inverse transform and reconstruction for inter blocks.
Diffstat (limited to 'libavcodec/rv34dsp.c')
-rw-r--r--libavcodec/rv34dsp.c62
1 files changed, 14 insertions, 48 deletions
diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c
index 91c455a024..e2251773af 100644
--- a/libavcodec/rv34dsp.c
+++ b/libavcodec/rv34dsp.c
@@ -32,15 +32,15 @@
* @{
*/
-static av_always_inline void rv34_row_transform(int temp[16], const DCTELEM *block)
+static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
{
int i;
for(i = 0; i < 4; i++){
- const int z0 = 13*(block[i+8*0] + block[i+8*2]);
- const int z1 = 13*(block[i+8*0] - block[i+8*2]);
- const int z2 = 7* block[i+8*1] - 17*block[i+8*3];
- const int z3 = 17* block[i+8*1] + 7*block[i+8*3];
+ const int z0 = 13*(block[i+4*0] + block[i+4*2]);
+ const int z1 = 13*(block[i+4*0] - block[i+4*2]);
+ const int z2 = 7* block[i+4*1] - 17*block[i+4*3];
+ const int z3 = 17* block[i+4*1] + 7*block[i+4*3];
temp[4*i+0] = z0 + z3;
temp[4*i+1] = z1 + z2;
@@ -50,38 +50,16 @@ static av_always_inline void rv34_row_transform(int temp[16], const DCTELEM *blo
}
/**
- * Real Video 3.0/4.0 inverse transform
- * Code is almost the same as in SVQ3, only scaling is different.
- */
-static void rv34_inv_transform_c(DCTELEM *block){
- int temp[16];
- int i;
-
- rv34_row_transform(temp, block);
-
- for(i = 0; i < 4; i++){
- const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200;
- const int z1 = 13*(temp[4*0+i] - temp[4*2+i]) + 0x200;
- const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
- const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
-
- block[i*8+0] = (z0 + z3) >> 10;
- block[i*8+1] = (z1 + z2) >> 10;
- block[i*8+2] = (z1 - z2) >> 10;
- block[i*8+3] = (z0 - z3) >> 10;
- }
-}
-
-/**
* Real Video 3.0/4.0 inverse transform + sample reconstruction
* Code is almost the same as in SVQ3, only scaling is different.
*/
-static void rv34_idct_add_c(uint8_t *dst, int stride, const DCTELEM *block){
+static void rv34_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
int temp[16];
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i;
rv34_row_transform(temp, block);
+ memset(block, 0, 16*sizeof(DCTELEM));
for(i = 0; i < 4; i++){
const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200;
@@ -116,10 +94,10 @@ static void rv34_inv_transform_noround_c(DCTELEM *block){
const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
- block[i*8+0] = ((z0 + z3) * 3) >> 11;
- block[i*8+1] = ((z1 + z2) * 3) >> 11;
- block[i*8+2] = ((z1 - z2) * 3) >> 11;
- block[i*8+3] = ((z0 - z3) * 3) >> 11;
+ block[i*4+0] = ((z0 + z3) * 3) >> 11;
+ block[i*4+1] = ((z1 + z2) * 3) >> 11;
+ block[i*4+2] = ((z1 - z2) * 3) >> 11;
+ block[i*4+3] = ((z0 - z3) * 3) >> 11;
}
}
@@ -139,22 +117,12 @@ static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc)
}
}
-static void rv34_inv_transform_dc_c(DCTELEM *block)
-{
- DCTELEM dc = (13 * 13 * block[0] + 0x200) >> 10;
- int i, j;
-
- for (i = 0; i < 4; i++, block += 8)
- for (j = 0; j < 4; j++)
- block[j] = dc;
-}
-
static void rv34_inv_transform_dc_noround_c(DCTELEM *block)
{
DCTELEM dc = (13 * 13 * 3 * block[0]) >> 11;
int i, j;
- for (i = 0; i < 4; i++, block += 8)
+ for (i = 0; i < 4; i++, block += 4)
for (j = 0; j < 4; j++)
block[j] = dc;
}
@@ -163,10 +131,8 @@ static void rv34_inv_transform_dc_noround_c(DCTELEM *block)
av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) {
- c->rv34_inv_transform_tab[0] = rv34_inv_transform_c;
- c->rv34_inv_transform_tab[1] = rv34_inv_transform_noround_c;
- c->rv34_inv_transform_dc_tab[0] = rv34_inv_transform_dc_c;
- c->rv34_inv_transform_dc_tab[1] = rv34_inv_transform_dc_noround_c;
+ c->rv34_inv_transform = rv34_inv_transform_noround_c;
+ c->rv34_inv_transform_dc = rv34_inv_transform_dc_noround_c;
c->rv34_idct_add = rv34_idct_add_c;
c->rv34_idct_dc_add = rv34_idct_dc_add_c;