提交 0e15384d 编写于 作者: M Michael Niedermayer

fixing DCTELEM != short

Originally committed as revision 1462 to svn://svn.ffmpeg.org/ffmpeg/trunk
上级 3a87ac94
...@@ -1822,7 +1822,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 ...@@ -1822,7 +1822,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
return sum; return sum;
} }
void simple_idct(INT16 *block); //FIXME void simple_idct(DCTELEM *block); //FIXME
static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
//#define DEBUG //#define DEBUG
/* dct code */ /* dct code */
typedef short DCTELEM; typedef short DCTELEM;
//typedef int DCTELEM;
void fdct_ifast (DCTELEM *data); void fdct_ifast (DCTELEM *data);
void ff_jpeg_fdct_islow (DCTELEM *data); void ff_jpeg_fdct_islow (DCTELEM *data);
...@@ -156,7 +157,7 @@ void dsputil_init(DSPContext* p, unsigned mask); ...@@ -156,7 +157,7 @@ void dsputil_init(DSPContext* p, unsigned mask);
* permute block according to permuatation. * permute block according to permuatation.
* @param last last non zero element in scantable order * @param last last non zero element in scantable order
*/ */
void ff_block_permute(INT16 *block, UINT8 *permutation, const UINT8 *scantable, int last); void ff_block_permute(DCTELEM *block, UINT8 *permutation, const UINT8 *scantable, int last);
#define emms_c() #define emms_c()
......
...@@ -157,7 +157,7 @@ static const UINT16 block_sizes[6] = { ...@@ -157,7 +157,7 @@ static const UINT16 block_sizes[6] = {
/* decode ac coefs */ /* decode ac coefs */
static void dv_decode_ac(DVVideoDecodeContext *s, static void dv_decode_ac(DVVideoDecodeContext *s,
BlockInfo *mb, INT16 *block, int last_index) BlockInfo *mb, DCTELEM *block, int last_index)
{ {
int last_re_index; int last_re_index;
int shift_offset = mb->shift_offset; int shift_offset = mb->shift_offset;
......
...@@ -67,7 +67,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); ...@@ -67,7 +67,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr);
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded, int intra); int n, int coded, int intra);
static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr); static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr);
static void mpeg4_inv_pred_ac(MpegEncContext * s, INT16 *block, int n, static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir); int dir);
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s); static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr, int *dir_ptr); static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr, int *dir_ptr);
...@@ -999,7 +999,7 @@ static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr) ...@@ -999,7 +999,7 @@ static int h263_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_ptr)
} }
void h263_pred_acdc(MpegEncContext * s, INT16 *block, int n) void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
{ {
int x, y, wrap, a, c, pred_dc, scale, i; int x, y, wrap, a, c, pred_dc, scale, i;
INT16 *dc_val, *ac_val, *ac_val1; INT16 *dc_val, *ac_val, *ac_val1;
...@@ -1852,7 +1852,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_pt ...@@ -1852,7 +1852,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, UINT16 **dc_val_pt
return pred; return pred;
} }
void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir) int dir)
{ {
int i; int i;
...@@ -1907,7 +1907,7 @@ void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, ...@@ -1907,7 +1907,7 @@ void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n,
} }
static void mpeg4_inv_pred_ac(MpegEncContext * s, INT16 *block, int n, static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir) int dir)
{ {
int i; int i;
......
...@@ -692,7 +692,7 @@ void h263_encode_picture_header(MpegEncContext *s, int picture_number); ...@@ -692,7 +692,7 @@ void h263_encode_picture_header(MpegEncContext *s, int picture_number);
int h263_encode_gob_header(MpegEncContext * s, int mb_line); int h263_encode_gob_header(MpegEncContext * s, int mb_line);
INT16 *h263_pred_motion(MpegEncContext * s, int block, INT16 *h263_pred_motion(MpegEncContext * s, int block,
int *px, int *py); int *px, int *py);
void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir); int dir);
void ff_set_mpeg4_time(MpegEncContext * s, int picture_number); void ff_set_mpeg4_time(MpegEncContext * s, int picture_number);
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#endif #endif
static inline void idctRowCondDC (int16_t * row) static inline void idctRowCondDC (DCTELEM * row)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
#ifdef FAST_64BIT #ifdef FAST_64BIT
...@@ -82,26 +82,40 @@ static inline void idctRowCondDC (int16_t * row) ...@@ -82,26 +82,40 @@ static inline void idctRowCondDC (int16_t * row)
#else #else
#define ROW0_MASK 0xffffLL #define ROW0_MASK 0xffffLL
#endif #endif
if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) | if(sizeof(DCTELEM)==2){
((uint64_t *)row)[1]) == 0) { if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
temp = (row[0] << 3) & 0xffff; ((uint64_t *)row)[1]) == 0) {
temp += temp << 16; temp = (row[0] << 3) & 0xffff;
temp += temp << 32; temp += temp << 16;
((uint64_t *)row)[0] = temp; temp += temp << 32;
((uint64_t *)row)[1] = temp; ((uint64_t *)row)[0] = temp;
return; ((uint64_t *)row)[1] = temp;
} return;
}
}else{
if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
return;
}
}
#else #else
if (!(((uint32_t*)row)[1] | if(sizeof(DCTELEM)==2){
((uint32_t*)row)[2] | if (!(((uint32_t*)row)[1] |
((uint32_t*)row)[3] | ((uint32_t*)row)[2] |
row[1])) { ((uint32_t*)row)[3] |
temp = (row[0] << 3) & 0xffff; row[1])) {
temp += temp << 16; temp = (row[0] << 3) & 0xffff;
((uint32_t*)row)[0]=((uint32_t*)row)[1] = temp += temp << 16;
((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp; ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
return; ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
} return;
}
}else{
if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
return;
}
}
#endif #endif
a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1)); a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
...@@ -159,7 +173,7 @@ static inline void idctRowCondDC (int16_t * row) ...@@ -159,7 +173,7 @@ static inline void idctRowCondDC (int16_t * row)
} }
static inline void idctSparseColPut (UINT8 *dest, int line_size, static inline void idctSparseColPut (UINT8 *dest, int line_size,
int16_t * col) DCTELEM * col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP; UINT8 *cm = cropTbl + MAX_NEG_CROP;
...@@ -231,7 +245,7 @@ static inline void idctSparseColPut (UINT8 *dest, int line_size, ...@@ -231,7 +245,7 @@ static inline void idctSparseColPut (UINT8 *dest, int line_size,
} }
static inline void idctSparseColAdd (UINT8 *dest, int line_size, static inline void idctSparseColAdd (UINT8 *dest, int line_size,
int16_t * col) DCTELEM * col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP; UINT8 *cm = cropTbl + MAX_NEG_CROP;
...@@ -302,7 +316,7 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size, ...@@ -302,7 +316,7 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size,
dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)]; dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
} }
static inline void idctSparseCol (int16_t * col) static inline void idctSparseCol (DCTELEM * col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
...@@ -365,7 +379,7 @@ static inline void idctSparseCol (int16_t * col) ...@@ -365,7 +379,7 @@ static inline void idctSparseCol (int16_t * col)
col[56] = ((a0 - b0) >> COL_SHIFT); col[56] = ((a0 - b0) >> COL_SHIFT);
} }
void simple_idct_put(UINT8 *dest, int line_size, INT16 *block) void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
...@@ -375,7 +389,7 @@ void simple_idct_put(UINT8 *dest, int line_size, INT16 *block) ...@@ -375,7 +389,7 @@ void simple_idct_put(UINT8 *dest, int line_size, INT16 *block)
idctSparseColPut(dest + i, line_size, block + i); idctSparseColPut(dest + i, line_size, block + i);
} }
void simple_idct_add(UINT8 *dest, int line_size, INT16 *block) void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
...@@ -385,7 +399,7 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block) ...@@ -385,7 +399,7 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block)
idctSparseColAdd(dest + i, line_size, block + i); idctSparseColAdd(dest + i, line_size, block + i);
} }
void simple_idct(INT16 *block) void simple_idct(DCTELEM *block)
{ {
int i; int i;
for(i=0; i<8; i++) for(i=0; i<8; i++)
...@@ -406,7 +420,7 @@ void simple_idct(INT16 *block) ...@@ -406,7 +420,7 @@ void simple_idct(INT16 *block)
and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
#define C_SHIFT (4+1+12) #define C_SHIFT (4+1+12)
static inline void idct4col(UINT8 *dest, int line_size, const INT16 *col) static inline void idct4col(UINT8 *dest, int line_size, const DCTELEM *col)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP; const UINT8 *cm = cropTbl + MAX_NEG_CROP;
...@@ -443,10 +457,10 @@ static inline void idct4col(UINT8 *dest, int line_size, const INT16 *col) ...@@ -443,10 +457,10 @@ static inline void idct4col(UINT8 *dest, int line_size, const INT16 *col)
/* XXX: I think a 1.0/sqrt(2) normalization should be needed to /* XXX: I think a 1.0/sqrt(2) normalization should be needed to
compensate the extra butterfly stage - I don't have the full DV compensate the extra butterfly stage - I don't have the full DV
specification */ specification */
void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block) void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
INT16 *ptr; DCTELEM *ptr;
/* butterfly */ /* butterfly */
ptr = block; ptr = block;
...@@ -486,7 +500,7 @@ void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block) ...@@ -486,7 +500,7 @@ void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block)
#define C2 C_FIX(0.2705980501) #define C2 C_FIX(0.2705980501)
#define C3 C_FIX(0.5) #define C3 C_FIX(0.5)
#define C_SHIFT (4+1+12) #define C_SHIFT (4+1+12)
static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col) static inline void idct4col_add(UINT8 *dest, int line_size, const DCTELEM *col)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP; const UINT8 *cm = cropTbl + MAX_NEG_CROP;
...@@ -514,7 +528,7 @@ static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col) ...@@ -514,7 +528,7 @@ static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col)
#define R2 R_FIX(0.2705980501) #define R2 R_FIX(0.2705980501)
#define R3 R_FIX(0.5) #define R3 R_FIX(0.5)
#define R_SHIFT 11 #define R_SHIFT 11
static inline void idct4row(INT16 *row) static inline void idct4row(DCTELEM *row)
{ {
int c0, c1, c2, c3, a0, a1, a2, a3; int c0, c1, c2, c3, a0, a1, a2, a3;
const UINT8 *cm = cropTbl + MAX_NEG_CROP; const UINT8 *cm = cropTbl + MAX_NEG_CROP;
...@@ -533,7 +547,7 @@ static inline void idct4row(INT16 *row) ...@@ -533,7 +547,7 @@ static inline void idct4row(INT16 *row)
row[3]= (c0 - c1) >> R_SHIFT; row[3]= (c0 - c1) >> R_SHIFT;
} }
void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block) void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
...@@ -548,7 +562,7 @@ void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block) ...@@ -548,7 +562,7 @@ void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block)
} }
} }
void simple_idct48_add(UINT8 *dest, int line_size, INT16 *block) void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block)
{ {
int i; int i;
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
void simple_idct_put(UINT8 *dest, int line_size, INT16 *block); void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct_add(UINT8 *dest, int line_size, INT16 *block); void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block);
void ff_simple_idct_mmx(short *block); void ff_simple_idct_mmx(int16_t *block);
void ff_simple_idct_add_mmx(UINT8 *dest, int line_size, INT16 *block); void ff_simple_idct_add_mmx(UINT8 *dest, int line_size, int16_t *block);
void ff_simple_idct_put_mmx(UINT8 *dest, int line_size, INT16 *block); void ff_simple_idct_put_mmx(UINT8 *dest, int line_size, int16_t *block);
void simple_idct(short *block); void simple_idct(DCTELEM *block);
void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block); void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block); void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block);
void simple_idct48_add(UINT8 *dest, int line_size, INT16 *block); void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册