[FFmpeg-cvslog] Remove h264_lowres_idct_put/add functions
Mans Rullgard
git at videolan.org
Wed Jul 20 18:35:36 CEST 2011
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Wed Jul 20 09:46:18 2011 +0100| [7b4ee3a21d7c7419b485bf7af3b2795b9c3e89ea] | committer: Mans Rullgard
Remove h264_lowres_idct_put/add functions
Use of these has been broken ever since the h264 idct was changed
to always use transposed inputs. Furthermore, they were only
ever used if some *other* non-default idct was requested.
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b4ee3a21d7c7419b485bf7af3b2795b9c3e89ea
---
libavcodec/dsputil.c | 25 +----------------
libavcodec/dsputil.h | 2 -
libavcodec/h264idct_template.c | 57 ++++++++++++++++-----------------------
3 files changed, 25 insertions(+), 59 deletions(-)
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index a3e8d6c..e2cf708 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2863,29 +2863,8 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#endif //CONFIG_ENCODERS
if(avctx->lowres==1){
- if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
- c->idct_put= ff_jref_idct4_put;
- c->idct_add= ff_jref_idct4_add;
- }else{
- if (avctx->codec_id != CODEC_ID_H264) {
- c->idct_put= ff_h264_lowres_idct_put_8_c;
- c->idct_add= ff_h264_lowres_idct_add_8_c;
- } else {
- switch (avctx->bits_per_raw_sample) {
- case 9:
- c->idct_put= ff_h264_lowres_idct_put_9_c;
- c->idct_add= ff_h264_lowres_idct_add_9_c;
- break;
- case 10:
- c->idct_put= ff_h264_lowres_idct_put_10_c;
- c->idct_add= ff_h264_lowres_idct_add_10_c;
- break;
- default:
- c->idct_put= ff_h264_lowres_idct_put_8_c;
- c->idct_add= ff_h264_lowres_idct_add_8_c;
- }
- }
- }
+ c->idct_put= ff_jref_idct4_put;
+ c->idct_add= ff_jref_idct4_add;
c->idct = j_rev_dct4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==2){
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 5a97b44..8cd3af6 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -58,8 +58,6 @@ void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride)
void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
-void ff_h264_lowres_idct_add_ ## depth ## _c(uint8_t *dst, int stride, DCTELEM *block);\
-void ff_h264_lowres_idct_put_ ## depth ## _c(uint8_t *dst, int stride, DCTELEM *block);\
void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index 55c1d3a..ba55715 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -46,52 +46,41 @@ static const uint8_t scan8[16*3]={
};
#endif
-static av_always_inline void FUNCC(idct_internal)(uint8_t *_dst, DCTELEM *_block, int stride, int block_stride, int shift, int add){
+void FUNCC(ff_h264_idct_add)(uint8_t *_dst, DCTELEM *_block, int stride)
+{
int i;
INIT_CLIP
pixel *dst = (pixel*)_dst;
dctcoef *block = (dctcoef*)_block;
stride /= sizeof(pixel);
- block[0] += 1<<(shift-1);
+ block[0] += 1 << 5;
for(i=0; i<4; i++){
- const int z0= block[i + block_stride*0] + block[i + block_stride*2];
- const int z1= block[i + block_stride*0] - block[i + block_stride*2];
- const int z2= (block[i + block_stride*1]>>1) - block[i + block_stride*3];
- const int z3= block[i + block_stride*1] + (block[i + block_stride*3]>>1);
-
- block[i + block_stride*0]= z0 + z3;
- block[i + block_stride*1]= z1 + z2;
- block[i + block_stride*2]= z1 - z2;
- block[i + block_stride*3]= z0 - z3;
+ 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);
+
+ block[i + 4*0]= z0 + z3;
+ block[i + 4*1]= z1 + z2;
+ block[i + 4*2]= z1 - z2;
+ block[i + 4*3]= z0 - z3;
}
for(i=0; i<4; i++){
- const int z0= block[0 + block_stride*i] + block[2 + block_stride*i];
- const int z1= block[0 + block_stride*i] - block[2 + block_stride*i];
- const int z2= (block[1 + block_stride*i]>>1) - block[3 + block_stride*i];
- const int z3= block[1 + block_stride*i] + (block[3 + block_stride*i]>>1);
-
- dst[i + 0*stride]= CLIP(add*dst[i + 0*stride] + ((z0 + z3) >> shift));
- dst[i + 1*stride]= CLIP(add*dst[i + 1*stride] + ((z1 + z2) >> shift));
- dst[i + 2*stride]= CLIP(add*dst[i + 2*stride] + ((z1 - z2) >> shift));
- dst[i + 3*stride]= CLIP(add*dst[i + 3*stride] + ((z0 - z3) >> shift));
+ 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);
+
+ dst[i + 0*stride]= CLIP(dst[i + 0*stride] + ((z0 + z3) >> 6));
+ dst[i + 1*stride]= CLIP(dst[i + 1*stride] + ((z1 + z2) >> 6));
+ dst[i + 2*stride]= CLIP(dst[i + 2*stride] + ((z1 - z2) >> 6));
+ dst[i + 3*stride]= CLIP(dst[i + 3*stride] + ((z0 - z3) >> 6));
}
}
-void FUNCC(ff_h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride){
- FUNCC(idct_internal)(dst, block, stride, 4, 6, 1);
-}
-
-void FUNCC(ff_h264_lowres_idct_add)(uint8_t *dst, int stride, DCTELEM *block){
- FUNCC(idct_internal)(dst, block, stride, 8, 3, 1);
-}
-
-void FUNCC(ff_h264_lowres_idct_put)(uint8_t *dst, int stride, DCTELEM *block){
- FUNCC(idct_internal)(dst, block, stride, 8, 3, 0);
-}
-
void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){
int i;
INIT_CLIP
@@ -200,7 +189,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *b
int nnz = nnzc[ scan8[i] ];
if(nnz){
if(nnz==1 && ((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
- else FUNCC(idct_internal )(dst + block_offset[i], block + i*16*sizeof(pixel), stride, 4, 6, 1);
+ else FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
}
}
}
@@ -208,7 +197,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *b
void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){
int i;
for(i=0; i<16; i++){
- if(nnzc[ scan8[i] ]) FUNCC(idct_internal )(dst + block_offset[i], block + i*16*sizeof(pixel), stride, 4, 6, 1);
+ if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
else if(((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
}
}
More information about the ffmpeg-cvslog
mailing list