aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-01-15 19:21:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-01-15 19:21:21 +0000
commit0e15384d9d154a1e4c5bc3a8d0f0e4618b6b5628 (patch)
treec1041c65ed3c9afd5c23e5d48f998fe2a33be197
parent3a87ac948f0cd95218e62d5a98b8b8d5e4c11366 (diff)
downloadffmpeg-0e15384d9d154a1e4c5bc3a8d0f0e4618b6b5628.tar.gz
fixing DCTELEM != short
Originally committed as revision 1462 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/dsputil.c2
-rw-r--r--libavcodec/dsputil.h3
-rw-r--r--libavcodec/dv.c2
-rw-r--r--libavcodec/h263.c8
-rw-r--r--libavcodec/mpegvideo.h2
-rw-r--r--libavcodec/simple_idct.c80
-rw-r--r--libavcodec/simple_idct.h18
7 files changed, 65 insertions, 50 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 44b48996ed..e960696e1a 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -1822,7 +1822,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
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){
MpegEncContext * const s= (MpegEncContext *)c;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 23c4228258..d885c4aca1 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -25,6 +25,7 @@
//#define DEBUG
/* dct code */
typedef short DCTELEM;
+//typedef int DCTELEM;
void fdct_ifast (DCTELEM *data);
void ff_jpeg_fdct_islow (DCTELEM *data);
@@ -156,7 +157,7 @@ void dsputil_init(DSPContext* p, unsigned mask);
* permute block according to permuatation.
* @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()
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index f436caf128..404f018f14 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -157,7 +157,7 @@ static const UINT16 block_sizes[6] = {
/* decode ac coefs */
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 shift_offset = mb->shift_offset;
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 64b2e18bda..025288b03f 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -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,
int n, int coded, int intra);
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);
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);
@@ -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;
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
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 i;
@@ -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 i;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 6f9d5b6989..2198429ffb 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -692,7 +692,7 @@ void h263_encode_picture_header(MpegEncContext *s, int picture_number);
int h263_encode_gob_header(MpegEncContext * s, int mb_line);
INT16 *h263_pred_motion(MpegEncContext * s, int block,
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);
void ff_set_mpeg4_time(MpegEncContext * s, int picture_number);
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
index 8c9ce7b936..703e94f213 100644
--- a/libavcodec/simple_idct.c
+++ b/libavcodec/simple_idct.c
@@ -67,7 +67,7 @@
#endif
-static inline void idctRowCondDC (int16_t * row)
+static inline void idctRowCondDC (DCTELEM * row)
{
int a0, a1, a2, a3, b0, b1, b2, b3;
#ifdef FAST_64BIT
@@ -82,26 +82,40 @@ static inline void idctRowCondDC (int16_t * row)
#else
#define ROW0_MASK 0xffffLL
#endif
- if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
- ((uint64_t *)row)[1]) == 0) {
- temp = (row[0] << 3) & 0xffff;
- temp += temp << 16;
- temp += temp << 32;
- ((uint64_t *)row)[0] = temp;
- ((uint64_t *)row)[1] = temp;
- return;
- }
+ if(sizeof(DCTELEM)==2){
+ if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
+ ((uint64_t *)row)[1]) == 0) {
+ temp = (row[0] << 3) & 0xffff;
+ temp += temp << 16;
+ temp += temp << 32;
+ ((uint64_t *)row)[0] = temp;
+ ((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
- if (!(((uint32_t*)row)[1] |
- ((uint32_t*)row)[2] |
- ((uint32_t*)row)[3] |
- row[1])) {
- temp = (row[0] << 3) & 0xffff;
- temp += temp << 16;
- ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
- ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
- return;
- }
+ if(sizeof(DCTELEM)==2){
+ if (!(((uint32_t*)row)[1] |
+ ((uint32_t*)row)[2] |
+ ((uint32_t*)row)[3] |
+ row[1])) {
+ temp = (row[0] << 3) & 0xffff;
+ temp += temp << 16;
+ ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
+ ((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
a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
@@ -159,7 +173,7 @@ static inline void idctRowCondDC (int16_t * row)
}
static inline void idctSparseColPut (UINT8 *dest, int line_size,
- int16_t * col)
+ DCTELEM * col)
{
int a0, a1, a2, a3, b0, b1, b2, b3;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
@@ -231,7 +245,7 @@ static inline void idctSparseColPut (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;
UINT8 *cm = cropTbl + MAX_NEG_CROP;
@@ -302,7 +316,7 @@ static inline void idctSparseColAdd (UINT8 *dest, int line_size,
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;
@@ -365,7 +379,7 @@ static inline void idctSparseCol (int16_t * col)
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;
for(i=0; i<8; i++)
@@ -375,7 +389,7 @@ void simple_idct_put(UINT8 *dest, int line_size, INT16 *block)
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;
for(i=0; i<8; i++)
@@ -385,7 +399,7 @@ void simple_idct_add(UINT8 *dest, int line_size, INT16 *block)
idctSparseColAdd(dest + i, line_size, block + i);
}
-void simple_idct(INT16 *block)
+void simple_idct(DCTELEM *block)
{
int i;
for(i=0; i<8; i++)
@@ -406,7 +420,7 @@ void simple_idct(INT16 *block)
and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
#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;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
@@ -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
compensate the extra butterfly stage - I don't have the full DV
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;
- INT16 *ptr;
+ DCTELEM *ptr;
/* butterfly */
ptr = block;
@@ -486,7 +500,7 @@ void simple_idct248_put(UINT8 *dest, int line_size, INT16 *block)
#define C2 C_FIX(0.2705980501)
#define C3 C_FIX(0.5)
#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;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
@@ -514,7 +528,7 @@ static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col)
#define R2 R_FIX(0.2705980501)
#define R3 R_FIX(0.5)
#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;
const UINT8 *cm = cropTbl + MAX_NEG_CROP;
@@ -533,7 +547,7 @@ static inline void idct4row(INT16 *row)
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;
@@ -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;
diff --git a/libavcodec/simple_idct.h b/libavcodec/simple_idct.h
index 428c6072c8..0ee1e05ed3 100644
--- a/libavcodec/simple_idct.h
+++ b/libavcodec/simple_idct.h
@@ -18,14 +18,14 @@
* 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_add(UINT8 *dest, int line_size, INT16 *block);
-void ff_simple_idct_mmx(short *block);
-void ff_simple_idct_add_mmx(UINT8 *dest, int line_size, INT16 *block);
-void ff_simple_idct_put_mmx(UINT8 *dest, int line_size, INT16 *block);
-void simple_idct(short *block);
+void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block);
+void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block);
+void ff_simple_idct_mmx(int16_t *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_t *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_idct48_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, DCTELEM *block);