Mercurial > libavcodec.hg
comparison dsputil.c @ 10068:770294452eaf libavcodec
Get rid of large stack array in rd8x8_c()
author | mru |
---|---|
date | Wed, 19 Aug 2009 21:59:44 +0000 |
parents | 3141f69e3905 |
children | 06ff9b175488 |
comparison
equal
deleted
inserted
replaced
10067:685af2860d80 | 10068:770294452eaf |
---|---|
3829 | 3829 |
3830 static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ | 3830 static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |
3831 MpegEncContext * const s= (MpegEncContext *)c; | 3831 MpegEncContext * const s= (MpegEncContext *)c; |
3832 const uint8_t *scantable= s->intra_scantable.permutated; | 3832 const uint8_t *scantable= s->intra_scantable.permutated; |
3833 DECLARE_ALIGNED_8 (uint64_t, aligned_temp[sizeof(DCTELEM)*64/8]); | 3833 DECLARE_ALIGNED_8 (uint64_t, aligned_temp[sizeof(DCTELEM)*64/8]); |
3834 DECLARE_ALIGNED_8 (uint64_t, aligned_bak[stride]); | 3834 DECLARE_ALIGNED_8 (uint64_t, aligned_src1[8]); |
3835 DECLARE_ALIGNED_8 (uint64_t, aligned_src2[8]); | |
3835 DCTELEM * const temp= (DCTELEM*)aligned_temp; | 3836 DCTELEM * const temp= (DCTELEM*)aligned_temp; |
3836 uint8_t * const bak= (uint8_t*)aligned_bak; | 3837 uint8_t * const lsrc1 = (uint8_t*)aligned_src1; |
3838 uint8_t * const lsrc2 = (uint8_t*)aligned_src2; | |
3837 int i, last, run, bits, level, distortion, start_i; | 3839 int i, last, run, bits, level, distortion, start_i; |
3838 const int esc_length= s->ac_esc_length; | 3840 const int esc_length= s->ac_esc_length; |
3839 uint8_t * length; | 3841 uint8_t * length; |
3840 uint8_t * last_length; | 3842 uint8_t * last_length; |
3841 | 3843 |
3842 assert(h==8); | 3844 assert(h==8); |
3843 | 3845 |
3844 for(i=0; i<8; i++){ | 3846 copy_block8(lsrc1, src1, 8, stride, 8); |
3845 ((uint32_t*)(bak + i*stride))[0]= ((uint32_t*)(src2 + i*stride))[0]; | 3847 copy_block8(lsrc2, src2, 8, stride, 8); |
3846 ((uint32_t*)(bak + i*stride))[1]= ((uint32_t*)(src2 + i*stride))[1]; | 3848 |
3847 } | 3849 s->dsp.diff_pixels(temp, lsrc1, lsrc2, 8); |
3848 | |
3849 s->dsp.diff_pixels(temp, src1, src2, stride); | |
3850 | 3850 |
3851 s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); | 3851 s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); |
3852 | 3852 |
3853 bits=0; | 3853 bits=0; |
3854 | 3854 |
3897 s->dct_unquantize_intra(s, temp, 0, s->qscale); | 3897 s->dct_unquantize_intra(s, temp, 0, s->qscale); |
3898 else | 3898 else |
3899 s->dct_unquantize_inter(s, temp, 0, s->qscale); | 3899 s->dct_unquantize_inter(s, temp, 0, s->qscale); |
3900 } | 3900 } |
3901 | 3901 |
3902 s->dsp.idct_add(bak, stride, temp); | 3902 s->dsp.idct_add(lsrc2, 8, temp); |
3903 | 3903 |
3904 distortion= s->dsp.sse[1](NULL, bak, src1, stride, 8); | 3904 distortion= s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); |
3905 | 3905 |
3906 return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7); | 3906 return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7); |
3907 } | 3907 } |
3908 | 3908 |
3909 static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ | 3909 static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ |