Revision ddeaf723

View differences:

libavcodec/Makefile
13 13
      jrevdct.o \
14 14
      jfdctfst.o \
15 15
      jfdctint.o\
16
      mpegidct.o \
16 17
      resample.o \
17 18
      resample2.o \
18 19
      dsputil.o \
libavcodec/avcodec.h
1278 1278
#define FF_IDCT_CAVS         15
1279 1279
#define FF_IDCT_SIMPLEARMV5TE 16
1280 1280
#define FF_IDCT_SIMPLEARMV6  17
1281
#define FF_IDCT_MPEG         18
1281 1282

  
1282 1283
    /**
1283 1284
     * slice count
libavcodec/dsputil.c
3753 3753

  
3754 3754
/* XXX: those functions should be suppressed ASAP when all IDCTs are
3755 3755
 converted */
3756
static void ff_mpeg_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block)
3757
{
3758
    ff_mpeg_idct_c(block);
3759
    put_pixels_clamped_c(block, dest, line_size);
3760
}
3761
static void ff_mpeg_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
3762
{
3763
    ff_mpeg_idct_c(block);
3764
    add_pixels_clamped_c(block, dest, line_size);
3765
}
3766

  
3756 3767
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
3757 3768
{
3758 3769
    j_rev_dct (block);
......
3891 3902
            c->idct_add= ff_vp3_idct_add_c;
3892 3903
            c->idct    = ff_vp3_idct_c;
3893 3904
            c->idct_permutation_type= FF_NO_IDCT_PERM;
3905
        }else if(avctx->idct_algo==FF_IDCT_MPEG){
3906
            c->idct_put= ff_mpeg_idct_put_c;
3907
            c->idct_add= ff_mpeg_idct_add_c;
3908
            c->idct    = ff_mpeg_idct_c;
3909
            c->idct_permutation_type= FF_NO_IDCT_PERM;
3894 3910
        }else{ //accurate/default
3895 3911
            c->idct_put= simple_idct_put;
3896 3912
            c->idct_add= simple_idct_add;
libavcodec/dsputil.h
47 47
void j_rev_dct4 (DCTELEM *data);
48 48
void j_rev_dct2 (DCTELEM *data);
49 49
void j_rev_dct1 (DCTELEM *data);
50
void ff_mpeg_idct_c(DCTELEM *data);
50 51

  
51 52
void ff_fdct_mmx(DCTELEM *block);
52 53
void ff_fdct_mmx2(DCTELEM *block);
libavcodec/mpegidct.c
41 41
/* this code assumes >> to be a two's-complement arithmetic */
42 42
/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2               */
43 43

  
44
#include "config.h"
45 44

  
46 45
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
47 46
#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
......
50 49
#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
51 50
#define W7 565  /* 2048*sqrt(2)*cos(7*pi/16) */
52 51

  
53
/* global declarations */
54
void Initialize_Fast_IDCT _ANSI_ARGS_((void));
55
void Fast_IDCT _ANSI_ARGS_((short *block));
56

  
57
/* private data */
58
static short iclip[1024]; /* clipping table */
59
static short *iclp;
60

  
61
/* private prototypes */
62
static void idctrow _ANSI_ARGS_((short *blk));
63
static void idctcol _ANSI_ARGS_((short *blk));
64

  
65 52
/* row (horizontal) IDCT
66 53
 *
67 54
 *           7                       pi         1
......
144 131
        (x4 = blk[8*1]) | (x5 = blk[8*7]) | (x6 = blk[8*5]) | (x7 = blk[8*3])))
145 132
  {
146 133
    blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=blk[8*5]=blk[8*6]=blk[8*7]=
147
      iclp[(blk[8*0]+32)>>6];
134
      (blk[8*0]+32)>>6;
148 135
    return;
149 136
  }
150 137

  
......
178 165
  x4 = (181*(x4-x5)+128)>>8;
179 166

  
180 167
  /* fourth stage */
181
  blk[8*0] = iclp[(x7+x1)>>14];
182
  blk[8*1] = iclp[(x3+x2)>>14];
183
  blk[8*2] = iclp[(x0+x4)>>14];
184
  blk[8*3] = iclp[(x8+x6)>>14];
185
  blk[8*4] = iclp[(x8-x6)>>14];
186
  blk[8*5] = iclp[(x0-x4)>>14];
187
  blk[8*6] = iclp[(x3-x2)>>14];
188
  blk[8*7] = iclp[(x7-x1)>>14];
168
  blk[8*0] = (x7+x1)>>14;
169
  blk[8*1] = (x3+x2)>>14;
170
  blk[8*2] = (x0+x4)>>14;
171
  blk[8*3] = (x8+x6)>>14;
172
  blk[8*4] = (x8-x6)>>14;
173
  blk[8*5] = (x0-x4)>>14;
174
  blk[8*6] = (x3-x2)>>14;
175
  blk[8*7] = (x7-x1)>>14;
189 176
}
190 177

  
191 178
/* two dimensional inverse discrete cosine transform */
192
void Fast_IDCT(block)
179
void ff_mpeg_idct_c(block)
193 180
short *block;
194 181
{
195 182
  int i;
......
200 187
  for (i=0; i<8; i++)
201 188
    idctcol(block+i);
202 189
}
203

  
204
void Initialize_Fast_IDCT()
205
{
206
  int i;
207

  
208
  iclp = iclip+512;
209
  for (i= -512; i<512; i++)
210
    iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
211
}

Also available in: Unified diff