Commit 8fbd4f51 authored by Måns Rullgård's avatar Måns Rullgård

Improve some uses of ff_cropTbl with constant offset

Originally committed as revision 23728 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 25d34458
...@@ -25,14 +25,14 @@ ...@@ -25,14 +25,14 @@
/* Intra iDCT offset 128 */ /* Intra iDCT offset 128 */
void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block) void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
{ {
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + 128;
int i,j; int i,j;
ff_bfin_vp3_idct (block); ff_bfin_vp3_idct (block);
for (i=0;i<8;i++) for (i=0;i<8;i++)
for (j=0;j<8;j++) for (j=0;j<8;j++)
dest[line_size*i+j]=cm[128+block[i*8+j]]; dest[line_size*i+j]=cm[block[i*8+j]];
} }
/* Inter iDCT */ /* Inter iDCT */
......
...@@ -143,24 +143,24 @@ void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){ ...@@ -143,24 +143,24 @@ void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){
// assumes all AC coefs are 0 // assumes all AC coefs are 0
void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){ void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
int i, j; int i, j;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int dc = (block[0] + 32) >> 6; int dc = (block[0] + 32) >> 6;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + dc;
for( j = 0; j < 4; j++ ) for( j = 0; j < 4; j++ )
{ {
for( i = 0; i < 4; i++ ) for( i = 0; i < 4; i++ )
dst[i] = cm[ dst[i] + dc ]; dst[i] = cm[ dst[i] ];
dst += stride; dst += stride;
} }
} }
void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){ void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
int i, j; int i, j;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int dc = (block[0] + 32) >> 6; int dc = (block[0] + 32) >> 6;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + dc;
for( j = 0; j < 8; j++ ) for( j = 0; j < 8; j++ )
{ {
for( i = 0; i < 8; i++ ) for( i = 0; i < 8; i++ )
dst[i] = cm[ dst[i] + dc ]; dst[i] = cm[ dst[i] ];
dst += stride; dst += stride;
} }
} }
......
...@@ -182,18 +182,19 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) ...@@ -182,18 +182,19 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
{ {
int i; int i;
int dc = block[0]; int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t *cm;
dc = (3 * dc + 1) >> 1; dc = (3 * dc + 1) >> 1;
dc = (3 * dc + 16) >> 5; dc = (3 * dc + 16) >> 5;
cm = ff_cropTbl + MAX_NEG_CROP + dc;
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
dest[0] = cm[dest[0]+dc]; dest[0] = cm[dest[0]];
dest[1] = cm[dest[1]+dc]; dest[1] = cm[dest[1]];
dest[2] = cm[dest[2]+dc]; dest[2] = cm[dest[2]];
dest[3] = cm[dest[3]+dc]; dest[3] = cm[dest[3]];
dest[4] = cm[dest[4]+dc]; dest[4] = cm[dest[4]];
dest[5] = cm[dest[5]+dc]; dest[5] = cm[dest[5]];
dest[6] = cm[dest[6]+dc]; dest[6] = cm[dest[6]];
dest[7] = cm[dest[7]+dc]; dest[7] = cm[dest[7]];
dest += linesize; dest += linesize;
} }
} }
...@@ -273,18 +274,19 @@ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) ...@@ -273,18 +274,19 @@ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
{ {
int i; int i;
int dc = block[0]; int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t *cm;
dc = ( 3 * dc + 1) >> 1; dc = ( 3 * dc + 1) >> 1;
dc = (17 * dc + 64) >> 7; dc = (17 * dc + 64) >> 7;
cm = ff_cropTbl + MAX_NEG_CROP + dc;
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
dest[0] = cm[dest[0]+dc]; dest[0] = cm[dest[0]];
dest[1] = cm[dest[1]+dc]; dest[1] = cm[dest[1]];
dest[2] = cm[dest[2]+dc]; dest[2] = cm[dest[2]];
dest[3] = cm[dest[3]+dc]; dest[3] = cm[dest[3]];
dest[4] = cm[dest[4]+dc]; dest[4] = cm[dest[4]];
dest[5] = cm[dest[5]+dc]; dest[5] = cm[dest[5]];
dest[6] = cm[dest[6]+dc]; dest[6] = cm[dest[6]];
dest[7] = cm[dest[7]+dc]; dest[7] = cm[dest[7]];
dest += linesize; dest += linesize;
} }
} }
...@@ -350,14 +352,15 @@ static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) ...@@ -350,14 +352,15 @@ static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
{ {
int i; int i;
int dc = block[0]; int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t *cm;
dc = (17 * dc + 4) >> 3; dc = (17 * dc + 4) >> 3;
dc = (12 * dc + 64) >> 7; dc = (12 * dc + 64) >> 7;
cm = ff_cropTbl + MAX_NEG_CROP + dc;
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
dest[0] = cm[dest[0]+dc]; dest[0] = cm[dest[0]];
dest[1] = cm[dest[1]+dc]; dest[1] = cm[dest[1]];
dest[2] = cm[dest[2]+dc]; dest[2] = cm[dest[2]];
dest[3] = cm[dest[3]+dc]; dest[3] = cm[dest[3]];
dest += linesize; dest += linesize;
} }
} }
...@@ -423,14 +426,15 @@ static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) ...@@ -423,14 +426,15 @@ static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
{ {
int i; int i;
int dc = block[0]; int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t *cm;
dc = (17 * dc + 4) >> 3; dc = (17 * dc + 4) >> 3;
dc = (17 * dc + 64) >> 7; dc = (17 * dc + 64) >> 7;
cm = ff_cropTbl + MAX_NEG_CROP + dc;
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
dest[0] = cm[dest[0]+dc]; dest[0] = cm[dest[0]];
dest[1] = cm[dest[1]+dc]; dest[1] = cm[dest[1]];
dest[2] = cm[dest[2]+dc]; dest[2] = cm[dest[2]];
dest[3] = cm[dest[3]+dc]; dest[3] = cm[dest[3]];
dest += linesize; dest += linesize;
} }
} }
......
...@@ -224,18 +224,18 @@ void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/* ...@@ -224,18 +224,18 @@ void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
} }
void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/){ void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/){
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i, dc = (block[0] + 15) >> 5; int i, dc = (block[0] + 15) >> 5;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + dc;
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
dest[0] = cm[dest[0]+dc]; dest[0] = cm[dest[0]];
dest[1] = cm[dest[1]+dc]; dest[1] = cm[dest[1]];
dest[2] = cm[dest[2]+dc]; dest[2] = cm[dest[2]];
dest[3] = cm[dest[3]+dc]; dest[3] = cm[dest[3]];
dest[4] = cm[dest[4]+dc]; dest[4] = cm[dest[4]];
dest[5] = cm[dest[5]+dc]; dest[5] = cm[dest[5]];
dest[6] = cm[dest[6]+dc]; dest[6] = cm[dest[6]];
dest[7] = cm[dest[7]+dc]; dest[7] = cm[dest[7]];
dest += line_size; dest += line_size;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment