[FFmpeg-cvslog] commit: Port SVQ3 to use the new mb_luma_dc method of storing luma DC coefficients . (Jason Garrett-Glaser )
git at videolan.org
git
Sat Jan 15 13:06:36 CET 2011
ffmpeg | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Jan 15 00:41:18 2011 +0000| [290fabc684244b86d47527008020b0b2eb62f836] | committer: Jason Garrett-Glaser
Port SVQ3 to use the new mb_luma_dc method of storing luma DC coefficients.
Doesn't help speed as there isn't an asm implementation yet, but consistency
is a good thing.
Originally committed as revision 26348 to svn://svn.ffmpeg.org/ffmpeg/trunk
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=290fabc684244b86d47527008020b0b2eb62f836
---
libavcodec/dsputil.h | 2 +-
libavcodec/h264.c | 2 +-
libavcodec/svq3.c | 44 +++++++++++++++++++++-----------------------
3 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index e6b50e9..0efbad9 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -65,7 +65,7 @@ void ff_h264_idct8_add4_c(uint8_t *dst, const int *blockoffset, DCTELEM *block,
void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul);
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
+void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp);
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1,
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 85aa3a8..40dc276 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1215,7 +1215,7 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
}
}
}else
- ff_svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
+ ff_svq3_luma_dc_dequant_idct_c(h->mb, h->mb_luma_dc, s->qscale);
}
if(h->deblocking_filter)
xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple);
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 4a4a1c5..a527442 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -125,22 +125,18 @@ static const uint32_t svq3_dequant_coeff[32] = {
61694, 68745, 77615, 89113,100253,109366,126635,141533
};
-
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp)
-{
+void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp){
const int qmul = svq3_dequant_coeff[qp];
#define stride 16
int i;
int temp[16];
- static const int x_offset[4] = {0, 1*stride, 4* stride, 5*stride};
- static const int y_offset[4] = {0, 2*stride, 8* stride, 10*stride};
+ static const uint8_t x_offset[4]={0, 1*stride, 4*stride, 5*stride};
- for (i = 0; i < 4; i++){
- const int offset = y_offset[i];
- const int z0 = 13*(block[offset+stride*0] + block[offset+stride*4]);
- const int z1 = 13*(block[offset+stride*0] - block[offset+stride*4]);
- const int z2 = 7* block[offset+stride*1] - 17*block[offset+stride*5];
- const int z3 = 17* block[offset+stride*1] + 7*block[offset+stride*5];
+ for(i=0; i<4; i++){
+ const int z0 = 13*(input[4*i+0] + input[4*i+2]);
+ const int z1 = 13*(input[4*i+0] - input[4*i+2]);
+ const int z2 = 7* input[4*i+1] - 17*input[4*i+3];
+ const int z3 = 17* input[4*i+1] + 7*input[4*i+3];
temp[4*i+0] = z0+z3;
temp[4*i+1] = z1+z2;
@@ -148,17 +144,17 @@ void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp)
temp[4*i+3] = z0-z3;
}
- for (i = 0; i < 4; i++){
- const int offset = x_offset[i];
- const int z0 = 13*(temp[4*0+i] + temp[4*2+i]);
- const int z1 = 13*(temp[4*0+i] - temp[4*2+i]);
- 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[stride*0 +offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
- block[stride*2 +offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
- block[stride*8 +offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
- block[stride*10+offset] = ((z0 - z3)*qmul + 0x80000) >> 20;
+ for(i=0; i<4; i++){
+ const int offset= x_offset[i];
+ const int z0= 13*(temp[4*0+i] + temp[4*2+i]);
+ const int z1= 13*(temp[4*0+i] - temp[4*2+i]);
+ 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];
+
+ output[stride* 0+offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
+ output[stride* 2+offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
+ output[stride* 8+offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
+ output[stride*10+offset] = ((z0 - z3)*qmul + 0x80000) >> 20;
}
}
#undef stride
@@ -648,7 +644,9 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
}
}
if (IS_INTRA16x16(mb_type)) {
- if (svq3_decode_block(&s->gb, h->mb, 0, 0)){
+ AV_ZERO128(h->mb_luma_dc+0);
+ AV_ZERO128(h->mb_luma_dc+8);
+ if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
return -1;
}
More information about the ffmpeg-cvslog
mailing list