summaryrefslogtreecommitdiff
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-03-14 17:50:12 +0000
committerMåns Rullgård <mans@mansr.com>2010-03-14 17:50:12 +0000
commit05aec7bb87236bf6e7c0f61fb6b20c5c922b49e2 (patch)
treee242c20f03b791662e7227de96f0cc5172583e29 /libavcodec/dsputil.c
parent28eb5773903a84c991d7f58756fdeaddaf58e46a (diff)
Separate DWT from snow and dsputil
This moves the DWT functions from snow.c and dsputil.c to a file of their own. A new struct, DWTContext, holds the function pointers previously part of DSPContext. Originally committed as revision 22522 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c112
1 files changed, 3 insertions, 109 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index cb9d38100c..8535c6d665 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -33,7 +33,6 @@
#include "faandct.h"
#include "faanidct.h"
#include "mathops.h"
-#include "snow.h"
#include "mpegvideo.h"
#include "config.h"
#include "lpc.h"
@@ -329,102 +328,6 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
return s;
}
-
-#if CONFIG_SNOW_ENCODER //dwt is in snow.c
-static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
- int s, i, j;
- const int dec_count= w==8 ? 3 : 4;
- int tmp[32*32];
- int level, ori;
- static const int scale[2][2][4][4]={
- {
- {
- // 9/7 8x8 dec=3
- {268, 239, 239, 213},
- { 0, 224, 224, 152},
- { 0, 135, 135, 110},
- },{
- // 9/7 16x16 or 32x32 dec=4
- {344, 310, 310, 280},
- { 0, 320, 320, 228},
- { 0, 175, 175, 136},
- { 0, 129, 129, 102},
- }
- },{
- {
- // 5/3 8x8 dec=3
- {275, 245, 245, 218},
- { 0, 230, 230, 156},
- { 0, 138, 138, 113},
- },{
- // 5/3 16x16 or 32x32 dec=4
- {352, 317, 317, 286},
- { 0, 328, 328, 233},
- { 0, 180, 180, 140},
- { 0, 132, 132, 105},
- }
- }
- };
-
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j+=4) {
- tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4;
- tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4;
- tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4;
- tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4;
- }
- pix1 += line_size;
- pix2 += line_size;
- }
-
- ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
-
- s=0;
- assert(w==h);
- for(level=0; level<dec_count; level++){
- for(ori= level ? 1 : 0; ori<4; ori++){
- int size= w>>(dec_count-level);
- int sx= (ori&1) ? size : 0;
- int stride= 32<<(dec_count-level);
- int sy= (ori&2) ? stride>>1 : 0;
-
- for(i=0; i<size; i++){
- for(j=0; j<size; j++){
- int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori];
- s += FFABS(v);
- }
- }
- }
- }
- assert(s>=0);
- return s>>9;
-}
-
-static int w53_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 8, h, 1);
-}
-
-static int w97_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 8, h, 0);
-}
-
-static int w53_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 16, h, 1);
-}
-
-static int w97_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 16, h, 0);
-}
-
-int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 32, h, 1);
-}
-
-int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 32, h, 0);
-}
-#endif
-
/* draw the edges of width 'w' of an image of size width, height */
//FIXME check that this is ok for mpeg4 interlaced
static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
@@ -3531,7 +3434,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
case FF_CMP_NSSE:
cmp[i]= c->nsse[i];
break;
-#if CONFIG_SNOW_ENCODER
+#if CONFIG_DWT
case FF_CMP_W53:
cmp[i]= c->w53[i];
break;
@@ -4816,11 +4719,8 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->vsse[5]= vsse_intra8_c;
c->nsse[0]= nsse16_c;
c->nsse[1]= nsse8_c;
-#if CONFIG_SNOW_ENCODER
- c->w53[0]= w53_16_c;
- c->w53[1]= w53_8_c;
- c->w97[0]= w97_16_c;
- c->w97[1]= w97_8_c;
+#if CONFIG_DWT
+ ff_dsputil_init_dwt(c);
#endif
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
@@ -4865,12 +4765,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
-#if CONFIG_SNOW_DECODER
- c->vertical_compose97i = ff_snow_vertical_compose97i;
- c->horizontal_compose97i = ff_snow_horizontal_compose97i;
- c->inner_add_yblock = ff_snow_inner_add_yblock;
-#endif
-
#if CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = vorbis_inverse_coupling;
#endif