summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-09-27 19:47:17 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-09-27 19:47:17 +0000
commit0fa8158d3e70eccda141df1d18cff648530c0cf5 (patch)
treeb25c0e4f68211bdba5ea58f7edc8f2c601fc0b0b /libavcodec/h264.c
parent40028f8f6e214c90a15a10b3b33e83c06c4ac74f (diff)
move h264 idct to its own file and call via function pointer in DspContext
allow h264 idct to be used for lowres=1 Originally committed as revision 3524 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c46
1 files changed, 6 insertions, 40 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c8e87a1585..c36e3843f7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1323,40 +1323,6 @@ static inline int get_chroma_qp(H264Context *h, int qscale){
}
-/**
- *
- */
-static void h264_add_idct_c(uint8_t *dst, DCTELEM *block, int stride){
- int i;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
-
- block[0] += 32;
-
- for(i=0; i<4; i++){
- const int z0= block[0 + 4*i] + block[2 + 4*i];
- const int z1= block[0 + 4*i] - block[2 + 4*i];
- const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i];
- const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1);
-
- block[0 + 4*i]= z0 + z3;
- block[1 + 4*i]= z1 + z2;
- block[2 + 4*i]= z1 - z2;
- block[3 + 4*i]= z0 - z3;
- }
-
- for(i=0; i<4; i++){
- const int z0= block[i + 4*0] + block[i + 4*2];
- const int z1= block[i + 4*0] - block[i + 4*2];
- const int z2= (block[i + 4*1]>>1) - block[i + 4*3];
- const int z3= block[i + 4*1] + (block[i + 4*3]>>1);
-
- dst[i + 0*stride]= cm[ dst[i + 0*stride] + ((z0 + z3) >> 6) ];
- dst[i + 1*stride]= cm[ dst[i + 1*stride] + ((z1 + z2) >> 6) ];
- dst[i + 2*stride]= cm[ dst[i + 2*stride] + ((z1 - z2) >> 6) ];
- dst[i + 3*stride]= cm[ dst[i + 3*stride] + ((z0 - z3) >> 6) ];
- }
-}
-
#if 0
static void h264_diff_dct_c(DCTELEM *block, uint8_t *src1, uint8_t *src2, int stride){
int i;
@@ -2440,7 +2406,7 @@ static void hl_decode_mb(H264Context *h){
h->pred4x4[ dir ](ptr, topright, linesize);
if(h->non_zero_count_cache[ scan8[i] ]){
if(s->codec_id == CODEC_ID_H264)
- h264_add_idct_c(ptr, h->mb + i*16, linesize);
+ s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize);
else
svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);
}
@@ -2467,7 +2433,7 @@ static void hl_decode_mb(H264Context *h){
for(i=0; i<16; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below
uint8_t * const ptr= dest_y + h->block_offset[i];
- h264_add_idct_c(ptr, h->mb + i*16, linesize);
+ s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize);
}
}
}else{
@@ -2487,13 +2453,13 @@ static void hl_decode_mb(H264Context *h){
for(i=16; i<16+4; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
uint8_t * const ptr= dest_cb + h->block_offset[i];
- h264_add_idct_c(ptr, h->mb + i*16, uvlinesize);
+ s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize);
}
}
for(i=20; i<20+4; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
uint8_t * const ptr= dest_cr + h->block_offset[i];
- h264_add_idct_c(ptr, h->mb + i*16, uvlinesize);
+ s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize);
}
}
}else{
@@ -3232,7 +3198,7 @@ static inline int get_level_prefix(GetBitContext *gb){
log= 32 - av_log2(buf);
#ifdef TRACE
print_bin(buf>>(32-log), log);
- printf("%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf>>(32-log), log, log-1, get_bits_count(gb), __FILE__);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf>>(32-log), log, log-1, get_bits_count(gb), __FILE__);
#endif
LAST_SKIP_BITS(re, gb, log);
@@ -5975,7 +5941,7 @@ int main(){
}
// printf("\n");
- h264_add_idct_c(ref, block, 4);
+ s->dsp.h264_idct_add(ref, block, 4);
/* for(j=0; j<16; j++){
printf("%d ", ref[j]);
}