1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Drop DCTELEM typedef

It does not help as an abstraction and adds dsputil dependencies.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Diego Biurrun 2013-01-20 01:02:29 +01:00 committed by Ronald S. Bultje
parent 2e4bb99f4d
commit 88bd7fdc82
163 changed files with 835 additions and 812 deletions

View File

@ -148,7 +148,7 @@ Alignment:
Some instructions on some architectures have strict alignment restrictions, Some instructions on some architectures have strict alignment restrictions,
for example most SSE/SSE2 instructions on x86. for example most SSE/SSE2 instructions on x86.
The minimum guaranteed alignment is written in the .h files, for example: The minimum guaranteed alignment is written in the .h files, for example:
void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size); void (*put_pixels_clamped)(const int16_t *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
General Tips: General Tips:

View File

@ -139,7 +139,7 @@ typedef struct FourXContext {
int mv[256]; int mv[256];
VLC pre_vlc; VLC pre_vlc;
int last_dc; int last_dc;
DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
void *bitstream_buffer; void *bitstream_buffer;
unsigned int bitstream_buffer_size; unsigned int bitstream_buffer_size;
int version; int version;
@ -154,7 +154,7 @@ typedef struct FourXContext {
#define MULTIPLY(var, const) (((var) * (const)) >> 16) #define MULTIPLY(var, const) (((var) * (const)) >> 16)
static void idct(DCTELEM block[64]) static void idct(int16_t block[64])
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
@ -451,7 +451,7 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
* decode block and dequantize. * decode block and dequantize.
* Note this is almost identical to MJPEG. * Note this is almost identical to MJPEG.
*/ */
static int decode_i_block(FourXContext *f, DCTELEM *block) static int decode_i_block(FourXContext *f, int16_t *block)
{ {
int code, i, j, level, val; int code, i, j, level, val;
@ -496,7 +496,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block)
static inline void idct_put(FourXContext *f, int x, int y) static inline void idct_put(FourXContext *f, int x, int y)
{ {
DCTELEM (*block)[64] = f->block; int16_t (*block)[64] = f->block;
int stride = f->current_picture->linesize[0] >> 1; int stride = f->current_picture->linesize[0] >> 1;
int i; int i;
uint16_t *dst = ((uint16_t*)f->current_picture->data[0]) + y * stride + x; uint16_t *dst = ((uint16_t*)f->current_picture->data[0]) + y * stride + x;
@ -517,7 +517,7 @@ static inline void idct_put(FourXContext *f, int x, int y)
* cr = (-1b - 4g + 5r) / 14 */ * cr = (-1b - 4g + 5r) / 14 */
for (y = 0; y < 8; y++) { for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) { for (x = 0; x < 8; x++) {
DCTELEM *temp = block[(x >> 2) + 2 * (y >> 2)] + int16_t *temp = block[(x >> 2) + 2 * (y >> 2)] +
2 * (x & 3) + 2 * 8 * (y & 3); // FIXME optimize 2 * (x & 3) + 2 * 8 * (y & 3); // FIXME optimize
int cb = block[4][x + 8 * y]; int cb = block[4][x + 8 * y];
int cr = block[5][x + 8 * y]; int cr = block[5][x + 8 * y];

View File

@ -23,15 +23,15 @@
#include "dsputil_alpha.h" #include "dsputil_alpha.h"
#include "asm.h" #include "asm.h"
void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
#if 0 #if 0
/* These functions were the base for the optimized assembler routines, /* These functions were the base for the optimized assembler routines,
and remain here for documentation purposes. */ and remain here for documentation purposes. */
static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, static void put_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
int line_size) int line_size)
{ {
int i = 8; int i = 8;
@ -55,7 +55,7 @@ static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels,
} while (--i); } while (--i);
} }
void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, void add_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
int line_size) int line_size)
{ {
int h = 8; int h = 8;
@ -100,9 +100,9 @@ void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels,
} }
#endif #endif
static void clear_blocks_axp(DCTELEM *blocks) { static void clear_blocks_axp(int16_t *blocks) {
uint64_t *p = (uint64_t *) blocks; uint64_t *p = (uint64_t *) blocks;
int n = sizeof(DCTELEM) * 6 * 64; int n = sizeof(int16_t) * 6 * 64;
do { do {
p[0] = 0; p[0] = 0;

View File

@ -19,26 +19,26 @@
#ifndef AVCODEC_ALPHA_DSPUTIL_ALPHA_H #ifndef AVCODEC_ALPHA_DSPUTIL_ALPHA_H
#define AVCODEC_ALPHA_DSPUTIL_ALPHA_H #define AVCODEC_ALPHA_DSPUTIL_ALPHA_H
#include "libavcodec/dsputil.h" #include <stdint.h>
void ff_simple_idct_axp(DCTELEM *block); void ff_simple_idct_axp(int16_t *block);
void ff_simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block); void ff_simple_idct_put_axp(uint8_t *dest, int line_size, int16_t *block);
void ff_simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block); void ff_simple_idct_add_axp(uint8_t *dest, int line_size, int16_t *block);
void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels, void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
int line_size, int h); int line_size, int h);
void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
extern void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, extern void (*put_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, extern void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
int line_size); int line_size);
void get_pixels_mvi(DCTELEM *restrict block, void get_pixels_mvi(int16_t *restrict block,
const uint8_t *restrict pixels, int line_size); const uint8_t *restrict pixels, int line_size);
void diff_pixels_mvi(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, void diff_pixels_mvi(int16_t *block, const uint8_t *s1, const uint8_t *s2,
int stride); int stride);
int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
int pix_abs16x16_mvi_asm(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); int pix_abs16x16_mvi_asm(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);

View File

@ -135,7 +135,7 @@ $aligned:
.end put_pixels_axp_asm .end put_pixels_axp_asm
/************************************************************************ /************************************************************************
* void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, * void put_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
* int line_size) * int line_size)
*/ */
.align 6 .align 6
@ -185,7 +185,7 @@ put_pixels_clamped_mvi_asm:
.end put_pixels_clamped_mvi_asm .end put_pixels_clamped_mvi_asm
/************************************************************************ /************************************************************************
* void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, * void add_pixels_clamped_mvi_asm(const int16_t *block, uint8_t *pixels,
* int line_size) * int line_size)
*/ */
.align 6 .align 6

View File

@ -23,7 +23,7 @@
#include "dsputil_alpha.h" #include "dsputil_alpha.h"
#include "asm.h" #include "asm.h"
void get_pixels_mvi(DCTELEM *restrict block, void get_pixels_mvi(int16_t *restrict block,
const uint8_t *restrict pixels, int line_size) const uint8_t *restrict pixels, int line_size)
{ {
int h = 8; int h = 8;
@ -40,7 +40,7 @@ void get_pixels_mvi(DCTELEM *restrict block,
} while (--h); } while (--h);
} }
void diff_pixels_mvi(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, void diff_pixels_mvi(int16_t *block, const uint8_t *s1, const uint8_t *s2,
int stride) { int stride) {
int h = 8; int h = 8;
uint64_t mask = 0x4040; uint64_t mask = 0x4040;

View File

@ -23,7 +23,7 @@
#include "libavcodec/mpegvideo.h" #include "libavcodec/mpegvideo.h"
#include "asm.h" #include "asm.h"
static void dct_unquantize_h263_axp(DCTELEM *block, int n_coeffs, static void dct_unquantize_h263_axp(int16_t *block, int n_coeffs,
uint64_t qscale, uint64_t qadd) uint64_t qscale, uint64_t qadd)
{ {
uint64_t qmul = qscale << 1; uint64_t qmul = qscale << 1;
@ -69,12 +69,12 @@ static void dct_unquantize_h263_axp(DCTELEM *block, int n_coeffs,
} }
} }
static void dct_unquantize_h263_intra_axp(MpegEncContext *s, DCTELEM *block, static void dct_unquantize_h263_intra_axp(MpegEncContext *s, int16_t *block,
int n, int qscale) int n, int qscale)
{ {
int n_coeffs; int n_coeffs;
uint64_t qadd; uint64_t qadd;
DCTELEM block0 = block[0]; int16_t block0 = block[0];
if (!s->h263_aic) { if (!s->h263_aic) {
if (n < 4) if (n < 4)
@ -96,7 +96,7 @@ static void dct_unquantize_h263_intra_axp(MpegEncContext *s, DCTELEM *block,
block[0] = block0; block[0] = block0;
} }
static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block, static void dct_unquantize_h263_inter_axp(MpegEncContext *s, int16_t *block,
int n, int qscale) int n, int qscale)
{ {
int n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]]; int n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];

View File

@ -44,7 +44,7 @@
#define COL_SHIFT 20 #define COL_SHIFT 20
/* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */ /* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */
static inline int idct_row(DCTELEM *row) static inline int idct_row(int16_t *row)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3, t; int a0, a1, a2, a3, b0, b1, b2, b3, t;
uint64_t l, r, t2; uint64_t l, r, t2;
@ -152,7 +152,7 @@ static inline int idct_row(DCTELEM *row)
return 2; return 2;
} }
static inline void idct_col(DCTELEM *col) static inline void idct_col(int16_t *col)
{ {
int a0, a1, a2, a3, b0, b1, b2, b3; int a0, a1, a2, a3, b0, b1, b2, b3;
@ -229,7 +229,7 @@ static inline void idct_col(DCTELEM *col)
/* If all rows but the first one are zero after row transformation, /* If all rows but the first one are zero after row transformation,
all rows will be identical after column transformation. */ all rows will be identical after column transformation. */
static inline void idct_col2(DCTELEM *col) static inline void idct_col2(int16_t *col)
{ {
int i; int i;
uint64_t l, r; uint64_t l, r;
@ -251,7 +251,7 @@ static inline void idct_col2(DCTELEM *col)
stq(l, col + 14 * 4); stq(r, col + 15 * 4); stq(l, col + 14 * 4); stq(r, col + 15 * 4);
} }
void ff_simple_idct_axp(DCTELEM *block) void ff_simple_idct_axp(int16_t *block)
{ {
int i; int i;
@ -291,13 +291,13 @@ void ff_simple_idct_axp(DCTELEM *block)
} }
} }
void ff_simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block) void ff_simple_idct_put_axp(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_simple_idct_axp(block); ff_simple_idct_axp(block);
put_pixels_clamped_axp_p(block, dest, line_size); put_pixels_clamped_axp_p(block, dest, line_size);
} }
void ff_simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block) void ff_simple_idct_add_axp(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_simple_idct_axp(block); ff_simple_idct_axp(block);
add_pixels_clamped_axp_p(block, dest, line_size); add_pixels_clamped_axp_p(block, dest, line_size);

View File

@ -23,12 +23,12 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "dsputil_arm.h" #include "dsputil_arm.h"
void ff_j_rev_dct_arm(DCTELEM *data); void ff_j_rev_dct_arm(int16_t *data);
void ff_simple_idct_arm(DCTELEM *data); void ff_simple_idct_arm(int16_t *data);
/* XXX: local hack */ /* XXX: local hack */
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
@ -48,27 +48,27 @@ CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8)
CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8) CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8)
CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8) CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8)
void ff_add_pixels_clamped_arm(const DCTELEM *block, uint8_t *dest, void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest,
int line_size); int line_size);
/* XXX: those functions should be suppressed ASAP when all IDCTs are /* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */ converted */
static void j_rev_dct_arm_put(uint8_t *dest, int line_size, DCTELEM *block) static void j_rev_dct_arm_put(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_j_rev_dct_arm (block); ff_j_rev_dct_arm (block);
ff_put_pixels_clamped(block, dest, line_size); ff_put_pixels_clamped(block, dest, line_size);
} }
static void j_rev_dct_arm_add(uint8_t *dest, int line_size, DCTELEM *block) static void j_rev_dct_arm_add(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_j_rev_dct_arm (block); ff_j_rev_dct_arm (block);
ff_add_pixels_clamped(block, dest, line_size); ff_add_pixels_clamped(block, dest, line_size);
} }
static void simple_idct_arm_put(uint8_t *dest, int line_size, DCTELEM *block) static void simple_idct_arm_put(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_simple_idct_arm (block); ff_simple_idct_arm (block);
ff_put_pixels_clamped(block, dest, line_size); ff_put_pixels_clamped(block, dest, line_size);
} }
static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block) static void simple_idct_arm_add(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_simple_idct_arm (block); ff_simple_idct_arm (block);
ff_add_pixels_clamped(block, dest, line_size); ff_add_pixels_clamped(block, dest, line_size);

View File

@ -21,9 +21,9 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "dsputil_arm.h" #include "dsputil_arm.h"
void ff_simple_idct_armv5te(DCTELEM *data); void ff_simple_idct_armv5te(int16_t *data);
void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, int16_t *data);
void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, int16_t *data);
av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)
{ {

View File

@ -24,9 +24,9 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "dsputil_arm.h" #include "dsputil_arm.h"
void ff_simple_idct_armv6(DCTELEM *data); void ff_simple_idct_armv6(int16_t *data);
void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, int16_t *data);
void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, int16_t *data);
void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, int, int); void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, int, int);
void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, int, int); void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, int, int);
@ -46,12 +46,12 @@ void ff_put_pixels8_y2_no_rnd_armv6(uint8_t *, const uint8_t *, int, int);
void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, int, int); void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, int, int);
void ff_add_pixels_clamped_armv6(const DCTELEM *block, void ff_add_pixels_clamped_armv6(const int16_t *block,
uint8_t *restrict pixels, uint8_t *restrict pixels,
int line_size); int line_size);
void ff_get_pixels_armv6(DCTELEM *block, const uint8_t *pixels, int stride); void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels, int stride);
void ff_diff_pixels_armv6(DCTELEM *block, const uint8_t *s1, void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1,
const uint8_t *s2, int stride); const uint8_t *s2, int stride);
int ff_pix_abs16_armv6(void *s, uint8_t *blk1, uint8_t *blk2, int ff_pix_abs16_armv6(void *s, uint8_t *blk1, uint8_t *blk2,

View File

@ -25,12 +25,12 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "dsputil_arm.h" #include "dsputil_arm.h"
void ff_simple_idct_neon(DCTELEM *data); void ff_simple_idct_neon(int16_t *data);
void ff_simple_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
void ff_simple_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_add_neon(uint8_t *dest, int line_size, int16_t *data);
void ff_clear_block_neon(DCTELEM *block); void ff_clear_block_neon(int16_t *block);
void ff_clear_blocks_neon(DCTELEM *blocks); void ff_clear_blocks_neon(int16_t *blocks);
void ff_put_pixels16_neon(uint8_t *, const uint8_t *, int, int); void ff_put_pixels16_neon(uint8_t *, const uint8_t *, int, int);
void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, int, int); void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, int, int);
@ -62,9 +62,9 @@ void ff_avg_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_avg_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int); void ff_avg_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_avg_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int); void ff_avg_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
void ff_add_pixels_clamped_neon(const DCTELEM *, uint8_t *, int); void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, int);
void ff_put_pixels_clamped_neon(const DCTELEM *, uint8_t *, int); void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int);
void ff_put_signed_pixels_clamped_neon(const DCTELEM *, uint8_t *, int); void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int);
void ff_put_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int); void ff_put_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int);
void ff_put_h264_qpel16_mc10_neon(uint8_t *, uint8_t *, int); void ff_put_h264_qpel16_mc10_neon(uint8_t *, uint8_t *, int);

View File

@ -50,22 +50,22 @@ void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride,
int height, int log2_den, int weightd, int height, int log2_den, int weightd,
int weights, int offset); int weights, int offset);
void ff_h264_idct_add_neon(uint8_t *dst, DCTELEM *block, int stride); void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
void ff_h264_idct_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride); void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
DCTELEM *block, int stride, int16_t *block, int stride,
const uint8_t nnzc[6*8]); const uint8_t nnzc[6*8]);
void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
DCTELEM *block, int stride, int16_t *block, int stride,
const uint8_t nnzc[6*8]); const uint8_t nnzc[6*8]);
void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
DCTELEM *block, int stride, int16_t *block, int stride,
const uint8_t nnzc[6*8]); const uint8_t nnzc[6*8]);
void ff_h264_idct8_add_neon(uint8_t *dst, DCTELEM *block, int stride); void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
void ff_h264_idct8_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride); void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
DCTELEM *block, int stride, int16_t *block, int stride,
const uint8_t nnzc[6*8]); const uint8_t nnzc[6*8]);
static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)

View File

@ -66,7 +66,7 @@ row_loop:
ldrsh r2, [lr, # 2] @ r2 = 'd2' ldrsh r2, [lr, # 2] @ r2 = 'd2'
@ Optimization for row that have all items except the first set to 0 @ Optimization for row that have all items except the first set to 0
@ (this works as the DCTELEMS are always 4-byte aligned) @ (this works as the int16_t are always 4-byte aligned)
ldr r5, [lr, # 0] ldr r5, [lr, # 0]
ldr r6, [lr, # 4] ldr r6, [lr, # 4]
ldr r3, [lr, # 8] ldr r3, [lr, # 8]

View File

@ -34,9 +34,9 @@ CHK_OFFS(MpegEncContext, inter_scantable.raster_end, INTER_SCANTAB_RASTER_END);
CHK_OFFS(MpegEncContext, h263_aic, H263_AIC); CHK_OFFS(MpegEncContext, h263_aic, H263_AIC);
#endif #endif
void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, DCTELEM *block, void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,
int n, int qscale); int n, int qscale);
void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, DCTELEM *block, void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, int16_t *block,
int n, int qscale); int n, int qscale);
void ff_MPV_common_init_arm(MpegEncContext *s) void ff_MPV_common_init_arm(MpegEncContext *s)

View File

@ -24,7 +24,7 @@
#include "libavcodec/mpegvideo.h" #include "libavcodec/mpegvideo.h"
#include "mpegvideo_arm.h" #include "mpegvideo_arm.h"
void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count); void ff_dct_unquantize_h263_armv5te(int16_t *block, int qmul, int qadd, int count);
#ifdef ENABLE_ARM_TESTS #ifdef ENABLE_ARM_TESTS
/** /**
@ -32,7 +32,7 @@ void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int coun
* have optimized implementations for each architecture. Is also used as a reference * have optimized implementations for each architecture. Is also used as a reference
* implementation in regression tests * implementation in regression tests
*/ */
static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count) static inline void dct_unquantize_h263_helper_c(int16_t *block, int qmul, int qadd, int count)
{ {
int i, level; int i, level;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
@ -50,7 +50,7 @@ static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qa
#endif #endif
static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int level, qmul, qadd; int level, qmul, qadd;
int nCoeffs; int nCoeffs;
@ -79,7 +79,7 @@ static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
} }
static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int qmul, qadd; int qmul, qadd;
int nCoeffs; int nCoeffs;

View File

@ -24,11 +24,11 @@
#include "libavcodec/rv34dsp.h" #include "libavcodec/rv34dsp.h"
#include "libavutil/arm/cpu.h" #include "libavutil/arm/cpu.h"
void ff_rv34_inv_transform_noround_neon(DCTELEM *block); void ff_rv34_inv_transform_noround_neon(int16_t *block);
void ff_rv34_inv_transform_noround_dc_neon(DCTELEM *block); void ff_rv34_inv_transform_noround_dc_neon(int16_t *block);
void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, DCTELEM *block); void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, int16_t *block);
void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc); void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc);
void ff_rv34dsp_init_arm(RV34DSPContext *c, DSPContext* dsp) void ff_rv34dsp_init_arm(RV34DSPContext *c, DSPContext* dsp)

View File

@ -67,7 +67,7 @@
vsub.s32 q15, q14, q9 @ z0 - z3 vsub.s32 q15, q14, q9 @ z0 - z3
.endm .endm
/* void rv34_idct_add_c(uint8_t *dst, int stride, DCTELEM *block) */ /* void rv34_idct_add_c(uint8_t *dst, int stride, int16_t *block) */
function ff_rv34_idct_add_neon, export=1 function ff_rv34_idct_add_neon, export=1
mov r3, r0 mov r3, r0
rv34_inv_transform r2 rv34_inv_transform r2
@ -97,7 +97,7 @@ function ff_rv34_idct_add_neon, export=1
bx lr bx lr
endfunc endfunc
/* void rv34_inv_transform_noround_neon(DCTELEM *block); */ /* void rv34_inv_transform_noround_neon(int16_t *block); */
function ff_rv34_inv_transform_noround_neon, export=1 function ff_rv34_inv_transform_noround_neon, export=1
rv34_inv_transform r0 rv34_inv_transform r0
vshl.s32 q11, q2, #1 vshl.s32 q11, q2, #1
@ -142,7 +142,7 @@ function ff_rv34_idct_dc_add_neon, export=1
bx lr bx lr
endfunc endfunc
/* void rv34_inv_transform_dc_noround_c(DCTELEM *block) */ /* void rv34_inv_transform_dc_noround_c(int16_t *block) */
function ff_rv34_inv_transform_noround_dc_neon, export=1 function ff_rv34_inv_transform_noround_dc_neon, export=1
vld1.16 {d28[]}, [r0,:16] @ block[0] vld1.16 {d28[]}, [r0,:16] @ block[0]
vmov.i16 d4, #251 vmov.i16 d4, #251

View File

@ -375,7 +375,7 @@ endfunc
sub r0, r0, #(16*7) sub r0, r0, #(16*7)
.endm .endm
/* void ff_simple_idct_armv6(DCTELEM *data); */ /* void ff_simple_idct_armv6(int16_t *data); */
function ff_simple_idct_armv6, export=1 function ff_simple_idct_armv6, export=1
push {r4-r11, lr} push {r4-r11, lr}
sub sp, sp, #128 sub sp, sp, #128
@ -390,7 +390,7 @@ function ff_simple_idct_armv6, export=1
pop {r4-r11, pc} pop {r4-r11, pc}
endfunc endfunc
/* ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data); */ /* ff_simple_idct_add_armv6(uint8_t *dest, int line_size, int16_t *data); */
function ff_simple_idct_add_armv6, export=1 function ff_simple_idct_add_armv6, export=1
push {r0, r1, r4-r11, lr} push {r0, r1, r4-r11, lr}
sub sp, sp, #128 sub sp, sp, #128
@ -407,7 +407,7 @@ function ff_simple_idct_add_armv6, export=1
pop {r4-r11, pc} pop {r4-r11, pc}
endfunc endfunc
/* ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data); */ /* ff_simple_idct_put_armv6(uint8_t *dest, int line_size, int16_t *data); */
function ff_simple_idct_put_armv6, export=1 function ff_simple_idct_put_armv6, export=1
push {r0, r1, r4-r11, lr} push {r0, r1, r4-r11, lr}
sub sp, sp, #128 sub sp, sp, #128

View File

@ -261,7 +261,7 @@ endconst
pop {r4-r7, pc} pop {r4-r7, pc}
.endm .endm
/* void ff_simple_idct_put_neon(uint8_t *dst, int line_size, DCTELEM *data); */ /* void ff_simple_idct_put_neon(uint8_t *dst, int line_size, int16_t *data); */
function ff_simple_idct_put_neon, export=1 function ff_simple_idct_put_neon, export=1
idct_start r2 idct_start r2
@ -316,7 +316,7 @@ function idct_col4_add8_neon
bx lr bx lr
endfunc endfunc
/* void ff_simple_idct_add_neon(uint8_t *dst, int line_size, DCTELEM *data); */ /* void ff_simple_idct_add_neon(uint8_t *dst, int line_size, int16_t *data); */
function ff_simple_idct_add_neon, export=1 function ff_simple_idct_add_neon, export=1
idct_start r2 idct_start r2
@ -355,7 +355,7 @@ function idct_col4_st16_neon
bx lr bx lr
endfunc endfunc
/* void ff_simple_idct_neon(DCTELEM *data); */ /* void ff_simple_idct_neon(int16_t *data); */
function ff_simple_idct_neon, export=1 function ff_simple_idct_neon, export=1
idct_start r0 idct_start r0

View File

@ -24,9 +24,9 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "libavcodec/vp3dsp.h" #include "libavcodec/vp3dsp.h"
void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data); void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data); void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, int16_t *data);
void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const DCTELEM *data); void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const int16_t *data);
void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *); void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);

View File

@ -23,7 +23,7 @@
#if HAVE_ARMV6_EXTERNAL #if HAVE_ARMV6_EXTERNAL
#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6 #define decode_block_coeffs_internal ff_decode_block_coeffs_armv6
int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16], int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, int16_t block[16],
uint8_t probs[8][3][NUM_DCT_TOKENS-1], uint8_t probs[8][3][NUM_DCT_TOKENS-1],
int i, uint8_t *token_prob, int16_t qmul[2]); int i, uint8_t *token_prob, int16_t qmul[2]);
#endif #endif

View File

@ -56,7 +56,7 @@
@ idct @ idct
@ void vp8_luma_dc_wht(DCTELEM block[4][4][16], DCTELEM dc[16]) @ void vp8_luma_dc_wht(int16_t block[4][4][16], int16_t dc[16])
function ff_vp8_luma_dc_wht_armv6, export=1 function ff_vp8_luma_dc_wht_armv6, export=1
push {r4-r10, lr} push {r4-r10, lr}
@ -179,7 +179,7 @@ function ff_vp8_luma_dc_wht_armv6, export=1
pop {r4-r10, pc} pop {r4-r10, pc}
endfunc endfunc
@ void vp8_luma_dc_wht_dc(DCTELEM block[4][4][16], DCTELEM dc[16]) @ void vp8_luma_dc_wht_dc(int16_t block[4][4][16], int16_t dc[16])
function ff_vp8_luma_dc_wht_dc_armv6, export=1 function ff_vp8_luma_dc_wht_dc_armv6, export=1
ldrsh r2, [r1] ldrsh r2, [r1]
mov r3, #0 mov r3, #0
@ -192,7 +192,7 @@ function ff_vp8_luma_dc_wht_dc_armv6, export=1
bx lr bx lr
endfunc endfunc
@ void vp8_idct_add(uint8_t *dst, DCTELEM block[16], int stride) @ void vp8_idct_add(uint8_t *dst, int16_t block[16], int stride)
function ff_vp8_idct_add_armv6, export=1 function ff_vp8_idct_add_armv6, export=1
push {r4-r12, lr} push {r4-r12, lr}
sub sp, sp, #32 sub sp, sp, #32
@ -314,7 +314,7 @@ function ff_vp8_idct_add_armv6, export=1
pop {r4-r12, pc} pop {r4-r12, pc}
endfunc endfunc
@ void vp8_idct_dc_add(uint8_t *dst, DCTELEM block[16], int stride) @ void vp8_idct_dc_add(uint8_t *dst, int16_t block[16], int stride)
function ff_vp8_idct_dc_add_armv6, export=1 function ff_vp8_idct_dc_add_armv6, export=1
push {r4-r6, lr} push {r4-r6, lr}
add r6, r0, r2, lsl #1 add r6, r0, r2, lsl #1
@ -355,7 +355,7 @@ function ff_vp8_idct_dc_add_armv6, export=1
pop {r4-r6, pc} pop {r4-r6, pc}
endfunc endfunc
@ void vp8_idct_dc_add4uv(uint8_t *dst, DCTELEM block[4][16], int stride) @ void vp8_idct_dc_add4uv(uint8_t *dst, int16_t block[4][16], int stride)
function ff_vp8_idct_dc_add4uv_armv6, export=1 function ff_vp8_idct_dc_add4uv_armv6, export=1
push {r4, lr} push {r4, lr}
@ -371,7 +371,7 @@ function ff_vp8_idct_dc_add4uv_armv6, export=1
pop {r4, pc} pop {r4, pc}
endfunc endfunc
@ void vp8_idct_dc_add4y(uint8_t *dst, DCTELEM block[4][16], int stride) @ void vp8_idct_dc_add4y(uint8_t *dst, int16_t block[4][16], int stride)
function ff_vp8_idct_dc_add4y_armv6, export=1 function ff_vp8_idct_dc_add4y_armv6, export=1
push {r4, lr} push {r4, lr}

View File

@ -22,13 +22,13 @@
#include "libavcodec/vp8dsp.h" #include "libavcodec/vp8dsp.h"
#include "vp8dsp.h" #include "vp8dsp.h"
void ff_vp8_luma_dc_wht_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]); void ff_vp8_luma_dc_wht_armv6(int16_t block[4][4][16], int16_t dc[16]);
void ff_vp8_luma_dc_wht_dc_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]); void ff_vp8_luma_dc_wht_dc_armv6(int16_t block[4][4][16], int16_t dc[16]);
void ff_vp8_idct_add_armv6(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride); void ff_vp8_idct_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
void ff_vp8_idct_dc_add_armv6(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride); void ff_vp8_idct_dc_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride); void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride); void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
VP8_LF(armv6); VP8_LF(armv6);

View File

@ -22,12 +22,12 @@
#include "libavcodec/vp8dsp.h" #include "libavcodec/vp8dsp.h"
#include "vp8dsp.h" #include "vp8dsp.h"
void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]); void ff_vp8_luma_dc_wht_neon(int16_t block[4][4][16], int16_t dc[16]);
void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride); void ff_vp8_idct_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride); void ff_vp8_idct_dc_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride); void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride); void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
VP8_LF(neon); VP8_LF(neon);

View File

@ -48,7 +48,7 @@ typedef struct ASV1Context{
int mb_height; int mb_height;
int mb_width2; int mb_width2;
int mb_height2; int mb_height2;
DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
uint16_t intra_matrix[64]; uint16_t intra_matrix[64];
int q_intra_matrix[64]; int q_intra_matrix[64];
uint8_t *bitstream_buffer; uint8_t *bitstream_buffer;

View File

@ -97,7 +97,7 @@ static inline int asv2_get_level(GetBitContext *gb)
return code - 31; return code - 31;
} }
static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]) static inline int asv1_decode_block(ASV1Context *a, int16_t block[64])
{ {
int i; int i;
@ -128,7 +128,7 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64])
return 0; return 0;
} }
static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]) static inline int asv2_decode_block(ASV1Context *a, int16_t block[64])
{ {
int i, count, ccp; int i, count, ccp;
@ -164,7 +164,7 @@ static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64])
return 0; return 0;
} }
static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]) static inline int decode_mb(ASV1Context *a, int16_t block[6][64])
{ {
int i; int i;
@ -186,7 +186,7 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64])
static inline void idct_put(ASV1Context *a, int mb_x, int mb_y) static inline void idct_put(ASV1Context *a, int mb_x, int mb_y)
{ {
DCTELEM (*block)[64] = a->block; int16_t (*block)[64] = a->block;
int linesize = a->picture.linesize[0]; int linesize = a->picture.linesize[0];
uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;

View File

@ -55,7 +55,7 @@ static inline void asv2_put_level(PutBitContext *pb, int level){
} }
} }
static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){ static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]){
int i; int i;
int nc_count=0; int nc_count=0;
@ -88,7 +88,7 @@ static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){
put_bits(&a->pb, ff_asv_ccp_tab[16][1], ff_asv_ccp_tab[16][0]); put_bits(&a->pb, ff_asv_ccp_tab[16][1], ff_asv_ccp_tab[16][0]);
} }
static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]){
int i; int i;
int count=0; int count=0;
@ -129,7 +129,7 @@ static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){
#define MAX_MB_SIZE (30*16*16*3/2/8) #define MAX_MB_SIZE (30*16*16*3/2/8)
static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]){
int i; int i;
if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < MAX_MB_SIZE) { if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < MAX_MB_SIZE) {
@ -148,7 +148,7 @@ static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){
} }
static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
DCTELEM (*block)[64]= a->block; int16_t (*block)[64]= a->block;
int linesize= a->picture.linesize[0]; int linesize= a->picture.linesize[0];
int i; int i;

View File

@ -21,7 +21,7 @@
low level assembler interface wrapper low level assembler interface wrapper
DEFUN(put_pixels_clamped,mL1, DEFUN(put_pixels_clamped,mL1,
(DCTELEM *block, uint8_t *dest, int line_size)): (int16_t *block, uint8_t *dest, int line_size)):
body body

View File

@ -27,20 +27,20 @@
int off; int off;
static void bfin_idct_add (uint8_t *dest, int line_size, DCTELEM *block) static void bfin_idct_add (uint8_t *dest, int line_size, int16_t *block)
{ {
ff_bfin_idct (block); ff_bfin_idct (block);
ff_bfin_add_pixels_clamped (block, dest, line_size); ff_bfin_add_pixels_clamped (block, dest, line_size);
} }
static void bfin_idct_put (uint8_t *dest, int line_size, DCTELEM *block) static void bfin_idct_put (uint8_t *dest, int line_size, int16_t *block)
{ {
ff_bfin_idct (block); ff_bfin_idct (block);
ff_bfin_put_pixels_clamped (block, dest, line_size); ff_bfin_put_pixels_clamped (block, dest, line_size);
} }
static void bfin_clear_blocks (DCTELEM *blocks) static void bfin_clear_blocks (int16_t *blocks)
{ {
// This is just a simple memset. // This is just a simple memset.
// //

View File

@ -24,8 +24,9 @@
#ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H #ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H
#define AVCODEC_BFIN_DSPUTIL_BFIN_H #define AVCODEC_BFIN_DSPUTIL_BFIN_H
#include <stdint.h>
#include "config.h" #include "config.h"
#include "libavcodec/dsputil.h"
#if defined(__FDPIC__) && CONFIG_SRAM #if defined(__FDPIC__) && CONFIG_SRAM
#define attribute_l1_text __attribute__ ((l1_text)) #define attribute_l1_text __attribute__ ((l1_text))
@ -35,15 +36,15 @@
#define attribute_l1_data_b #define attribute_l1_data_b
#endif #endif
void ff_bfin_idct (DCTELEM *block) attribute_l1_text; void ff_bfin_idct (int16_t *block) attribute_l1_text;
void ff_bfin_fdct (DCTELEM *block) attribute_l1_text; void ff_bfin_fdct (int16_t *block) attribute_l1_text;
void ff_bfin_vp3_idct (DCTELEM *block); void ff_bfin_vp3_idct (int16_t *block);
void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block); void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, int16_t *block);
void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block); void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, int16_t *block);
void ff_bfin_add_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text; void ff_bfin_add_pixels_clamped (const int16_t *block, uint8_t *dest, int line_size) attribute_l1_text;
void ff_bfin_put_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text; void ff_bfin_put_pixels_clamped (const int16_t *block, uint8_t *dest, int line_size) attribute_l1_text;
void ff_bfin_diff_pixels (DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride) attribute_l1_text; void ff_bfin_diff_pixels (int16_t *block, const uint8_t *s1, const uint8_t *s2, int stride) attribute_l1_text;
void ff_bfin_get_pixels (DCTELEM *restrict block, const uint8_t *pixels, int line_size) attribute_l1_text; void ff_bfin_get_pixels (int16_t *restrict block, const uint8_t *pixels, int line_size) attribute_l1_text;
int ff_bfin_pix_norm1 (uint8_t * pix, int line_size) attribute_l1_text; int ff_bfin_pix_norm1 (uint8_t * pix, int line_size) attribute_l1_text;
int ff_bfin_z_sad8x8 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text; int ff_bfin_z_sad8x8 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;
int ff_bfin_z_sad16x16 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text; int ff_bfin_z_sad16x16 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/* /*
void ff_bfin_fdct (DCTELEM *buf); void ff_bfin_fdct (int16_t *buf);
This implementation works only for 8x8 input. The range of input This implementation works only for 8x8 input. The range of input
must be -256 to 255 i.e. 8bit input represented in a 16bit data must be -256 to 255 i.e. 8bit input represented in a 16bit data
@ -61,9 +61,9 @@ Notation
Other registers used: Other registers used:
I0, I1, I2, I3, B0, B2, B3, M0, M1, L3 registers and LC0. I0, I1, I2, I3, B0, B2, B3, M0, M1, L3 registers and LC0.
Input - r0 - pointer to start of DCTELEM *block Input - r0 - pointer to start of int16_t *block
Output - The DCT output coefficients in the DCTELEM *block Output - The DCT output coefficients in the int16_t *block
Register constraint: Register constraint:
This code is called from jpeg_encode. This code is called from jpeg_encode.
@ -145,7 +145,7 @@ vtmp: .space 128
.text .text
DEFUN(fdct,mL1, DEFUN(fdct,mL1,
(DCTELEM *block)): (int16_t *block)):
[--SP] = (R7:4, P5:3); // Push the registers onto the stack. [--SP] = (R7:4, P5:3); // Push the registers onto the stack.
b0 = r0; b0 = r0;

View File

@ -22,7 +22,7 @@
/* /*
This blackfin DSP code implements an 8x8 inverse type II DCT. This blackfin DSP code implements an 8x8 inverse type II DCT.
Prototype : void ff_bfin_idct(DCTELEM *in) Prototype : void ff_bfin_idct(int16_t *in)
Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0. Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0.
@ -90,7 +90,7 @@ vtmp: .space 256
.text .text
DEFUN(idct,mL1, DEFUN(idct,mL1,
(DCTELEM *block)): (int16_t *block)):
/********************** Function Prologue *********************************/ /********************** Function Prologue *********************************/
link 16; link 16;

View File

@ -26,7 +26,7 @@
#include "dsputil_bfin.h" #include "dsputil_bfin.h"
static int dct_quantize_bfin (MpegEncContext *s, static int dct_quantize_bfin (MpegEncContext *s,
DCTELEM *block, int n, int16_t *block, int n,
int qscale, int *overflow) int qscale, int *overflow)
{ {
int last_non_zero, q, start_i; int last_non_zero, q, start_i;

View File

@ -21,7 +21,7 @@
#include "config_bfin.h" #include "config_bfin.h"
DEFUN(put_pixels_clamped,mL1, DEFUN(put_pixels_clamped,mL1,
(DCTELEM *block, uint8_t *dest, int line_size)): (int16_t *block, uint8_t *dest, int line_size)):
[--SP] = (R7:4); [--SP] = (R7:4);
R4 = 0; R4 = 0;
R5.l = 0x00ff; R5.l = 0x00ff;
@ -51,7 +51,7 @@ ppc$1: R2 = Max(R0, R4) (V) || [I1++M1] = R6;
DEFUN_END(put_pixels_clamped) DEFUN_END(put_pixels_clamped)
DEFUN(add_pixels_clamped,mL1, DEFUN(add_pixels_clamped,mL1,
(DCTELEM *block, uint8_t *dest, int line_size)): (int16_t *block, uint8_t *dest, int line_size)):
[-- SP] = (R7:4); [-- SP] = (R7:4);
R4 = 0; R4 = 0;
I0 = 0; I0 = 0;
@ -442,7 +442,7 @@ LE$8OT: DISALGNEXCPT || R2 =[I1++] || [I3++M2] = R5;
rts; rts;
DEFUN(diff_pixels,mL1, DEFUN(diff_pixels,mL1,
(DCTELEM *block, uint8_t *s1, uint8_t *s2, int stride)): (int16_t *block, uint8_t *s1, uint8_t *s2, int stride)):
link 0; link 0;
[--sp] = (r7:4); [--sp] = (r7:4);
p0=8; p0=8;
@ -518,7 +518,7 @@ DEFUN_END(pix_sum)
DEFUN(get_pixels,mL1, DEFUN(get_pixels,mL1,
(DCTELEM *restrict block, const uint8_t *pixels, int line_size)): (int16_t *restrict block, const uint8_t *pixels, int line_size)):
[--sp] = (r7:4); [--sp] = (r7:4);
i3=r0; // dest i3=r0; // dest
i0=r1; // src0 i0=r1; // src0

View File

@ -23,7 +23,7 @@
#include "dsputil_bfin.h" #include "dsputil_bfin.h"
/* Intra iDCT offset 128 */ /* Intra iDCT offset 128 */
void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block) void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, int16_t *block)
{ {
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + 128; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + 128;
int i,j; int i,j;
@ -36,7 +36,7 @@ void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
} }
/* Inter iDCT */ /* Inter iDCT */
void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block) void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, int16_t *block)
{ {
ff_bfin_vp3_idct (block); ff_bfin_vp3_idct (block);
ff_bfin_add_pixels_clamped (block, dest, line_size); ff_bfin_add_pixels_clamped (block, dest, line_size);

View File

@ -22,7 +22,7 @@
/* /*
This blackfin DSP code implements an 8x8 inverse type II DCT. This blackfin DSP code implements an 8x8 inverse type II DCT.
Prototype : void ff_bfin_vp3_idct(DCTELEM *in) Prototype : void ff_bfin_vp3_idct(int16_t *in)
Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0. Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0.
@ -63,7 +63,7 @@ vtmp: .space 256
.text .text
DEFUN(vp3_idct,mL1, DEFUN(vp3_idct,mL1,
(DCTELEM *block)): (int16_t *block)):
/********************** Function Prologue *********************************/ /********************** Function Prologue *********************************/
link 16; link 16;

View File

@ -696,7 +696,7 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
* @param masks_count number of masks to decode * @param masks_count number of masks to decode
* @return 0 on success, negative value in other cases * @return 0 on success, negative value in other cases
*/ */
static int read_residue(GetBitContext *gb, DCTELEM block[64], int masks_count) static int read_residue(GetBitContext *gb, int16_t block[64], int masks_count)
{ {
int coef_list[128]; int coef_list[128];
int mode_list[128]; int mode_list[128];
@ -800,7 +800,7 @@ static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
int v, col[2]; int v, col[2];
const uint8_t *scan; const uint8_t *scan;
int xoff, yoff; int xoff, yoff;
LOCAL_ALIGNED_16(DCTELEM, block, [64]); LOCAL_ALIGNED_16(int16_t, block, [64]);
LOCAL_ALIGNED_16(int32_t, dctblock, [64]); LOCAL_ALIGNED_16(int32_t, dctblock, [64]);
int coordmap[64]; int coordmap[64];
int ybias = is_key ? -15 : 0; int ybias = is_key ? -15 : 0;
@ -946,7 +946,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
int v, col[2]; int v, col[2];
const uint8_t *scan; const uint8_t *scan;
int xoff, yoff; int xoff, yoff;
LOCAL_ALIGNED_16(DCTELEM, block, [64]); LOCAL_ALIGNED_16(int16_t, block, [64]);
LOCAL_ALIGNED_16(uint8_t, ublock, [64]); LOCAL_ALIGNED_16(uint8_t, ublock, [64]);
LOCAL_ALIGNED_16(int32_t, dctblock, [64]); LOCAL_ALIGNED_16(int32_t, dctblock, [64]);
int coordmap[64]; int coordmap[64];

View File

@ -713,7 +713,7 @@ void ff_cavs_init_top_lines(AVSContext *h) {
/* alloc space for co-located MVs and types */ /* alloc space for co-located MVs and types */
h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector)); h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector));
h->col_type_base = av_malloc(h->mb_width*h->mb_height); h->col_type_base = av_malloc(h->mb_width*h->mb_height);
h->block = av_mallocz(64*sizeof(DCTELEM)); h->block = av_mallocz(64*sizeof(int16_t));
} }
av_cold int ff_cavs_init(AVCodecContext *avctx) { av_cold int ff_cavs_init(AVCodecContext *avctx) {

View File

@ -234,7 +234,7 @@ typedef struct AVSContext {
uint8_t *edge_emu_buffer; uint8_t *edge_emu_buffer;
int got_keyframe; int got_keyframe;
DCTELEM *block; int16_t *block;
} AVSContext; } AVSContext;
extern const uint8_t ff_cavs_partition_flags[30]; extern const uint8_t ff_cavs_partition_flags[30];

View File

@ -516,8 +516,8 @@ static inline int get_ue_code(GetBitContext *gb, int order)
return get_ue_golomb(gb); return get_ue_golomb(gb);
} }
static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf, static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
DCTELEM *dst, int mul, int shift, int coeff_num) int16_t *dst, int mul, int shift, int coeff_num)
{ {
int round = 1 << (shift - 1); int round = 1 << (shift - 1);
int pos = -1; int pos = -1;
@ -551,9 +551,9 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
int qp, uint8_t *dst, int stride) int qp, uint8_t *dst, int stride)
{ {
int i, level_code, esc_code, level, run, mask; int i, level_code, esc_code, level, run, mask;
DCTELEM level_buf[65]; int16_t level_buf[65];
uint8_t run_buf[65]; uint8_t run_buf[65];
DCTELEM *block = h->block; int16_t *block = h->block;
for (i = 0;i < 65; i++) { for (i = 0;i < 65; i++) {
level_code = get_ue_code(gb, r->golomb_order); level_code = get_ue_code(gb, r->golomb_order);

View File

@ -183,9 +183,9 @@ static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc
* *
****************************************************************************/ ****************************************************************************/
static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
int i; int i;
DCTELEM (*src)[8] = (DCTELEM(*)[8])block; int16_t (*src)[8] = (int16_t(*)[8])block;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src[0][0] += 8; src[0][0] += 8;

View File

@ -32,7 +32,7 @@ typedef struct CAVSDSPContext {
void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); void (*cavs_idct8_add)(uint8_t *dst, int16_t *block, int stride);
int idct_perm; int idct_perm;
} CAVSDSPContext; } CAVSDSPContext;

View File

@ -39,6 +39,7 @@
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
#include "libavutil/time.h" #include "libavutil/time.h"
#include "dsputil.h"
#include "simple_idct.h" #include "simple_idct.h"
#include "aandcttab.h" #include "aandcttab.h"
#include "faandct.h" #include "faandct.h"
@ -49,24 +50,24 @@
#undef printf #undef printf
// BFIN // BFIN
void ff_bfin_idct(DCTELEM *block); void ff_bfin_idct(int16_t *block);
void ff_bfin_fdct(DCTELEM *block); void ff_bfin_fdct(int16_t *block);
// ALTIVEC // ALTIVEC
void ff_fdct_altivec(DCTELEM *block); void ff_fdct_altivec(int16_t *block);
// ARM // ARM
void ff_j_rev_dct_arm(DCTELEM *data); void ff_j_rev_dct_arm(int16_t *data);
void ff_simple_idct_arm(DCTELEM *data); void ff_simple_idct_arm(int16_t *data);
void ff_simple_idct_armv5te(DCTELEM *data); void ff_simple_idct_armv5te(int16_t *data);
void ff_simple_idct_armv6(DCTELEM *data); void ff_simple_idct_armv6(int16_t *data);
void ff_simple_idct_neon(DCTELEM *data); void ff_simple_idct_neon(int16_t *data);
void ff_simple_idct_axp(DCTELEM *data); void ff_simple_idct_axp(int16_t *data);
struct algo { struct algo {
const char *name; const char *name;
void (*func)(DCTELEM *block); void (*func)(int16_t *block);
enum formattag { NO_PERM, MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM, enum formattag { NO_PERM, MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM,
SSE2_PERM, PARTTRANS_PERM } format; SSE2_PERM, PARTTRANS_PERM } format;
int mm_support; int mm_support;
@ -166,10 +167,10 @@ static void idct_mmx_init(void)
} }
} }
DECLARE_ALIGNED(16, static DCTELEM, block)[64]; DECLARE_ALIGNED(16, static int16_t, block)[64];
DECLARE_ALIGNED(8, static DCTELEM, block1)[64]; DECLARE_ALIGNED(8, static int16_t, block1)[64];
static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng) static void init_block(int16_t block[64], int test, int is_idct, AVLFG *prng)
{ {
int i, j; int i, j;
@ -197,7 +198,7 @@ static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng)
} }
} }
static void permute(DCTELEM dst[64], const DCTELEM src[64], int perm) static void permute(int16_t dst[64], const int16_t src[64], int perm)
{ {
int i; int i;
@ -221,7 +222,7 @@ static void permute(DCTELEM dst[64], const DCTELEM src[64], int perm)
static int dct_error(const struct algo *dct, int test, int is_idct, int speed) static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
{ {
void (*ref)(DCTELEM *block) = is_idct ? ff_ref_idct : ff_ref_fdct; void (*ref)(int16_t *block) = is_idct ? ff_ref_idct : ff_ref_fdct;
int it, i, scale; int it, i, scale;
int err_inf, v; int err_inf, v;
int64_t err2, ti, ti1, it1, err_sum = 0; int64_t err2, ti, ti1, it1, err_sum = 0;

View File

@ -44,19 +44,19 @@ typedef struct DNXHDContext {
VLC ac_vlc, dc_vlc, run_vlc; VLC ac_vlc, dc_vlc, run_vlc;
int last_dc[3]; int last_dc[3];
DSPContext dsp; DSPContext dsp;
DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64]; DECLARE_ALIGNED(16, int16_t, blocks)[8][64];
ScanTable scantable; ScanTable scantable;
const CIDEntry *cid_table; const CIDEntry *cid_table;
int bit_depth; // 8, 10 or 0 if not initialized at all. int bit_depth; // 8, 10 or 0 if not initialized at all.
void (*decode_dct_block)(struct DNXHDContext *ctx, DCTELEM *block, void (*decode_dct_block)(struct DNXHDContext *ctx, int16_t *block,
int n, int qscale); int n, int qscale);
} DNXHDContext; } DNXHDContext;
#define DNXHD_VLC_BITS 9 #define DNXHD_VLC_BITS 9
#define DNXHD_DC_VLC_BITS 7 #define DNXHD_DC_VLC_BITS 7
static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, DCTELEM *block, int n, int qscale); static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block, int n, int qscale);
static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, DCTELEM *block, int n, int qscale); static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block, int n, int qscale);
static av_cold int dnxhd_decode_init(AVCodecContext *avctx) static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
{ {
@ -180,7 +180,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
} }
static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
DCTELEM *block, int n, int16_t *block, int n,
int qscale, int qscale,
int index_bits, int index_bits,
int level_bias, int level_bias,
@ -250,13 +250,13 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
CLOSE_READER(bs, &ctx->gb); CLOSE_READER(bs, &ctx->gb);
} }
static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, DCTELEM *block, static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block,
int n, int qscale) int n, int qscale)
{ {
dnxhd_decode_dct_block(ctx, block, n, qscale, 4, 32, 6); dnxhd_decode_dct_block(ctx, block, n, qscale, 4, 32, 6);
} }
static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, DCTELEM *block, static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block,
int n, int qscale) int n, int qscale)
{ {
dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 8, 4); dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 8, 4);

View File

@ -44,7 +44,7 @@ static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL
#define LAMBDA_FRAC_BITS 10 #define LAMBDA_FRAC_BITS 10
static void dnxhd_8bit_get_pixels_8x4_sym(DCTELEM *restrict block, const uint8_t *pixels, int line_size) static void dnxhd_8bit_get_pixels_8x4_sym(int16_t *restrict block, const uint8_t *pixels, int line_size)
{ {
int i; int i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
@ -61,7 +61,7 @@ static void dnxhd_8bit_get_pixels_8x4_sym(DCTELEM *restrict block, const uint8_t
memcpy(block + 24, block - 32, sizeof(*block) * 8); memcpy(block + 24, block - 32, sizeof(*block) * 8);
} }
static av_always_inline void dnxhd_10bit_get_pixels_8x4_sym(DCTELEM *restrict block, const uint8_t *pixels, int line_size) static av_always_inline void dnxhd_10bit_get_pixels_8x4_sym(int16_t *restrict block, const uint8_t *pixels, int line_size)
{ {
int i; int i;
@ -73,7 +73,7 @@ static av_always_inline void dnxhd_10bit_get_pixels_8x4_sym(DCTELEM *restrict bl
} }
} }
static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, DCTELEM *block, static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
int n, int qscale, int *overflow) int n, int qscale, int *overflow)
{ {
const uint8_t *scantable= ctx->intra_scantable.scantable; const uint8_t *scantable= ctx->intra_scantable.scantable;
@ -370,7 +370,7 @@ static av_always_inline void dnxhd_encode_dc(DNXHDEncContext *ctx, int diff)
(ctx->cid_table->dc_codes[nbits]<<nbits) + (diff & ((1 << nbits) - 1))); (ctx->cid_table->dc_codes[nbits]<<nbits) + (diff & ((1 << nbits) - 1)));
} }
static av_always_inline void dnxhd_encode_block(DNXHDEncContext *ctx, DCTELEM *block, int last_index, int n) static av_always_inline void dnxhd_encode_block(DNXHDEncContext *ctx, int16_t *block, int last_index, int n)
{ {
int last_non_zero = 0; int last_non_zero = 0;
int slevel, i, j; int slevel, i, j;
@ -393,7 +393,7 @@ static av_always_inline void dnxhd_encode_block(DNXHDEncContext *ctx, DCTELEM *b
put_bits(&ctx->m.pb, ctx->vlc_bits[0], ctx->vlc_codes[0]); // EOB put_bits(&ctx->m.pb, ctx->vlc_bits[0], ctx->vlc_codes[0]); // EOB
} }
static av_always_inline void dnxhd_unquantize_c(DNXHDEncContext *ctx, DCTELEM *block, int n, int qscale, int last_index) static av_always_inline void dnxhd_unquantize_c(DNXHDEncContext *ctx, int16_t *block, int n, int qscale, int last_index)
{ {
const uint8_t *weight_matrix; const uint8_t *weight_matrix;
int level; int level;
@ -434,7 +434,7 @@ static av_always_inline void dnxhd_unquantize_c(DNXHDEncContext *ctx, DCTELEM *b
} }
} }
static av_always_inline int dnxhd_ssd_block(DCTELEM *qblock, DCTELEM *block) static av_always_inline int dnxhd_ssd_block(int16_t *qblock, int16_t *block)
{ {
int score = 0; int score = 0;
int i; int i;
@ -443,7 +443,7 @@ static av_always_inline int dnxhd_ssd_block(DCTELEM *qblock, DCTELEM *block)
return score; return score;
} }
static av_always_inline int dnxhd_calc_ac_bits(DNXHDEncContext *ctx, DCTELEM *block, int last_index) static av_always_inline int dnxhd_calc_ac_bits(DNXHDEncContext *ctx, int16_t *block, int last_index)
{ {
int last_non_zero = 0; int last_non_zero = 0;
int bits = 0; int bits = 0;
@ -512,7 +512,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
DNXHDEncContext *ctx = avctx->priv_data; DNXHDEncContext *ctx = avctx->priv_data;
int mb_y = jobnr, mb_x; int mb_y = jobnr, mb_x;
int qscale = ctx->qscale; int qscale = ctx->qscale;
LOCAL_ALIGNED_16(DCTELEM, block, [64]); LOCAL_ALIGNED_16(int16_t, block, [64]);
ctx = ctx->thread[threadnr]; ctx = ctx->thread[threadnr];
ctx->m.last_dc[0] = ctx->m.last_dc[0] =
@ -529,7 +529,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
dnxhd_get_blocks(ctx, mb_x, mb_y); dnxhd_get_blocks(ctx, mb_x, mb_y);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
DCTELEM *src_block = ctx->blocks[i]; int16_t *src_block = ctx->blocks[i];
int overflow, nbits, diff, last_index; int overflow, nbits, diff, last_index;
int n = dnxhd_switch_matrix(ctx, i); int n = dnxhd_switch_matrix(ctx, i);
@ -578,7 +578,7 @@ static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg, int jobnr, int
dnxhd_get_blocks(ctx, mb_x, mb_y); dnxhd_get_blocks(ctx, mb_x, mb_y);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
DCTELEM *block = ctx->blocks[i]; int16_t *block = ctx->blocks[i];
int overflow, n = dnxhd_switch_matrix(ctx, i); int overflow, n = dnxhd_switch_matrix(ctx, i);
int last_index = ctx->m.dct_quantize(&ctx->m, block, i, int last_index = ctx->m.dct_quantize(&ctx->m, block, i,
qscale, &overflow); qscale, &overflow);

View File

@ -64,7 +64,7 @@ typedef struct DNXHDEncContext {
int nitris_compat; int nitris_compat;
unsigned min_padding; unsigned min_padding;
DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64]; DECLARE_ALIGNED(16, int16_t, blocks)[8][64];
int (*qmatrix_c) [64]; int (*qmatrix_c) [64];
int (*qmatrix_l) [64]; int (*qmatrix_l) [64];
@ -92,7 +92,7 @@ typedef struct DNXHDEncContext {
RCCMPEntry *mb_cmp; RCCMPEntry *mb_cmp;
RCEntry (*mb_rc)[8160]; RCEntry (*mb_rc)[8160];
void (*get_pixels_8x4_sym)(DCTELEM * /*align 16*/, const uint8_t *, int); void (*get_pixels_8x4_sym)(int16_t * /*align 16*/, const uint8_t *, int);
} DNXHDEncContext; } DNXHDEncContext;
void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx); void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx);

View File

@ -336,7 +336,7 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
return s; return s;
} }
static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1, static void diff_pixels_c(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, int stride){ const uint8_t *s2, int stride){
int i; int i;
@ -357,7 +357,7 @@ static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
} }
static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, static void put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
int line_size) int line_size)
{ {
int i; int i;
@ -378,7 +378,7 @@ static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
} }
} }
static void put_signed_pixels_clamped_c(const DCTELEM *block, static void put_signed_pixels_clamped_c(const int16_t *block,
uint8_t *restrict pixels, uint8_t *restrict pixels,
int line_size) int line_size)
{ {
@ -399,7 +399,7 @@ static void put_signed_pixels_clamped_c(const DCTELEM *block,
} }
} }
static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, static void add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
int line_size) int line_size)
{ {
int i; int i;
@ -419,7 +419,7 @@ static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
} }
} }
static int sum_abs_dctelem_c(DCTELEM *block) static int sum_abs_dctelem_c(int16_t *block)
{ {
int sum=0, i; int sum=0, i;
for(i=0; i<64; i++) for(i=0; i<64; i++)
@ -1712,10 +1712,10 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){
* @param scantable the used scantable, this is only used to speed the permutation up, the block is not * @param scantable the used scantable, this is only used to speed the permutation up, the block is not
* (inverse) permutated to scantable order! * (inverse) permutated to scantable order!
*/ */
void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last) void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last)
{ {
int i; int i;
DCTELEM temp[64]; int16_t temp[64];
if(last<=0) return; if(last<=0) return;
//if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations //if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations
@ -2030,7 +2030,7 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_
static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
LOCAL_ALIGNED_16(DCTELEM, temp, [64]); LOCAL_ALIGNED_16(int16_t, temp, [64]);
assert(h==8); assert(h==8);
@ -2069,7 +2069,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
DCTELEM dct[8][8]; int16_t dct[8][8];
int i; int i;
int sum=0; int sum=0;
@ -2094,7 +2094,7 @@ static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
LOCAL_ALIGNED_16(DCTELEM, temp, [64]); LOCAL_ALIGNED_16(int16_t, temp, [64]);
int sum=0, i; int sum=0, i;
assert(h==8); assert(h==8);
@ -2110,8 +2110,8 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
LOCAL_ALIGNED_16(DCTELEM, temp, [64*2]); LOCAL_ALIGNED_16(int16_t, temp, [64*2]);
DCTELEM * const bak = temp+64; int16_t * const bak = temp+64;
int sum=0, i; int sum=0, i;
assert(h==8); assert(h==8);
@ -2119,7 +2119,7 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
s->dsp.diff_pixels(temp, src1, src2, stride); s->dsp.diff_pixels(temp, src1, src2, stride);
memcpy(bak, temp, 64*sizeof(DCTELEM)); memcpy(bak, temp, 64*sizeof(int16_t));
s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
s->dct_unquantize_inter(s, temp, 0, s->qscale); s->dct_unquantize_inter(s, temp, 0, s->qscale);
@ -2134,7 +2134,7 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
const uint8_t *scantable= s->intra_scantable.permutated; const uint8_t *scantable= s->intra_scantable.permutated;
LOCAL_ALIGNED_16(DCTELEM, temp, [64]); LOCAL_ALIGNED_16(int16_t, temp, [64]);
LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]); LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]);
LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]); LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]);
int i, last, run, bits, level, distortion, start_i; int i, last, run, bits, level, distortion, start_i;
@ -2210,7 +2210,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int
static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
MpegEncContext * const s= (MpegEncContext *)c; MpegEncContext * const s= (MpegEncContext *)c;
const uint8_t *scantable= s->intra_scantable.permutated; const uint8_t *scantable= s->intra_scantable.permutated;
LOCAL_ALIGNED_16(DCTELEM, temp, [64]); LOCAL_ALIGNED_16(int16_t, temp, [64]);
int i, last, run, bits, level, start_i; int i, last, run, bits, level, start_i;
const int esc_length= s->ac_esc_length; const int esc_length= s->ac_esc_length;
uint8_t * length; uint8_t * length;
@ -2447,12 +2447,12 @@ static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min,
} while (len > 0); } while (len > 0);
} }
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) static void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_j_rev_dct (block); ff_j_rev_dct (block);
put_pixels_clamped_c(block, dest, line_size); put_pixels_clamped_c(block, dest, line_size);
} }
static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) static void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
{ {
ff_j_rev_dct (block); ff_j_rev_dct (block);
add_pixels_clamped_c(block, dest, line_size); add_pixels_clamped_c(block, dest, line_size);

View File

@ -36,41 +36,40 @@
//#define DEBUG //#define DEBUG
/* dct code */ /* dct code */
typedef short DCTELEM;
void ff_fdct_ifast (DCTELEM *data); void ff_fdct_ifast(int16_t *data);
void ff_fdct_ifast248 (DCTELEM *data); void ff_fdct_ifast248(int16_t *data);
void ff_jpeg_fdct_islow_8(DCTELEM *data); void ff_jpeg_fdct_islow_8(int16_t *data);
void ff_jpeg_fdct_islow_10(DCTELEM *data); void ff_jpeg_fdct_islow_10(int16_t *data);
void ff_fdct248_islow_8(DCTELEM *data); void ff_fdct248_islow_8(int16_t *data);
void ff_fdct248_islow_10(DCTELEM *data); void ff_fdct248_islow_10(int16_t *data);
void ff_j_rev_dct (DCTELEM *data); void ff_j_rev_dct(int16_t *data);
void ff_fdct_mmx(DCTELEM *block); void ff_fdct_mmx(int16_t *block);
void ff_fdct_mmxext(DCTELEM *block); void ff_fdct_mmxext(int16_t *block);
void ff_fdct_sse2(DCTELEM *block); void ff_fdct_sse2(int16_t *block);
#define H264_IDCT(depth) \ #define H264_IDCT(depth) \
void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\ void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\ void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\ void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\ void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\
void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\ void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\ void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\ void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\ void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\ void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\
void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(DCTELEM *output, DCTELEM *input, int qmul);\ void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(int16_t *output, int16_t *input, int qmul);\
void ff_h264_chroma422_dc_dequant_idct_ ## depth ## _c(DCTELEM *block, int qmul);\ void ff_h264_chroma422_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul);\
void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(DCTELEM *block, int qmul); void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul);
H264_IDCT( 8) H264_IDCT( 8)
H264_IDCT( 9) H264_IDCT( 9)
H264_IDCT(10) H264_IDCT(10)
void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); void ff_svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp);
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); void ff_svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc);
/* encoding scans */ /* encoding scans */
extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_horizontal_scan[64];
@ -128,11 +127,11 @@ could be reached easily ...
*/ */
/* /*
void get_pixels_c(DCTELEM *block, const uint8_t *pixels, int line_size); void get_pixels_c(int16_t *block, const uint8_t *pixels, int line_size);
void diff_pixels_c(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride); void diff_pixels_c(int16_t *block, const uint8_t *s1, const uint8_t *s2, int stride);
void put_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size); void put_pixels_clamped_c(const int16_t *block, uint8_t *pixels, int line_size);
void add_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size); void add_pixels_clamped_c(const int16_t *block, uint8_t *pixels, int line_size);
void clear_blocks_c(DCTELEM *blocks); void clear_blocks_c(int16_t *blocks);
*/ */
/* add and put pixel (decoding) */ /* add and put pixel (decoding) */
@ -197,14 +196,14 @@ typedef struct DSPContext {
int dct_bits; int dct_bits;
/* pixel ops : interface with DCT */ /* pixel ops : interface with DCT */
void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size); void (*get_pixels)(int16_t *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride); void (*diff_pixels)(int16_t *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); void (*put_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); void (*put_signed_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); void (*add_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size); void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size);
void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size); void (*add_pixels4)(uint8_t *pixels, int16_t *block, int line_size);
int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/); int (*sum_abs_dctelem)(int16_t *block/*align 16*/);
/** /**
* translational global motion compensation. * translational global motion compensation.
*/ */
@ -214,8 +213,8 @@ typedef struct DSPContext {
*/ */
void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy, void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
void (*clear_block)(DCTELEM *block/*align 16*/); void (*clear_block)(int16_t *block/*align 16*/);
void (*clear_blocks)(DCTELEM *blocks/*align 16*/); void (*clear_blocks)(int16_t *blocks/*align 16*/);
int (*pix_sum)(uint8_t * pix, int line_size); int (*pix_sum)(uint8_t * pix, int line_size);
int (*pix_norm1)(uint8_t * pix, int line_size); int (*pix_norm1)(uint8_t * pix, int line_size);
// 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4 // 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4
@ -344,24 +343,24 @@ typedef struct DSPContext {
void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
/* (I)DCT */ /* (I)DCT */
void (*fdct)(DCTELEM *block/* align 16*/); void (*fdct)(int16_t *block/* align 16*/);
void (*fdct248)(DCTELEM *block/* align 16*/); void (*fdct248)(int16_t *block/* align 16*/);
/* IDCT really*/ /* IDCT really*/
void (*idct)(DCTELEM *block/* align 16*/); void (*idct)(int16_t *block/* align 16*/);
/** /**
* block -> idct -> clip to unsigned 8 bit -> dest. * block -> idct -> clip to unsigned 8 bit -> dest.
* (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
* @param line_size size in bytes of a horizontal line of dest * @param line_size size in bytes of a horizontal line of dest
*/ */
void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/);
/** /**
* block -> idct -> add dest -> clip to unsigned 8 bit -> dest. * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
* @param line_size size in bytes of a horizontal line of dest * @param line_size size in bytes of a horizontal line of dest
*/ */
void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/);
/** /**
* idct input permutation. * idct input permutation.
@ -451,7 +450,7 @@ int ff_check_alignment(void);
* 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(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last); void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last);
void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type); void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);

View File

@ -114,7 +114,7 @@ static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, i
} }
#define DCTELEM_FUNCS(dctcoef, suffix) \ #define DCTELEM_FUNCS(dctcoef, suffix) \
static void FUNCC(get_pixels ## suffix)(DCTELEM *restrict _block, \ static void FUNCC(get_pixels ## suffix)(int16_t *restrict _block, \
const uint8_t *_pixels, \ const uint8_t *_pixels, \
int line_size) \ int line_size) \
{ \ { \
@ -138,7 +138,7 @@ static void FUNCC(get_pixels ## suffix)(DCTELEM *restrict _block, \
} \ } \
\ \
static void FUNCC(add_pixels8 ## suffix)(uint8_t *restrict _pixels, \ static void FUNCC(add_pixels8 ## suffix)(uint8_t *restrict _pixels, \
DCTELEM *_block, \ int16_t *_block, \
int line_size) \ int line_size) \
{ \ { \
int i; \ int i; \
@ -161,7 +161,7 @@ static void FUNCC(add_pixels8 ## suffix)(uint8_t *restrict _pixels, \
} \ } \
\ \
static void FUNCC(add_pixels4 ## suffix)(uint8_t *restrict _pixels, \ static void FUNCC(add_pixels4 ## suffix)(uint8_t *restrict _pixels, \
DCTELEM *_block, \ int16_t *_block, \
int line_size) \ int line_size) \
{ \ { \
int i; \ int i; \
@ -179,20 +179,20 @@ static void FUNCC(add_pixels4 ## suffix)(uint8_t *restrict _pixels, \
} \ } \
} \ } \
\ \
static void FUNCC(clear_block ## suffix)(DCTELEM *block) \ static void FUNCC(clear_block ## suffix)(int16_t *block) \
{ \ { \
memset(block, 0, sizeof(dctcoef)*64); \ memset(block, 0, sizeof(dctcoef)*64); \
} \ } \
\ \
/** \ /** \
* memset(blocks, 0, sizeof(DCTELEM)*6*64) \ * memset(blocks, 0, sizeof(int16_t)*6*64) \
*/ \ */ \
static void FUNCC(clear_blocks ## suffix)(DCTELEM *blocks) \ static void FUNCC(clear_blocks ## suffix)(int16_t *blocks) \
{ \ { \
memset(blocks, 0, sizeof(dctcoef)*6*64); \ memset(blocks, 0, sizeof(dctcoef)*6*64); \
} }
DCTELEM_FUNCS(DCTELEM, _16) DCTELEM_FUNCS(int16_t, _16)
#if BIT_DEPTH > 8 #if BIT_DEPTH > 8
DCTELEM_FUNCS(dctcoef, _32) DCTELEM_FUNCS(dctcoef, _32)
#endif #endif

View File

@ -406,7 +406,7 @@ typedef struct EncBlockInfo {
int cur_ac; int cur_ac;
int cno; int cno;
int dct_mode; int dct_mode;
DCTELEM mb[64]; int16_t mb[64];
uint8_t next[64]; uint8_t next[64];
uint8_t sign[64]; uint8_t sign[64];
uint8_t partial_bit_count; uint8_t partial_bit_count;
@ -495,7 +495,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
{ {
const int *weight; const int *weight;
const uint8_t* zigzag_scan; const uint8_t* zigzag_scan;
LOCAL_ALIGNED_16(DCTELEM, blk, [64]); LOCAL_ALIGNED_16(int16_t, blk, [64]);
int i, area; int i, area;
/* We offer two different methods for class number assignment: the /* We offer two different methods for class number assignment: the
method suggested in SMPTE 314M Table 22, and an improved method suggested in SMPTE 314M Table 22, and an improved

View File

@ -40,9 +40,9 @@ typedef struct DVVideoContext {
uint8_t dv_zigzag[2][64]; uint8_t dv_zigzag[2][64];
void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size); void (*get_pixels)(int16_t *block, const uint8_t *pixels, int line_size);
void (*fdct[2])(DCTELEM *block); void (*fdct[2])(int16_t *block);
void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block); void (*idct_put[2])(uint8_t *dest, int line_size, int16_t *block);
me_cmp_func ildct_cmp; me_cmp_func ildct_cmp;
} DVVideoContext; } DVVideoContext;

View File

@ -48,7 +48,7 @@ typedef struct BlockInfo {
const uint32_t *factor_table; const uint32_t *factor_table;
const uint8_t *scan_table; const uint8_t *scan_table;
uint8_t pos; /* position in block */ uint8_t pos; /* position in block */
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block); void (*idct_put)(uint8_t *dest, int line_size, int16_t *block);
uint8_t partial_bit_count; uint8_t partial_bit_count;
uint32_t partial_bit_buffer; uint32_t partial_bit_buffer;
int shift_offset; int shift_offset;
@ -57,7 +57,7 @@ typedef struct BlockInfo {
static const int dv_iweight_bits = 14; static const int dv_iweight_bits = 14;
/* decode AC coefficients */ /* decode AC coefficients */
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, int16_t *block)
{ {
int last_index = gb->size_in_bits; int last_index = gb->size_in_bits;
const uint8_t *scan_table = mb->scan_table; const uint8_t *scan_table = mb->scan_table;
@ -135,14 +135,14 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
int quant, dc, dct_mode, class1, j; int quant, dc, dct_mode, class1, j;
int mb_index, mb_x, mb_y, last_index; int mb_index, mb_x, mb_y, last_index;
int y_stride, linesize; int y_stride, linesize;
DCTELEM *block, *block1; int16_t *block, *block1;
int c_offset; int c_offset;
uint8_t *y_ptr; uint8_t *y_ptr;
const uint8_t *buf_ptr; const uint8_t *buf_ptr;
PutBitContext pb, vs_pb; PutBitContext pb, vs_pb;
GetBitContext gb; GetBitContext gb;
BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1; BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]); LOCAL_ALIGNED_16(int16_t, sblock, [5*DV_MAX_BPM], [64]);
LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
const int log2_blocksize = 3; const int log2_blocksize = 3;

View File

@ -64,7 +64,7 @@
#define MUNGE_8BIT(x) av_clip_uint8((x)>>4) #define MUNGE_8BIT(x) av_clip_uint8((x)>>4)
#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_8BIT,src) #define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_8BIT,src)
static inline void ea_idct_col(DCTELEM *dest, const DCTELEM *src) { static inline void ea_idct_col(int16_t *dest, const int16_t *src) {
if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) { if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) {
dest[0] = dest[0] =
dest[8] = dest[8] =
@ -78,9 +78,9 @@ static inline void ea_idct_col(DCTELEM *dest, const DCTELEM *src) {
IDCT_COL(dest, src); IDCT_COL(dest, src);
} }
void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block) { void ff_ea_idct_put_c(uint8_t *dest, int linesize, int16_t *block) {
int i; int i;
DCTELEM temp[64]; int16_t temp[64];
block[0] += 4; block[0] += 4;
for (i=0; i<8; i++) for (i=0; i<8; i++)
ea_idct_col(&temp[i], &block[i]); ea_idct_col(&temp[i], &block[i]);

View File

@ -20,8 +20,7 @@
#define AVCODEC_EAIDCT_H #define AVCODEC_EAIDCT_H
#include <stdint.h> #include <stdint.h>
#include "dsputil.h"
void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); void ff_ea_idct_put_c(uint8_t *dest, int linesize, int16_t *block);
#endif /* AVCODEC_EAIDCT_H */ #endif /* AVCODEC_EAIDCT_H */

View File

@ -51,7 +51,7 @@ typedef struct MadContext {
GetBitContext gb; GetBitContext gb;
void *bitstream_buf; void *bitstream_buf;
unsigned int bitstream_buf_size; unsigned int bitstream_buf_size;
DECLARE_ALIGNED(16, DCTELEM, block)[64]; DECLARE_ALIGNED(16, int16_t, block)[64];
ScanTable scantable; ScanTable scantable;
uint16_t quant_matrix[64]; uint16_t quant_matrix[64];
int mb_x; int mb_x;
@ -96,7 +96,7 @@ static inline void comp_block(MadContext *t, int mb_x, int mb_y,
} }
} }
static inline void idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, int j) static inline void idct_put(MadContext *t, int16_t *block, int mb_x, int mb_y, int j)
{ {
if (j < 4) { if (j < 4) {
ff_ea_idct_put_c( ff_ea_idct_put_c(
@ -110,7 +110,7 @@ static inline void idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, i
} }
} }
static inline void decode_block_intra(MadContext *s, DCTELEM * block) static inline void decode_block_intra(MadContext *s, int16_t * block)
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1; RLTable *rl = &ff_rl_mpeg1;

View File

@ -43,7 +43,7 @@ typedef struct TgqContext {
int width,height; int width,height;
ScanTable scantable; ScanTable scantable;
int qtable[64]; int qtable[64];
DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
GetByteContext gb; GetByteContext gb;
} TgqContext; } TgqContext;
@ -58,7 +58,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx){
return 0; return 0;
} }
static void tgq_decode_block(TgqContext *s, DCTELEM block[64], GetBitContext *gb){ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb){
uint8_t *perm = s->scantable.permutated; uint8_t *perm = s->scantable.permutated;
int i,j,value; int i,j,value;
block[0] = get_sbits(gb,8) * s->qtable[0]; block[0] = get_sbits(gb,8) * s->qtable[0];
@ -103,7 +103,7 @@ static void tgq_decode_block(TgqContext *s, DCTELEM block[64], GetBitContext *gb
block[0] += 128<<4; block[0] += 128<<4;
} }
static void tgq_idct_put_mb(TgqContext *s, DCTELEM (*block)[64], int mb_x, int mb_y){ static void tgq_idct_put_mb(TgqContext *s, int16_t (*block)[64], int mb_x, int mb_y){
int linesize= s->frame.linesize[0]; int linesize= s->frame.linesize[0];
uint8_t *dest_y = s->frame.data[0] + (mb_y * 16* linesize ) + mb_x * 16; uint8_t *dest_y = s->frame.data[0] + (mb_y * 16* linesize ) + mb_x * 16;
uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8; uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8;

View File

@ -40,7 +40,7 @@ typedef struct TqiContext {
AVFrame frame; AVFrame frame;
void *bitstream_buf; void *bitstream_buf;
unsigned int bitstream_buf_size; unsigned int bitstream_buf_size;
DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
} TqiContext; } TqiContext;
static av_cold int tqi_decode_init(AVCodecContext *avctx) static av_cold int tqi_decode_init(AVCodecContext *avctx)
@ -58,7 +58,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
static int tqi_decode_mb(MpegEncContext *s, DCTELEM (*block)[64]) static int tqi_decode_mb(MpegEncContext *s, int16_t (*block)[64])
{ {
int n; int n;
s->dsp.clear_blocks(block[0]); s->dsp.clear_blocks(block[0]);
@ -69,7 +69,7 @@ static int tqi_decode_mb(MpegEncContext *s, DCTELEM (*block)[64])
return 0; return 0;
} }
static inline void tqi_idct_put(TqiContext *t, DCTELEM (*block)[64]) static inline void tqi_idct_put(TqiContext *t, int16_t (*block)[64])
{ {
MpegEncContext *s = &t->s; MpegEncContext *s = &t->s;
int linesize= t->frame.linesize[0]; int linesize= t->frame.linesize[0];

View File

@ -64,7 +64,7 @@ B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7,
B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7, B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7,
}; };
static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data) static av_always_inline void row_fdct(FLOAT temp[64], int16_t *data)
{ {
FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FLOAT tmp10, tmp11, tmp12, tmp13; FLOAT tmp10, tmp11, tmp12, tmp13;
@ -119,7 +119,7 @@ static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data)
} }
} }
void ff_faandct(DCTELEM * data) void ff_faandct(int16_t *data)
{ {
FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FLOAT tmp10, tmp11, tmp12, tmp13; FLOAT tmp10, tmp11, tmp12, tmp13;
@ -179,7 +179,7 @@ void ff_faandct(DCTELEM * data)
} }
} }
void ff_faandct248(DCTELEM * data) void ff_faandct248(int16_t *data)
{ {
FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FLOAT tmp10, tmp11, tmp12, tmp13; FLOAT tmp10, tmp11, tmp12, tmp13;

View File

@ -29,9 +29,9 @@
#ifndef AVCODEC_FAANDCT_H #ifndef AVCODEC_FAANDCT_H
#define AVCODEC_FAANDCT_H #define AVCODEC_FAANDCT_H
#include "dsputil.h" #include <stdint.h>
void ff_faandct(DCTELEM * data); void ff_faandct(int16_t *data);
void ff_faandct248(DCTELEM * data); void ff_faandct248(int16_t *data);
#endif /* AVCODEC_FAANDCT_H */ #endif /* AVCODEC_FAANDCT_H */

View File

@ -47,7 +47,7 @@ B6*B0/8, B6*B1/8, B6*B2/8, B6*B3/8, B6*B4/8, B6*B5/8, B6*B6/8, B6*B7/8,
B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8, B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8,
}; };
static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){ static inline void p8idct(int16_t data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){
int i; int i;
FLOAT av_unused tmp0; FLOAT av_unused tmp0;
FLOAT s04, d04, s17, d17, s26, d26, s53, d53; FLOAT s04, d04, s17, d17, s26, d26, s53, d53;
@ -129,7 +129,7 @@ static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int s
} }
} }
void ff_faanidct(DCTELEM block[64]){ void ff_faanidct(int16_t block[64]){
FLOAT temp[64]; FLOAT temp[64];
int i; int i;
@ -142,7 +142,7 @@ void ff_faanidct(DCTELEM block[64]){
p8idct(block, temp, NULL, 0, 8, 1, 1); p8idct(block, temp, NULL, 0, 8, 1, 1);
} }
void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]){ void ff_faanidct_add(uint8_t *dest, int line_size, int16_t block[64]){
FLOAT temp[64]; FLOAT temp[64];
int i; int i;
@ -155,7 +155,7 @@ void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]){
p8idct(NULL , temp, dest, line_size, 8, 1, 2); p8idct(NULL , temp, dest, line_size, 8, 1, 2);
} }
void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64]){ void ff_faanidct_put(uint8_t *dest, int line_size, int16_t block[64]){
FLOAT temp[64]; FLOAT temp[64];
int i; int i;

View File

@ -23,10 +23,9 @@
#define AVCODEC_FAANIDCT_H #define AVCODEC_FAANIDCT_H
#include <stdint.h> #include <stdint.h>
#include "dsputil.h"
void ff_faanidct(DCTELEM block[64]); void ff_faanidct(int16_t block[64]);
void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]); void ff_faanidct_add(uint8_t *dest, int line_size, int16_t block[64]);
void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64]); void ff_faanidct_put(uint8_t *dest, int line_size, int16_t block[64]);
#endif /* AVCODEC_FAANIDCT_H */ #endif /* AVCODEC_FAANIDCT_H */

View File

@ -47,7 +47,7 @@ static VLC h261_mtype_vlc;
static VLC h261_mv_vlc; static VLC h261_mv_vlc;
static VLC h261_cbp_vlc; static VLC h261_cbp_vlc;
static int h261_decode_block(H261Context * h, DCTELEM * block, int n, int coded); static int h261_decode_block(H261Context * h, int16_t * block, int n, int coded);
static av_cold void h261_decode_init_vlc(H261Context *h){ static av_cold void h261_decode_init_vlc(H261Context *h){
static int done = 0; static int done = 0;
@ -358,7 +358,7 @@ intra:
* Decode a macroblock. * Decode a macroblock.
* @return <0 if an error occurred * @return <0 if an error occurred
*/ */
static int h261_decode_block(H261Context * h, DCTELEM * block, static int h261_decode_block(H261Context * h, int16_t * block,
int n, int coded) int n, int coded)
{ {
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;

View File

@ -34,7 +34,7 @@
extern uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3]; extern uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
static void h261_encode_block(H261Context * h, DCTELEM * block, static void h261_encode_block(H261Context * h, int16_t * block,
int n); int n);
int ff_h261_get_picture_format(int width, int height){ int ff_h261_get_picture_format(int width, int height){
@ -143,7 +143,7 @@ static void h261_encode_motion(H261Context * h, int val){
} }
static inline int get_cbp(MpegEncContext * s, static inline int get_cbp(MpegEncContext * s,
DCTELEM block[6][64]) int16_t block[6][64])
{ {
int i, cbp; int i, cbp;
cbp= 0; cbp= 0;
@ -154,7 +154,7 @@ static inline int get_cbp(MpegEncContext * s,
return cbp; return cbp;
} }
void ff_h261_encode_mb(MpegEncContext * s, void ff_h261_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
H261Context * h = (H261Context *)s; H261Context * h = (H261Context *)s;
@ -255,7 +255,7 @@ void ff_h261_encode_init(MpegEncContext *s){
* @param block the 8x8 block * @param block the 8x8 block
* @param n block index (0-3 are luma, 4-5 are chroma) * @param n block index (0-3 are luma, 4-5 are chroma)
*/ */
static void h261_encode_block(H261Context * h, DCTELEM * block, int n){ static void h261_encode_block(H261Context * h, int16_t * block, int n){
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
int level, run, i, j, last_index, last_non_zero, sign, slevel, code; int level, run, i, j, last_index, last_non_zero, sign, slevel, code;
RLTable *rl; RLTable *rl;

View File

@ -226,7 +226,7 @@ void ff_h263_loop_filter(MpegEncContext * s){
} }
} }
void ff_h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) void ff_h263_pred_acdc(MpegEncContext * s, int16_t *block, int n)
{ {
int x, y, wrap, a, c, pred_dc, scale, i; int x, y, wrap, a, c, pred_dc, scale, i;
int16_t *dc_val, *ac_val, *ac_val1; int16_t *dc_val, *ac_val, *ac_val1;

View File

@ -73,7 +73,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx,
AVPacket *avpkt); AVPacket *avpkt);
int ff_h263_decode_end(AVCodecContext *avctx); int ff_h263_decode_end(AVCodecContext *avctx);
void ff_h263_encode_mb(MpegEncContext *s, void ff_h263_encode_mb(MpegEncContext *s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
void ff_h263_encode_picture_header(MpegEncContext *s, int picture_number); void ff_h263_encode_picture_header(MpegEncContext *s, int picture_number);
void ff_h263_encode_gob_header(MpegEncContext * s, int mb_line); void ff_h263_encode_gob_header(MpegEncContext * s, int mb_line);
@ -89,7 +89,7 @@ int ff_h263_decode_mba(MpegEncContext *s);
void ff_h263_encode_mba(MpegEncContext *s); void ff_h263_encode_mba(MpegEncContext *s);
void ff_init_qscale_tab(MpegEncContext *s); void ff_init_qscale_tab(MpegEncContext *s);
int ff_h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr); int ff_h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr);
void ff_h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n); void ff_h263_pred_acdc(MpegEncContext * s, int16_t *block, int n);
/** /**
@ -99,7 +99,7 @@ void ff_h263_show_pict_info(MpegEncContext *s);
int ff_intel_h263_decode_picture_header(MpegEncContext *s); int ff_intel_h263_decode_picture_header(MpegEncContext *s);
int ff_h263_decode_mb(MpegEncContext *s, int ff_h263_decode_mb(MpegEncContext *s,
DCTELEM block[6][64]); int16_t block[6][64]);
/** /**
* Return the value of the 3bit "source format" syntax element. * Return the value of the 3bit "source format" syntax element.
@ -144,7 +144,7 @@ static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y
} }
static inline int get_p_cbp(MpegEncContext * s, static inline int get_p_cbp(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y){ int motion_x, int motion_y){
int cbp, i; int cbp, i;

View File

@ -1750,7 +1750,7 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
} }
} }
static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth, static av_always_inline int dctcoef_get(int16_t *mb, int high_bit_depth,
int index) int index)
{ {
if (high_bit_depth) { if (high_bit_depth) {
@ -1759,7 +1759,7 @@ static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth,
return AV_RN16A(mb + index); return AV_RN16A(mb + index);
} }
static av_always_inline void dctcoef_set(DCTELEM *mb, int high_bit_depth, static av_always_inline void dctcoef_set(int16_t *mb, int high_bit_depth,
int index, int value) int index, int value)
{ {
if (high_bit_depth) { if (high_bit_depth) {
@ -1778,8 +1778,8 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
uint8_t *dest_y, int p) uint8_t *dest_y, int p)
{ {
MpegEncContext *const s = &h->s; MpegEncContext *const s = &h->s;
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_dc_add)(uint8_t *dst, int16_t *block, int stride);
int i; int i;
int qscale = p == 0 ? s->qscale : h->chroma_qp[p - 1]; int qscale = p == 0 ? s->qscale : h->chroma_qp[p - 1];
block_offset += 16 * p; block_offset += 16 * p;
@ -1895,7 +1895,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type,
uint8_t *dest_y, int p) uint8_t *dest_y, int p)
{ {
MpegEncContext *const s = &h->s; MpegEncContext *const s = &h->s;
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
int i; int i;
block_offset += 16 * p; block_offset += 16 * p;
if (!IS_INTRA4x4(mb_type)) { if (!IS_INTRA4x4(mb_type)) {

View File

@ -29,7 +29,6 @@
#define AVCODEC_H264_H #define AVCODEC_H264_H
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "dsputil.h"
#include "cabac.h" #include "cabac.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h264dsp.h" #include "h264dsp.h"
@ -386,9 +385,9 @@ typedef struct H264Context {
GetBitContext *intra_gb_ptr; GetBitContext *intra_gb_ptr;
GetBitContext *inter_gb_ptr; GetBitContext *inter_gb_ptr;
DECLARE_ALIGNED(16, DCTELEM, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space. DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[3][16 * 2]; DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
DCTELEM mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb int16_t mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
/** /**
* Cabac * Cabac

View File

@ -1561,7 +1561,7 @@ static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx,
} }
static av_always_inline void static av_always_inline void
decode_cabac_residual_internal(H264Context *h, DCTELEM *block, decode_cabac_residual_internal(H264Context *h, int16_t *block,
int cat, int n, const uint8_t *scantable, int cat, int n, const uint8_t *scantable,
const uint32_t *qmul, int max_coeff, const uint32_t *qmul, int max_coeff,
int is_dc, int chroma422) int is_dc, int chroma422)
@ -1745,18 +1745,27 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
} }
static void decode_cabac_residual_dc_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) { static void decode_cabac_residual_dc_internal(H264Context *h, int16_t *block,
int cat, int n,
const uint8_t *scantable,
int max_coeff)
{
decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 0); decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 0);
} }
static void decode_cabac_residual_dc_internal_422(H264Context *h, DCTELEM *block, static void decode_cabac_residual_dc_internal_422(H264Context *h, int16_t *block,
int cat, int n, const uint8_t *scantable, int cat, int n, const uint8_t *scantable,
int max_coeff) int max_coeff)
{ {
decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 1); decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 1);
} }
static void decode_cabac_residual_nondc_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) { static void decode_cabac_residual_nondc_internal(H264Context *h, int16_t *block,
int cat, int n,
const uint8_t *scantable,
const uint32_t *qmul,
int max_coeff)
{
decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0, 0); decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0, 0);
} }
@ -1772,7 +1781,12 @@ static void decode_cabac_residual_nondc_internal( H264Context *h, DCTELEM *block
* because it allows improved constant propagation into get_cabac_cbf_ctx, * because it allows improved constant propagation into get_cabac_cbf_ctx,
* as well as because most blocks have zero CBFs. */ * as well as because most blocks have zero CBFs. */
static av_always_inline void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) { static av_always_inline void decode_cabac_residual_dc(H264Context *h,
int16_t *block,
int cat, int n,
const uint8_t *scantable,
int max_coeff)
{
/* read coded block flag */ /* read coded block flag */
if( get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 1 ) ] ) == 0 ) { if( get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 1 ) ] ) == 0 ) {
h->non_zero_count_cache[scan8[n]] = 0; h->non_zero_count_cache[scan8[n]] = 0;
@ -1782,7 +1796,7 @@ static av_always_inline void decode_cabac_residual_dc( H264Context *h, DCTELEM *
} }
static av_always_inline void static av_always_inline void
decode_cabac_residual_dc_422(H264Context *h, DCTELEM *block, decode_cabac_residual_dc_422(H264Context *h, int16_t *block,
int cat, int n, const uint8_t *scantable, int cat, int n, const uint8_t *scantable,
int max_coeff) int max_coeff)
{ {
@ -1794,7 +1808,13 @@ decode_cabac_residual_dc_422(H264Context *h, DCTELEM *block,
decode_cabac_residual_dc_internal_422(h, block, cat, n, scantable, max_coeff); decode_cabac_residual_dc_internal_422(h, block, cat, n, scantable, max_coeff);
} }
static av_always_inline void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) { static av_always_inline void decode_cabac_residual_nondc(H264Context *h,
int16_t *block,
int cat, int n,
const uint8_t *scantable,
const uint32_t *qmul,
int max_coeff)
{
/* read coded block flag */ /* read coded block flag */
if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) { if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
if( max_coeff == 64 ) { if( max_coeff == 64 ) {
@ -2354,7 +2374,7 @@ decode_intra_mb:
if( cbp&0x20 ) { if( cbp&0x20 ) {
int c, i, i8x8; int c, i, i8x8;
for( c = 0; c < 2; c++ ) { for( c = 0; c < 2; c++ ) {
DCTELEM *mb = h->mb + (16*(16 + 16*c) << pixel_shift); int16_t *mb = h->mb + (16*(16 + 16*c) << pixel_shift);
qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i8x8 = 0; i8x8 < 2; i8x8++) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {

View File

@ -442,7 +442,7 @@ static inline int get_level_prefix(GetBitContext *gb){
* @param max_coeff number of coefficients in the block * @param max_coeff number of coefficients in the block
* @return <0 if an error occurred * @return <0 if an error occurred
*/ */
static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){ static int decode_residual(H264Context *h, GetBitContext *gb, int16_t *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
int level[16]; int level[16];
@ -662,7 +662,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, GetBitContext *
for(i8x8=0; i8x8<4; i8x8++){ for(i8x8=0; i8x8<4; i8x8++){
if(cbp & (1<<i8x8)){ if(cbp & (1<<i8x8)){
if(IS_8x8DCT(mb_type)){ if(IS_8x8DCT(mb_type)){
DCTELEM *buf = &h->mb[64*i8x8+256*p << pixel_shift]; int16_t *buf = &h->mb[64*i8x8+256*p << pixel_shift];
uint8_t *nnz; uint8_t *nnz;
for(i4x4=0; i4x4<4; i4x4++){ for(i4x4=0; i4x4<4; i4x4++){
const int index= i4x4 + 4*i8x8 + p*16; const int index= i4x4 + 4*i8x8 + p*16;
@ -1134,7 +1134,7 @@ decode_intra_mb:
if(cbp&0x20){ if(cbp&0x20){
for(chroma_idx=0; chroma_idx<2; chroma_idx++){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){
const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
DCTELEM *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift); int16_t *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift);
for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i8x8 = 0; i8x8 < 2; i8x8++) {
for (i4x4 = 0; i4x4 < 4; i4x4++) { for (i4x4 = 0; i4x4 < 4; i4x4++) {
const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4; const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4;

View File

@ -52,7 +52,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h)
const int transform_bypass = !SIMPLE && (s->qscale == 0 && h->sps.transform_bypass); const int transform_bypass = !SIMPLE && (s->qscale == 0 && h->sps.transform_bypass);
/* is_h264 should always be true if SVQ3 is disabled. */ /* is_h264 should always be true if SVQ3 is disabled. */
const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || s->codec_id == AV_CODEC_ID_H264; const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || s->codec_id == AV_CODEC_ID_H264;
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_add)(uint8_t *dst, int16_t *block, int stride);
const int block_h = 16 >> s->chroma_y_shift; const int block_h = 16 >> s->chroma_y_shift;
const int chroma422 = CHROMA422; const int chroma422 = CHROMA422;

View File

@ -29,8 +29,6 @@
#include <stdint.h> #include <stdint.h>
#include "dsputil.h"
typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, typedef void (*h264_weight_func)(uint8_t *block, int stride, int height,
int log2_denom, int weight, int offset); int log2_denom, int weight, int offset);
typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src,
@ -80,29 +78,29 @@ typedef struct H264DSPContext {
/* IDCT */ /* IDCT */
void (*h264_idct_add)(uint8_t *dst /*align 4*/, void (*h264_idct_add)(uint8_t *dst /*align 4*/,
DCTELEM *block /*align 16*/, int stride); int16_t *block /*align 16*/, int stride);
void (*h264_idct8_add)(uint8_t *dst /*align 8*/, void (*h264_idct8_add)(uint8_t *dst /*align 8*/,
DCTELEM *block /*align 16*/, int stride); int16_t *block /*align 16*/, int stride);
void (*h264_idct_dc_add)(uint8_t *dst /*align 4*/, void (*h264_idct_dc_add)(uint8_t *dst /*align 4*/,
DCTELEM *block /*align 16*/, int stride); int16_t *block /*align 16*/, int stride);
void (*h264_idct8_dc_add)(uint8_t *dst /*align 8*/, void (*h264_idct8_dc_add)(uint8_t *dst /*align 8*/,
DCTELEM *block /*align 16*/, int stride); int16_t *block /*align 16*/, int stride);
void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset, void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset,
DCTELEM *block /*align 16*/, int stride, int16_t *block /*align 16*/, int stride,
const uint8_t nnzc[15 * 8]); const uint8_t nnzc[15 * 8]);
void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset, void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset,
DCTELEM *block /*align 16*/, int stride, int16_t *block /*align 16*/, int stride,
const uint8_t nnzc[15 * 8]); const uint8_t nnzc[15 * 8]);
void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset, void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset,
DCTELEM *block /*align 16*/, int stride, int16_t *block /*align 16*/, int stride,
const uint8_t nnzc[15 * 8]); const uint8_t nnzc[15 * 8]);
void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset, void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset,
DCTELEM *block /*align 16*/, int16_t *block /*align 16*/,
int stride, const uint8_t nnzc[15 * 8]); int stride, const uint8_t nnzc[15 * 8]);
void (*h264_luma_dc_dequant_idct)(DCTELEM *output, void (*h264_luma_dc_dequant_idct)(int16_t *output,
DCTELEM *input /*align 16*/, int qmul); int16_t *input /*align 16*/, int qmul);
void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul); void (*h264_chroma_dc_dequant_idct)(int16_t *block, int qmul);
} H264DSPContext; } H264DSPContext;
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,

View File

@ -47,7 +47,7 @@ static const uint8_t scan8[16*3]={
}; };
#endif #endif
void FUNCC(ff_h264_idct_add)(uint8_t *_dst, DCTELEM *_block, int stride) void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)
{ {
int i; int i;
pixel *dst = (pixel*)_dst; pixel *dst = (pixel*)_dst;
@ -81,7 +81,7 @@ void FUNCC(ff_h264_idct_add)(uint8_t *_dst, DCTELEM *_block, int stride)
} }
} }
void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
int i; int i;
pixel *dst = (pixel*)_dst; pixel *dst = (pixel*)_dst;
dctcoef *block = (dctcoef*)_block; dctcoef *block = (dctcoef*)_block;
@ -154,7 +154,7 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){
} }
// assumes all AC coefs are 0 // assumes all AC coefs are 0
void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *block, int stride){
int i, j; int i, j;
int dc = (((dctcoef*)block)[0] + 32) >> 6; int dc = (((dctcoef*)block)[0] + 32) >> 6;
pixel *dst = (pixel*)_dst; pixel *dst = (pixel*)_dst;
@ -167,7 +167,7 @@ void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
} }
} }
void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *block, int stride){
int i, j; int i, j;
int dc = (((dctcoef*)block)[0] + 32) >> 6; int dc = (((dctcoef*)block)[0] + 32) >> 6;
pixel *dst = (pixel*)_dst; pixel *dst = (pixel*)_dst;
@ -180,7 +180,7 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
} }
} }
void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
int i; int i;
for(i=0; i<16; i++){ for(i=0; i<16; i++){
int nnz = nnzc[ scan8[i] ]; int nnz = nnzc[ scan8[i] ];
@ -191,7 +191,7 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, DCTELEM *b
} }
} }
void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
int i; int i;
for(i=0; i<16; i++){ for(i=0; i<16; i++){
if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride); if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride);
@ -199,7 +199,7 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, DCTEL
} }
} }
void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
int i; int i;
for(i=0; i<16; i+=4){ for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ]; int nnz = nnzc[ scan8[i] ];
@ -210,7 +210,7 @@ void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, DCTELEM *b
} }
} }
void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
int i, j; int i, j;
for(j=1; j<3; j++){ for(j=1; j<3; j++){
for(i=j*16; i<j*16+4; i++){ for(i=j*16; i<j*16+4; i++){
@ -222,7 +222,7 @@ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *
} }
} }
void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15*8]){ void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){
int i, j; int i, j;
for(j=1; j<3; j++){ for(j=1; j<3; j++){
@ -248,7 +248,7 @@ void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, DCTEL
* IDCT transforms the 16 dc values and dequantizes them. * IDCT transforms the 16 dc values and dequantizes them.
* @param qmul quantization parameter * @param qmul quantization parameter
*/ */
void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *_output, DCTELEM *_input, int qmul){ void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul){
#define stride 16 #define stride 16
int i; int i;
int temp[16]; int temp[16];
@ -283,7 +283,7 @@ void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *_output, DCTELEM *_input, int
#undef stride #undef stride
} }
void FUNCC(ff_h264_chroma422_dc_dequant_idct)(DCTELEM *_block, int qmul){ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){
const int stride= 16*2; const int stride= 16*2;
const int xStride= 16; const int xStride= 16;
int i; int i;
@ -310,7 +310,7 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(DCTELEM *_block, int qmul){
} }
} }
void FUNCC(ff_h264_chroma_dc_dequant_idct)(DCTELEM *_block, int qmul){ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){
const int stride= 16*2; const int stride= 16*2;
const int xStride= 16; const int xStride= 16;
int a,b,c,d,e; int a,b,c,d,e;

View File

@ -28,8 +28,8 @@
#ifndef AVCODEC_H264PRED_H #ifndef AVCODEC_H264PRED_H
#define AVCODEC_H264PRED_H #define AVCODEC_H264PRED_H
#include "libavutil/common.h" #include <stddef.h>
#include "dsputil.h" #include <stdint.h>
/** /**
* Prediction types * Prediction types
@ -98,15 +98,15 @@ typedef struct H264PredContext {
void(*pred16x16[4 + 3 + 2])(uint8_t *src, ptrdiff_t stride); void(*pred16x16[4 + 3 + 2])(uint8_t *src, ptrdiff_t stride);
void(*pred4x4_add[2])(uint8_t *pix /*align 4*/, void(*pred4x4_add[2])(uint8_t *pix /*align 4*/,
const DCTELEM *block /*align 16*/, ptrdiff_t stride); const int16_t *block /*align 16*/, ptrdiff_t stride);
void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/, void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/,
const DCTELEM *block /*align 16*/, ptrdiff_t stride); const int16_t *block /*align 16*/, ptrdiff_t stride);
void(*pred8x8_add[3])(uint8_t *pix /*align 8*/, void(*pred8x8_add[3])(uint8_t *pix /*align 8*/,
const int *block_offset, const int *block_offset,
const DCTELEM *block /*align 16*/, ptrdiff_t stride); const int16_t *block /*align 16*/, ptrdiff_t stride);
void(*pred16x16_add[3])(uint8_t *pix /*align 16*/, void(*pred16x16_add[3])(uint8_t *pix /*align 16*/,
const int *block_offset, const int *block_offset,
const DCTELEM *block /*align 16*/, ptrdiff_t stride); const int16_t *block /*align 16*/, ptrdiff_t stride);
} H264PredContext; } H264PredContext;
void ff_h264_pred_init(H264PredContext *h, int codec_id, void ff_h264_pred_init(H264PredContext *h, int codec_id,

View File

@ -1131,7 +1131,7 @@ static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft,
#undef PL #undef PL
#undef SRC #undef SRC
static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const int16_t *_block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1150,7 +1150,7 @@ static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block,
} }
} }
static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const int16_t *_block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1168,7 +1168,7 @@ static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
} }
} }
static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const int16_t *_block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1191,7 +1191,7 @@ static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block,
} }
} }
static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const int16_t *_block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1214,7 +1214,7 @@ static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
} }
static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset, static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset,
const DCTELEM *block, const int16_t *block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1224,7 +1224,7 @@ static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset,
static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix, static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix,
const int *block_offset, const int *block_offset,
const DCTELEM *block, const int16_t *block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1233,7 +1233,7 @@ static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix,
} }
static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset, static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
const DCTELEM *block, ptrdiff_t stride) const int16_t *block, ptrdiff_t stride)
{ {
int i; int i;
for(i=0; i<4; i++) for(i=0; i<4; i++)
@ -1241,7 +1241,7 @@ static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
} }
static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset, static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset,
const DCTELEM *block, ptrdiff_t stride) const int16_t *block, ptrdiff_t stride)
{ {
int i; int i;
for(i=0; i<4; i++) for(i=0; i<4; i++)
@ -1251,7 +1251,7 @@ static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset,
} }
static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset, static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset,
const DCTELEM *block, const int16_t *block,
ptrdiff_t stride) ptrdiff_t stride)
{ {
int i; int i;
@ -1261,7 +1261,7 @@ static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset,
static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix, static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix,
const int *block_offset, const int *block_offset,
const DCTELEM *block, ptrdiff_t stride) const int16_t *block, ptrdiff_t stride)
{ {
int i; int i;
for(i=0; i<4; i++) for(i=0; i<4; i++)

View File

@ -438,7 +438,7 @@ static void h263_decode_dquant(MpegEncContext *s){
ff_set_qscale(s, s->qscale); ff_set_qscale(s, s->qscale);
} }
static int h263_decode_block(MpegEncContext * s, DCTELEM * block, static int h263_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded) int n, int coded)
{ {
int code, level, i, j, last, run; int code, level, i, j, last, run;
@ -563,7 +563,7 @@ not_coded:
static int h263_skip_b_part(MpegEncContext *s, int cbp) static int h263_skip_b_part(MpegEncContext *s, int cbp)
{ {
LOCAL_ALIGNED_16(DCTELEM, dblock, [64]); LOCAL_ALIGNED_16(int16_t, dblock, [64]);
int i, mbi; int i, mbi;
/* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly /* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly
@ -599,7 +599,7 @@ static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
} }
int ff_h263_decode_mb(MpegEncContext *s, int ff_h263_decode_mb(MpegEncContext *s,
DCTELEM block[6][64]) int16_t block[6][64])
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
int16_t *mot_val; int16_t *mot_val;

View File

@ -306,7 +306,7 @@ static const int dquant_code[5]= {1,0,9,2,3};
* @param block the 8x8 block * @param block the 8x8 block
* @param n block index (0-3 are luma, 4-5 are chroma) * @param n block index (0-3 are luma, 4-5 are chroma)
*/ */
static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n) static void h263_encode_block(MpegEncContext * s, int16_t * block, int n)
{ {
int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code; int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code;
RLTable *rl; RLTable *rl;
@ -455,7 +455,7 @@ static void h263p_encode_umotion(MpegEncContext * s, int val)
} }
void ff_h263_encode_mb(MpegEncContext * s, void ff_h263_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y; int cbpc, cbpy, i, cbp, pred_x, pred_y;

View File

@ -136,17 +136,17 @@
#endif #endif
/* Multiply a DCTELEM variable by an int32_t constant, and immediately /* Multiply a int16_t variable by an int32_t constant, and immediately
* descale to yield a DCTELEM result. * descale to yield a int16_t result.
*/ */
#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) #define MULTIPLY(var,const) ((int16_t) DESCALE((var) * (const), CONST_BITS))
static av_always_inline void row_fdct(DCTELEM * data){ static av_always_inline void row_fdct(int16_t * data){
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5, z11, z13; int z1, z2, z3, z4, z5, z11, z13;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
/* Pass 1: process rows. */ /* Pass 1: process rows. */
@ -205,12 +205,12 @@ static av_always_inline void row_fdct(DCTELEM * data){
*/ */
GLOBAL(void) GLOBAL(void)
ff_fdct_ifast (DCTELEM * data) ff_fdct_ifast (int16_t * data)
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5, z11, z13; int z1, z2, z3, z4, z5, z11, z13;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
row_fdct(data); row_fdct(data);
@ -271,12 +271,12 @@ ff_fdct_ifast (DCTELEM * data)
*/ */
GLOBAL(void) GLOBAL(void)
ff_fdct_ifast248 (DCTELEM * data) ff_fdct_ifast248 (int16_t * data)
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1; int z1;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
row_fdct(data); row_fdct(data);

View File

@ -184,12 +184,12 @@
#endif #endif
static av_always_inline void FUNC(row_fdct)(DCTELEM *data) static av_always_inline void FUNC(row_fdct)(int16_t *data)
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5; int z1, z2, z3, z4, z5;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
/* Pass 1: process rows. */ /* Pass 1: process rows. */
@ -216,13 +216,13 @@ static av_always_inline void FUNC(row_fdct)(DCTELEM *data)
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); dataptr[0] = (int16_t) ((tmp10 + tmp11) << PASS1_BITS);
dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); dataptr[4] = (int16_t) ((tmp10 - tmp11) << PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), dataptr[2] = (int16_t) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS-PASS1_BITS); CONST_BITS-PASS1_BITS);
dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), dataptr[6] = (int16_t) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
CONST_BITS-PASS1_BITS); CONST_BITS-PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2). /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
@ -248,10 +248,10 @@ static av_always_inline void FUNC(row_fdct)(DCTELEM *data)
z3 += z5; z3 += z5;
z4 += z5; z4 += z5;
dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[7] = (int16_t) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[5] = (int16_t) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[3] = (int16_t) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); dataptr[1] = (int16_t) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */ dataptr += DCTSIZE; /* advance pointer to next row */
} }
@ -262,12 +262,12 @@ static av_always_inline void FUNC(row_fdct)(DCTELEM *data)
*/ */
GLOBAL(void) GLOBAL(void)
FUNC(ff_jpeg_fdct_islow)(DCTELEM *data) FUNC(ff_jpeg_fdct_islow)(int16_t *data)
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5; int z1, z2, z3, z4, z5;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
FUNC(row_fdct)(data); FUNC(row_fdct)(data);
@ -344,12 +344,12 @@ FUNC(ff_jpeg_fdct_islow)(DCTELEM *data)
* you do even part two times. * you do even part two times.
*/ */
GLOBAL(void) GLOBAL(void)
FUNC(ff_fdct248_islow)(DCTELEM *data) FUNC(ff_fdct248_islow)(int16_t *data)
{ {
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z1; int z1;
DCTELEM *dataptr; int16_t *dataptr;
int ctr; int ctr;
FUNC(row_fdct)(data); FUNC(row_fdct)(data);

View File

@ -74,7 +74,7 @@
#define RIGHT_SHIFT(x, n) ((x) >> (n)) #define RIGHT_SHIFT(x, n) ((x) >> (n))
typedef DCTELEM DCTBLOCK[DCTSIZE2]; typedef int16_t DCTBLOCK[DCTSIZE2];
#define CONST_BITS 13 #define CONST_BITS 13
@ -213,7 +213,7 @@ void ff_j_rev_dct(DCTBLOCK data)
int32_t tmp10, tmp11, tmp12, tmp13; int32_t tmp10, tmp11, tmp12, tmp13;
int32_t z1, z2, z3, z4, z5; int32_t z1, z2, z3, z4, z5;
int32_t d0, d1, d2, d3, d4, d5, d6, d7; int32_t d0, d1, d2, d3, d4, d5, d6, d7;
register DCTELEM *dataptr; register int16_t *dataptr;
int rowctr; int rowctr;
/* Pass 1: process rows. */ /* Pass 1: process rows. */
@ -249,7 +249,7 @@ void ff_j_rev_dct(DCTBLOCK data)
/* AC terms all zero */ /* AC terms all zero */
if (d0) { if (d0) {
/* Compute a 32 bit value to assign. */ /* Compute a 32 bit value to assign. */
DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); int16_t dcval = (int16_t) (d0 << PASS1_BITS);
register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
idataptr[0] = v; idataptr[0] = v;
@ -574,14 +574,14 @@ void ff_j_rev_dct(DCTBLOCK data)
} }
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); dataptr[0] = (int16_t) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); dataptr[7] = (int16_t) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); dataptr[1] = (int16_t) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); dataptr[6] = (int16_t) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); dataptr[2] = (int16_t) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); dataptr[5] = (int16_t) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); dataptr[3] = (int16_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); dataptr[4] = (int16_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */ dataptr += DCTSIZE; /* advance pointer to next row */
} }
@ -920,21 +920,21 @@ void ff_j_rev_dct(DCTBLOCK data)
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, dataptr[DCTSIZE*0] = (int16_t) DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, dataptr[DCTSIZE*7] = (int16_t) DESCALE(tmp10 - tmp3,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, dataptr[DCTSIZE*1] = (int16_t) DESCALE(tmp11 + tmp2,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, dataptr[DCTSIZE*6] = (int16_t) DESCALE(tmp11 - tmp2,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, dataptr[DCTSIZE*2] = (int16_t) DESCALE(tmp12 + tmp1,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, dataptr[DCTSIZE*5] = (int16_t) DESCALE(tmp12 - tmp1,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, dataptr[DCTSIZE*3] = (int16_t) DESCALE(tmp13 + tmp0,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, dataptr[DCTSIZE*4] = (int16_t) DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3); CONST_BITS+PASS1_BITS+3);
dataptr++; /* advance pointer to next column */ dataptr++; /* advance pointer to next column */

View File

@ -45,14 +45,14 @@ typedef struct MDECContext{
int mb_width; int mb_width;
int mb_height; int mb_height;
int mb_x, mb_y; int mb_x, mb_y;
DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
uint8_t *bitstream_buffer; uint8_t *bitstream_buffer;
unsigned int bitstream_buffer_size; unsigned int bitstream_buffer_size;
int block_last_index[6]; int block_last_index[6];
} MDECContext; } MDECContext;
//very similar to MPEG-1 //very similar to MPEG-1
static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
{ {
int level, diff, i, j, run; int level, diff, i, j, run;
int component; int component;
@ -119,7 +119,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
return 0; return 0;
} }
static inline int decode_mb(MDECContext *a, DCTELEM block[6][64]){ static inline int decode_mb(MDECContext *a, int16_t block[6][64]){
int i; int i;
const int block_index[6]= {5,4,0,1,2,3}; const int block_index[6]= {5,4,0,1,2,3};
@ -134,7 +134,7 @@ static inline int decode_mb(MDECContext *a, DCTELEM block[6][64]){
} }
static inline void idct_put(MDECContext *a, int mb_x, int mb_y){ static inline void idct_put(MDECContext *a, int mb_x, int mb_y){
DCTELEM (*block)[64]= a->block; int16_t (*block)[64]= a->block;
int linesize= a->picture.linesize[0]; int linesize= a->picture.linesize[0];
uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;

View File

@ -47,7 +47,7 @@ typedef struct {
AVFrame buf_ptrs [16]; AVFrame buf_ptrs [16];
AVPicture flipped_ptrs[16]; AVPicture flipped_ptrs[16];
DECLARE_ALIGNED(16, DCTELEM, dct_block)[64]; DECLARE_ALIGNED(16, int16_t, dct_block)[64];
GetBitContext gb; GetBitContext gb;
ScanTable scantable; ScanTable scantable;
@ -183,7 +183,7 @@ static const int8_t vlcdec_lookup[9][64] = {
static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale) static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
{ {
DCTELEM *block = ctx->dct_block; int16_t *block = ctx->dct_block;
unsigned int pos; unsigned int pos;
ctx->dsp.clear_block(block); ctx->dsp.clear_block(block);

View File

@ -408,7 +408,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
} }
/* decode block and dequantize */ /* decode block and dequantize */
static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component, static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
int dc_index, int ac_index, int16_t *quant_matrix) int dc_index, int ac_index, int16_t *quant_matrix)
{ {
int code, i, j, level, val; int code, i, j, level, val;
@ -456,7 +456,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component,
return 0; return 0;
} }
static int decode_dc_progressive(MJpegDecodeContext *s, DCTELEM *block, static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block,
int component, int dc_index, int component, int dc_index,
int16_t *quant_matrix, int Al) int16_t *quant_matrix, int Al)
{ {
@ -474,7 +474,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, DCTELEM *block,
} }
/* decode block and dequantize - progressive JPEG version */ /* decode block and dequantize - progressive JPEG version */
static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, static int decode_block_progressive(MJpegDecodeContext *s, int16_t *block,
uint8_t *last_nnz, int ac_index, uint8_t *last_nnz, int ac_index,
int16_t *quant_matrix, int16_t *quant_matrix,
int ss, int se, int Al, int *EOBRUN) int ss, int se, int Al, int *EOBRUN)
@ -572,7 +572,7 @@ for (; ; i++) { \
} }
/* decode block and dequantize - progressive JPEG refinement pass */ /* decode block and dequantize - progressive JPEG refinement pass */
static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
uint8_t *last_nnz, uint8_t *last_nnz,
int ac_index, int16_t *quant_matrix, int ac_index, int16_t *quant_matrix,
int ss, int se, int Al, int *EOBRUN) int ss, int se, int Al, int *EOBRUN)
@ -880,7 +880,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
} else { } else {
int block_idx = s->block_stride[c] * (v * mb_y + y) + int block_idx = s->block_stride[c] * (v * mb_y + y) +
(h * mb_x + x); (h * mb_x + x);
DCTELEM *block = s->blocks[c][block_idx]; int16_t *block = s->blocks[c][block_idx];
if (Ah) if (Ah)
block[0] += get_bits1(&s->gb) * block[0] += get_bits1(&s->gb) *
s->quant_matrixes[s->quant_index[c]][0] << Al; s->quant_matrixes[s->quant_index[c]][0] << Al;
@ -957,7 +957,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
int block_offset = mb_y * linesize * 8; int block_offset = mb_y * linesize * 8;
uint8_t *ptr = data + block_offset; uint8_t *ptr = data + block_offset;
int block_idx = mb_y * s->block_stride[c]; int block_idx = mb_y * s->block_stride[c];
DCTELEM (*block)[64] = &s->blocks[c][block_idx]; int16_t (*block)[64] = &s->blocks[c][block_idx];
uint8_t *last_nnz = &s->last_nnz[c][block_idx]; uint8_t *last_nnz = &s->last_nnz[c][block_idx];
for (mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) { for (mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) {
const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb); const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb);

View File

@ -88,8 +88,8 @@ typedef struct MJpegDecodeContext {
int got_picture; ///< we found a SOF and picture is valid, too. int got_picture; ///< we found a SOF and picture is valid, too.
int linesize[MAX_COMPONENTS]; ///< linesize << interlaced int linesize[MAX_COMPONENTS]; ///< linesize << interlaced
int8_t *qscale_table; int8_t *qscale_table;
DECLARE_ALIGNED(16, DCTELEM, block)[64]; DECLARE_ALIGNED(16, int16_t, block)[64];
DCTELEM (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode) int16_t (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode)
uint8_t *last_nnz[MAX_COMPONENTS]; uint8_t *last_nnz[MAX_COMPONENTS];
uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode) uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
ScanTable scantable; ScanTable scantable;

View File

@ -369,7 +369,7 @@ void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
} }
} }
static void encode_block(MpegEncContext *s, DCTELEM *block, int n) static void encode_block(MpegEncContext *s, int16_t *block, int n)
{ {
int mant, nbits, code, i, j; int mant, nbits, code, i, j;
int component, dc, run, last_index, val; int component, dc, run, last_index, val;
@ -427,7 +427,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]); put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
} }
void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]) void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64])
{ {
int i; int i;
for(i=0;i<5;i++) { for(i=0;i<5;i++) {

View File

@ -33,7 +33,8 @@
#ifndef AVCODEC_MJPEGENC_H #ifndef AVCODEC_MJPEGENC_H
#define AVCODEC_MJPEGENC_H #define AVCODEC_MJPEGENC_H
#include "dsputil.h" #include <stdint.h>
#include "mpegvideo.h" #include "mpegvideo.h"
typedef struct MJpegContext { typedef struct MJpegContext {
@ -55,6 +56,6 @@ void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
void ff_mjpeg_encode_stuffing(PutBitContext *pbc); void ff_mjpeg_encode_stuffing(PutBitContext *pbc);
void ff_mjpeg_encode_dc(MpegEncContext *s, int val, void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code); uint8_t *huff_size, uint16_t *huff_code);
void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]); void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]);
#endif /* AVCODEC_MJPEGENC_H */ #endif /* AVCODEC_MJPEGENC_H */

View File

@ -80,7 +80,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
return sign_extend(val, 5 + shift); return sign_extend(val, 5 + shift);
} }
static inline int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
{ {
int level, dc, diff, i, j, run; int level, dc, diff, i, j, run;
int component; int component;
@ -151,12 +151,12 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, in
return 0; return 0;
} }
int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n) int ff_mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
{ {
return mpeg1_decode_block_intra(s, block, n); return mpeg1_decode_block_intra(s, block, n);
} }
static inline int mpeg1_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, int n)
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1; RLTable *rl = &ff_rl_mpeg1;
@ -231,7 +231,7 @@ end:
return 0; return 0;
} }
static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *block, int n)
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1; RLTable *rl = &ff_rl_mpeg1;
@ -303,7 +303,7 @@ end:
} }
static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block, int n)
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1; RLTable *rl = &ff_rl_mpeg1;
@ -383,7 +383,7 @@ end:
} }
static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
DCTELEM *block, int n) int16_t *block, int n)
{ {
int level, i, j, run; int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1; RLTable *rl = &ff_rl_mpeg1;
@ -444,7 +444,7 @@ end:
} }
static inline int mpeg2_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
{ {
int level, dc, diff, i, j, run; int level, dc, diff, i, j, run;
int component; int component;
@ -522,7 +522,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, DCTELEM *block, in
return 0; return 0;
} }
static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n) static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n)
{ {
int level, dc, diff, j, run; int level, dc, diff, j, run;
int component; int component;
@ -721,7 +721,7 @@ static inline int get_qscale(MpegEncContext *s)
static void exchange_uv(MpegEncContext *s) static void exchange_uv(MpegEncContext *s)
{ {
DCTELEM (*tmp)[64]; int16_t (*tmp)[64];
tmp = s->pblocks[4]; tmp = s->pblocks[4];
s->pblocks[4] = s->pblocks[5]; s->pblocks[4] = s->pblocks[5];
@ -734,7 +734,7 @@ static void exchange_uv(MpegEncContext *s)
#define MT_16X8 2 #define MT_16X8 2
#define MT_DMV 3 #define MT_DMV 3
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64]) static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
{ {
int i, j, k, cbp, val, mb_type, motion_type; int i, j, k, cbp, val, mb_type, motion_type;
const int mb_block_count = 4 + (1 << s->chroma_format); const int mb_block_count = 4 + (1 << s->chroma_format);

View File

@ -71,6 +71,6 @@ static inline int decode_dc(GetBitContext *gb, int component)
return diff; return diff;
} }
extern int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n); extern int ff_mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, int n);
#endif /* AVCODEC_MPEG12_H */ #endif /* AVCODEC_MPEG12_H */

View File

@ -51,7 +51,7 @@ static const uint8_t svcd_scan_offset_placeholder[14] = {
}; };
static void mpeg1_encode_block(MpegEncContext *s, static void mpeg1_encode_block(MpegEncContext *s,
DCTELEM *block, int16_t *block,
int component); int component);
static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code); // RAL: f_code parameter added static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code); // RAL: f_code parameter added
@ -432,7 +432,7 @@ static inline void put_mb_modes(MpegEncContext *s, int n, int bits,
} }
static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y, int motion_x, int motion_y,
int mb_block_count) int mb_block_count)
{ {
@ -656,7 +656,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
} }
} }
void ff_mpeg1_encode_mb(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y) void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
{ {
if (s->chroma_format == CHROMA_420) mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6); if (s->chroma_format == CHROMA_420) mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6);
else mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 8); else mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 8);
@ -839,7 +839,7 @@ static inline void encode_dc(MpegEncContext *s, int diff, int component)
} }
static void mpeg1_encode_block(MpegEncContext *s, static void mpeg1_encode_block(MpegEncContext *s,
DCTELEM *block, int16_t *block,
int n) int n)
{ {
int alevel, level, last_non_zero, dc, diff, i, j, run, last_index, sign; int alevel, level, last_non_zero, dc, diff, i, j, run, last_index, sign;

View File

@ -83,9 +83,9 @@ extern const uint16_t ff_mpeg4_resync_prefix[8];
extern const uint8_t ff_mpeg4_dc_threshold[8]; extern const uint8_t ff_mpeg4_dc_threshold[8];
void ff_mpeg4_encode_mb(MpegEncContext *s, void ff_mpeg4_encode_mb(MpegEncContext *s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
void ff_mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, void ff_mpeg4_pred_ac(MpegEncContext * s, int16_t *block, int n,
int dir); int dir);
void ff_set_mpeg4_time(MpegEncContext * s); void ff_set_mpeg4_time(MpegEncContext * s);
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);

View File

@ -50,7 +50,7 @@ static const int mb_type_b_map[4]= {
* @param n block index (0-3 are luma, 4-5 are chroma) * @param n block index (0-3 are luma, 4-5 are chroma)
* @param dir the ac prediction direction * @param dir the ac prediction direction
*/ */
void ff_mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, void ff_mpeg4_pred_ac(MpegEncContext * s, int16_t *block, int n,
int dir) int dir)
{ {
int i; int i;
@ -841,7 +841,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
* Decode a block. * Decode a block.
* @return <0 if an error occurred * @return <0 if an error occurred
*/ */
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, static inline int mpeg4_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded, int intra, int rvlc) int n, int coded, int intra, int rvlc)
{ {
int level, i, last, run; int level, i, last, run;
@ -1065,7 +1065,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
* decode partition C of one MB. * decode partition C of one MB.
* @return <0 if an error occurred * @return <0 if an error occurred
*/ */
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64]) static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
{ {
int cbp, mb_type; int cbp, mb_type;
const int xy= s->mb_x + s->mb_y*s->mb_stride; const int xy= s->mb_x + s->mb_y*s->mb_stride;
@ -1148,7 +1148,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
} }
static int mpeg4_decode_mb(MpegEncContext *s, static int mpeg4_decode_mb(MpegEncContext *s,
DCTELEM block[6][64]) int16_t block[6][64])
{ {
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
int16_t *mot_val; int16_t *mot_val;

View File

@ -59,7 +59,7 @@ max run: 29/41
* Return the number of bits that encoding the 8x8 block in block would need. * Return the number of bits that encoding the 8x8 block in block would need.
* @param[in] block_last_index last index in scantable order that refers to a non zero element in block. * @param[in] block_last_index last index in scantable order that refers to a non zero element in block.
*/ */
static inline int get_block_rate(MpegEncContext * s, DCTELEM block[64], int block_last_index, uint8_t scantable[64]){ static inline int get_block_rate(MpegEncContext * s, int16_t block[64], int block_last_index, uint8_t scantable[64]){
int last=0; int last=0;
int j; int j;
int rate=0; int rate=0;
@ -91,7 +91,7 @@ static inline int get_block_rate(MpegEncContext * s, DCTELEM block[64], int bloc
* @param[out] st scantable for each 8x8 block * @param[out] st scantable for each 8x8 block
* @param[in] zigzag_last_index index referring to the last non zero coefficient in zigzag order * @param[in] zigzag_last_index index referring to the last non zero coefficient in zigzag order
*/ */
static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], const int zigzag_last_index[6]) static inline void restore_ac_coeffs(MpegEncContext * s, int16_t block[6][64], const int dir[6], uint8_t *st[6], const int zigzag_last_index[6])
{ {
int i, n; int i, n;
memcpy(s->block_last_index, zigzag_last_index, sizeof(int)*6); memcpy(s->block_last_index, zigzag_last_index, sizeof(int)*6);
@ -122,7 +122,7 @@ static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], c
* @param[out] st scantable for each 8x8 block * @param[out] st scantable for each 8x8 block
* @param[out] zigzag_last_index index referring to the last non zero coefficient in zigzag order * @param[out] zigzag_last_index index referring to the last non zero coefficient in zigzag order
*/ */
static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], int zigzag_last_index[6]) static inline int decide_ac_pred(MpegEncContext * s, int16_t block[6][64], const int dir[6], uint8_t *st[6], int zigzag_last_index[6])
{ {
int score= 0; int score= 0;
int i, n; int i, n;
@ -294,7 +294,7 @@ static inline int mpeg4_get_dc_length(int level, int n){
* Encode an 8x8 block. * Encode an 8x8 block.
* @param n block index (0-3 are luma, 4-5 are chroma) * @param n block index (0-3 are luma, 4-5 are chroma)
*/ */
static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, static inline void mpeg4_encode_block(MpegEncContext * s, int16_t * block, int n, int intra_dc,
uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb) uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
{ {
int i, last_non_zero; int i, last_non_zero;
@ -345,7 +345,7 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
} }
} }
static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, static int mpeg4_get_block_length(MpegEncContext * s, int16_t * block, int n, int intra_dc,
uint8_t *scan_table) uint8_t *scan_table)
{ {
int i, last_non_zero; int i, last_non_zero;
@ -396,7 +396,7 @@ static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, in
return len; return len;
} }
static inline void mpeg4_encode_blocks(MpegEncContext * s, DCTELEM block[6][64], int intra_dc[6], static inline void mpeg4_encode_blocks(MpegEncContext * s, int16_t block[6][64], int intra_dc[6],
uint8_t **scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb){ uint8_t **scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb){
int i; int i;
@ -425,7 +425,7 @@ static inline void mpeg4_encode_blocks(MpegEncContext * s, DCTELEM block[6][64],
} }
} }
static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64], static inline int get_b_cbp(MpegEncContext * s, int16_t block[6][64],
int motion_x, int motion_y, int mb_type) int motion_x, int motion_y, int mb_type)
{ {
int cbp = 0, i; int cbp = 0, i;
@ -469,7 +469,7 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
static const int dquant_code[5]= {1,0,9,2,3}; static const int dquant_code[5]= {1,0,9,2,3};
void ff_mpeg4_encode_mb(MpegEncContext * s, void ff_mpeg4_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
int cbpc, cbpy, pred_x, pred_y; int cbpc, cbpy, pred_x, pred_y;

View File

@ -43,19 +43,19 @@
//#include <assert.h> //#include <assert.h>
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_h263_intra_c(MpegEncContext *s, static void dct_unquantize_h263_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
static void dct_unquantize_h263_inter_c(MpegEncContext *s, static void dct_unquantize_h263_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale); int16_t *block, int n, int qscale);
/* enable all paranoid tests for rounding, overflows, etc... */ /* enable all paranoid tests for rounding, overflows, etc... */
@ -394,7 +394,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
} }
if (s->avctx->debug&FF_DEBUG_DCT_COEFF) { if (s->avctx->debug&FF_DEBUG_DCT_COEFF) {
FF_ALLOCZ_OR_GOTO(s->avctx, pic->f.dct_coeff, FF_ALLOCZ_OR_GOTO(s->avctx, pic->f.dct_coeff,
64 * mb_array_size * sizeof(DCTELEM) * 6, fail) 64 * mb_array_size * sizeof(int16_t) * 6, fail)
} }
pic->f.qstride = s->mb_stride; pic->f.qstride = s->mb_stride;
FF_ALLOCZ_OR_GOTO(s->avctx, pic->f.pan_scan, FF_ALLOCZ_OR_GOTO(s->avctx, pic->f.pan_scan,
@ -471,7 +471,7 @@ static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base)
2 * 64 * sizeof(int), fail) 2 * 64 * sizeof(int), fail)
} }
} }
FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64 * 12 * 2 * sizeof(DCTELEM), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64 * 12 * 2 * sizeof(int16_t), fail)
s->block = s->blocks[0]; s->block = s->blocks[0];
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
@ -2067,7 +2067,7 @@ unhandled:
/* put block[] to dest[] */ /* put block[] to dest[] */
static inline void put_dct(MpegEncContext *s, static inline void put_dct(MpegEncContext *s,
DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale) int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
{ {
s->dct_unquantize_intra(s, block, i, qscale); s->dct_unquantize_intra(s, block, i, qscale);
s->dsp.idct_put (dest, line_size, block); s->dsp.idct_put (dest, line_size, block);
@ -2075,7 +2075,7 @@ static inline void put_dct(MpegEncContext *s,
/* add block[] to dest[] */ /* add block[] to dest[] */
static inline void add_dct(MpegEncContext *s, static inline void add_dct(MpegEncContext *s,
DCTELEM *block, int i, uint8_t *dest, int line_size) int16_t *block, int i, uint8_t *dest, int line_size)
{ {
if (s->block_last_index[i] >= 0) { if (s->block_last_index[i] >= 0) {
s->dsp.idct_add (dest, line_size, block); s->dsp.idct_add (dest, line_size, block);
@ -2083,7 +2083,7 @@ static inline void add_dct(MpegEncContext *s,
} }
static inline void add_dequant_dct(MpegEncContext *s, static inline void add_dequant_dct(MpegEncContext *s,
DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale) int16_t *block, int i, uint8_t *dest, int line_size, int qscale)
{ {
if (s->block_last_index[i] >= 0) { if (s->block_last_index[i] >= 0) {
s->dct_unquantize_inter(s, block, i, qscale); s->dct_unquantize_inter(s, block, i, qscale);
@ -2136,7 +2136,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
s->interlaced_dct : true if interlaced dct used (mpeg2) s->interlaced_dct : true if interlaced dct used (mpeg2)
*/ */
static av_always_inline static av_always_inline
void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64],
int is_mpeg12) int is_mpeg12)
{ {
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
@ -2148,7 +2148,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
/* save DCT coefficients */ /* save DCT coefficients */
int i,j; int i,j;
DCTELEM *dct = &s->current_picture.f.dct_coeff[mb_xy * 64 * 6]; int16_t *dct = &s->current_picture.f.dct_coeff[mb_xy * 64 * 6];
av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y);
for(i=0; i<6; i++){ for(i=0; i<6; i++){
for(j=0; j<64; j++){ for(j=0; j<64; j++){
@ -2367,7 +2367,7 @@ skip_idct:
} }
} }
void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){ void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]){
#if !CONFIG_SMALL #if !CONFIG_SMALL
if(s->out_format == FMT_MPEG1) { if(s->out_format == FMT_MPEG1) {
MPV_decode_mb_internal(s, block, 1); MPV_decode_mb_internal(s, block, 1);
@ -2506,7 +2506,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){
} }
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const uint16_t *quant_matrix; const uint16_t *quant_matrix;
@ -2538,7 +2538,7 @@ static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
} }
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const uint16_t *quant_matrix; const uint16_t *quant_matrix;
@ -2567,7 +2567,7 @@ static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
} }
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const uint16_t *quant_matrix; const uint16_t *quant_matrix;
@ -2597,7 +2597,7 @@ static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
} }
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const uint16_t *quant_matrix; const uint16_t *quant_matrix;
@ -2630,7 +2630,7 @@ static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
} }
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, nCoeffs; int i, level, nCoeffs;
const uint16_t *quant_matrix; const uint16_t *quant_matrix;
@ -2661,7 +2661,7 @@ static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
} }
static void dct_unquantize_h263_intra_c(MpegEncContext *s, static void dct_unquantize_h263_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, qmul, qadd; int i, level, qmul, qadd;
int nCoeffs; int nCoeffs;
@ -2698,7 +2698,7 @@ static void dct_unquantize_h263_intra_c(MpegEncContext *s,
} }
static void dct_unquantize_h263_inter_c(MpegEncContext *s, static void dct_unquantize_h263_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale) int16_t *block, int n, int qscale)
{ {
int i, level, qmul, qadd; int i, level, qmul, qadd;
int nCoeffs; int nCoeffs;

View File

@ -669,39 +669,39 @@ typedef struct MpegEncContext {
uint8_t *ptr_lastgob; uint8_t *ptr_lastgob;
int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped
DCTELEM (*pblocks[12])[64]; int16_t (*pblocks[12])[64];
DCTELEM (*block)[64]; ///< points to one of the following blocks int16_t (*block)[64]; ///< points to one of the following blocks
DCTELEM (*blocks)[8][64]; // for HQ mode we need to keep the best block int16_t (*blocks)[8][64]; // for HQ mode we need to keep the best block
int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch() int (*decode_mb)(struct MpegEncContext *s, int16_t block[6][64]); // used by some codecs to avoid a switch()
#define SLICE_OK 0 #define SLICE_OK 0
#define SLICE_ERROR -1 #define SLICE_ERROR -1
#define SLICE_END -2 ///<end marker found #define SLICE_END -2 ///<end marker found
#define SLICE_NOEND -3 ///<no end marker or error found but mb count exceeded #define SLICE_NOEND -3 ///<no end marker or error found but mb count exceeded
void (*dct_unquantize_mpeg1_intra)(struct MpegEncContext *s, void (*dct_unquantize_mpeg1_intra)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg1_inter)(struct MpegEncContext *s, void (*dct_unquantize_mpeg1_inter)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg2_intra)(struct MpegEncContext *s, void (*dct_unquantize_mpeg2_intra)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg2_inter)(struct MpegEncContext *s, void (*dct_unquantize_mpeg2_inter)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h263_intra)(struct MpegEncContext *s, void (*dct_unquantize_h263_intra)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h263_inter)(struct MpegEncContext *s, void (*dct_unquantize_h263_inter)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h261_intra)(struct MpegEncContext *s, void (*dct_unquantize_h261_intra)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h261_inter)(struct MpegEncContext *s, void (*dct_unquantize_h261_inter)(struct MpegEncContext *s,
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both) void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both) void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
DCTELEM *block/*align 16*/, int n, int qscale); int16_t *block/*align 16*/, int n, int qscale);
int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow); int (*dct_quantize)(struct MpegEncContext *s, int16_t *block/*align 16*/, int n, int qscale, int *overflow);
int (*fast_dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow); int (*fast_dct_quantize)(struct MpegEncContext *s, int16_t *block/*align 16*/, int n, int qscale, int *overflow);
void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block); void (*denoise_dct)(struct MpegEncContext *s, int16_t *block);
int mpv_flags; ///< flags set by private options int mpv_flags; ///< flags set by private options
int quantizer_noise_shaping; int quantizer_noise_shaping;
@ -764,7 +764,7 @@ int ff_MPV_common_init(MpegEncContext *s);
int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize); int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize);
int ff_MPV_common_frame_size_change(MpegEncContext *s); int ff_MPV_common_frame_size_change(MpegEncContext *s);
void ff_MPV_common_end(MpegEncContext *s); void ff_MPV_common_end(MpegEncContext *s);
void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]); void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]);
int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx); int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
void ff_MPV_frame_end(MpegEncContext *s); void ff_MPV_frame_end(MpegEncContext *s);
int ff_MPV_encode_init(AVCodecContext *avctx); int ff_MPV_encode_init(AVCodecContext *avctx);
@ -784,7 +784,7 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
void ff_release_unused_pictures(MpegEncContext *s, int remove_current); void ff_release_unused_pictures(MpegEncContext *s, int remove_current);
int ff_find_unused_picture(MpegEncContext *s, int shared); int ff_find_unused_picture(MpegEncContext *s, int shared);
void ff_denoise_dct(MpegEncContext *s, DCTELEM *block); void ff_denoise_dct(MpegEncContext *s, int16_t *block);
int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir); int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir);
void ff_MPV_report_decode_progress(MpegEncContext *s); void ff_MPV_report_decode_progress(MpegEncContext *s);
@ -799,7 +799,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en
int ff_dct_common_init(MpegEncContext *s); int ff_dct_common_init(MpegEncContext *s);
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra); const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
int ff_dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); int ff_dct_quantize_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
void ff_init_block_index(MpegEncContext *s); void ff_init_block_index(MpegEncContext *s);
void ff_copy_picture(Picture *dst, Picture *src); void ff_copy_picture(Picture *dst, Picture *src);
@ -874,7 +874,7 @@ extern const uint8_t * const ff_mpeg2_dc_scale_table[4];
void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
void ff_mpeg1_encode_mb(MpegEncContext *s, void ff_mpeg1_encode_mb(MpegEncContext *s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
void ff_mpeg1_encode_init(MpegEncContext *s); void ff_mpeg1_encode_init(MpegEncContext *s);
void ff_mpeg1_encode_slice_header(MpegEncContext *s); void ff_mpeg1_encode_slice_header(MpegEncContext *s);
@ -889,7 +889,7 @@ extern const uint8_t ff_h263_loop_filter_strength[32];
void ff_h261_loop_filter(MpegEncContext *s); void ff_h261_loop_filter(MpegEncContext *s);
void ff_h261_reorder_mb_index(MpegEncContext* s); void ff_h261_reorder_mb_index(MpegEncContext* s);
void ff_h261_encode_mb(MpegEncContext *s, void ff_h261_encode_mb(MpegEncContext *s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number); void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_h261_encode_init(MpegEncContext *s); void ff_h261_encode_init(MpegEncContext *s);
@ -906,7 +906,7 @@ void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number);
void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number); void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_msmpeg4_encode_ext_header(MpegEncContext * s); void ff_msmpeg4_encode_ext_header(MpegEncContext * s);
void ff_msmpeg4_encode_mb(MpegEncContext * s, void ff_msmpeg4_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
int ff_msmpeg4_decode_picture_header(MpegEncContext * s); int ff_msmpeg4_decode_picture_header(MpegEncContext * s);
int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size); int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
@ -914,14 +914,14 @@ int ff_msmpeg4_decode_init(AVCodecContext *avctx);
void ff_msmpeg4_encode_init(MpegEncContext *s); void ff_msmpeg4_encode_init(MpegEncContext *s);
int ff_wmv2_decode_picture_header(MpegEncContext * s); int ff_wmv2_decode_picture_header(MpegEncContext * s);
int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s); int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr); void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
void ff_mspel_motion(MpegEncContext *s, void ff_mspel_motion(MpegEncContext *s,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4], uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
int motion_x, int motion_y, int h); int motion_x, int motion_y, int h);
int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number); int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_wmv2_encode_mb(MpegEncContext * s, void ff_wmv2_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
#endif /* AVCODEC_MPEGVIDEO_H */ #endif /* AVCODEC_MPEGVIDEO_H */

View File

@ -51,10 +51,10 @@
//#include <assert.h> //#include <assert.h>
static int encode_picture(MpegEncContext *s, int picture_number); static int encode_picture(MpegEncContext *s, int picture_number);
static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale); static int dct_quantize_refine(MpegEncContext *s, int16_t *block, int16_t *weight, int16_t *orig, int n, int qscale);
static int sse_mb(MpegEncContext *s); static int sse_mb(MpegEncContext *s);
static void denoise_dct_c(MpegEncContext *s, DCTELEM *block); static void denoise_dct_c(MpegEncContext *s, int16_t *block);
static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
/* enable all paranoid tests for rounding, overflows, etc... */ /* enable all paranoid tests for rounding, overflows, etc... */
//#define PARANOID //#define PARANOID
@ -1625,7 +1625,7 @@ static inline void dct_single_coeff_elimination(MpegEncContext *s,
int score = 0; int score = 0;
int run = 0; int run = 0;
int i; int i;
DCTELEM *block = s->block[n]; int16_t *block = s->block[n];
const int last_index = s->block_last_index[n]; const int last_index = s->block_last_index[n];
int skip_dc; int skip_dc;
@ -1665,7 +1665,7 @@ static inline void dct_single_coeff_elimination(MpegEncContext *s,
s->block_last_index[n] = -1; s->block_last_index[n] = -1;
} }
static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, static inline void clip_coeffs(MpegEncContext *s, int16_t *block,
int last_index) int last_index)
{ {
int i; int i;
@ -1729,7 +1729,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
int mb_block_count) int mb_block_count)
{ {
int16_t weight[8][64]; int16_t weight[8][64];
DCTELEM orig[8][64]; int16_t orig[8][64];
const int mb_x = s->mb_x; const int mb_x = s->mb_x;
const int mb_y = s->mb_y; const int mb_y = s->mb_y;
int i; int i;
@ -1979,7 +1979,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
get_visual_weight(weight[7], ptr_cr + (dct_offset >> 1), get_visual_weight(weight[7], ptr_cr + (dct_offset >> 1),
wrap_c); wrap_c);
} }
memcpy(orig[0], s->block[0], sizeof(DCTELEM) * 64 * mb_block_count); memcpy(orig[0], s->block[0], sizeof(int16_t) * 64 * mb_block_count);
} }
/* DCT & quantize */ /* DCT & quantize */
@ -2716,7 +2716,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD
const int last_qp= backup_s.qscale; const int last_qp= backup_s.qscale;
int qpi, qp, dc[6]; int qpi, qp, dc[6];
DCTELEM ac[6][16]; int16_t ac[6][16];
const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
static const int dquant_tab[4]={-1,1,-2,2}; static const int dquant_tab[4]={-1,1,-2,2};
@ -2741,7 +2741,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->mb_intra && s->dc_val[0]){ if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
dc[i]= s->dc_val[0][ s->block_index[i] ]; dc[i]= s->dc_val[0][ s->block_index[i] ];
memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16); memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(int16_t)*16);
} }
} }
@ -2751,7 +2751,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->mb_intra && s->dc_val[0]){ if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
s->dc_val[0][ s->block_index[i] ]= dc[i]; s->dc_val[0][ s->block_index[i] ]= dc[i];
memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(int16_t)*16);
} }
} }
} }
@ -3327,7 +3327,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
return 0; return 0;
} }
static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ static void denoise_dct_c(MpegEncContext *s, int16_t *block){
const int intra= s->mb_intra; const int intra= s->mb_intra;
int i; int i;
@ -3352,7 +3352,7 @@ static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){
} }
static int dct_quantize_trellis_c(MpegEncContext *s, static int dct_quantize_trellis_c(MpegEncContext *s,
DCTELEM *block, int n, int16_t *block, int n,
int qscale, int *overflow){ int qscale, int *overflow){
const int *qmat; const int *qmat;
const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *scantable= s->intra_scantable.scantable;
@ -3459,7 +3459,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
*overflow= s->max_qcoeff < max; //overflow might have happened *overflow= s->max_qcoeff < max; //overflow might have happened
if(last_non_zero < start_i){ if(last_non_zero < start_i){
memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); memset(block + start_i, 0, (64-start_i)*sizeof(int16_t));
return last_non_zero; return last_non_zero;
} }
@ -3591,7 +3591,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
dc= FFABS(block[0]); dc= FFABS(block[0]);
last_non_zero= last_i - 1; last_non_zero= last_i - 1;
memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); memset(block + start_i, 0, (64-start_i)*sizeof(int16_t));
if(last_non_zero < start_i) if(last_non_zero < start_i)
return last_non_zero; return last_non_zero;
@ -3666,10 +3666,10 @@ static void build_basis(uint8_t *perm){
} }
static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise?
DCTELEM *block, int16_t *weight, DCTELEM *orig, int16_t *block, int16_t *weight, int16_t *orig,
int n, int qscale){ int n, int qscale){
int16_t rem[64]; int16_t rem[64];
LOCAL_ALIGNED_16(DCTELEM, d1, [64]); LOCAL_ALIGNED_16(int16_t, d1, [64]);
const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *scantable= s->intra_scantable.scantable;
const uint8_t *perm_scantable= s->intra_scantable.permutated; const uint8_t *perm_scantable= s->intra_scantable.permutated;
// unsigned int threshold1, threshold2; // unsigned int threshold1, threshold2;
@ -4039,7 +4039,7 @@ STOP_TIMER("iterative search")
} }
int ff_dct_quantize_c(MpegEncContext *s, int ff_dct_quantize_c(MpegEncContext *s,
DCTELEM *block, int n, int16_t *block, int n,
int qscale, int *overflow) int qscale, int *overflow)
{ {
int i, j, level, last_non_zero, q, start_i; int i, j, level, last_non_zero, q, start_i;

View File

@ -44,7 +44,7 @@ void ff_xvmc_init_block(MpegEncContext *s)
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2]; struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
assert(render && render->xvmc_id == AV_XVMC_ID); assert(render && render->xvmc_id == AV_XVMC_ID);
s->block = (DCTELEM (*)[64])(render->data_blocks + render->next_free_data_block_num * 64); s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
} }
/** /**

View File

@ -406,7 +406,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
return val; return val;
} }
static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
{ {
int cbp, code, i; int cbp, code, i;
@ -492,7 +492,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
return 0; return 0;
} }
static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64])
{ {
int cbp, code, i; int cbp, code, i;
uint8_t *coded_val; uint8_t *coded_val;
@ -934,7 +934,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
} }
//#define ERROR_DETAILS //#define ERROR_DETAILS
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded, const uint8_t *scan_table) int n, int coded, const uint8_t *scan_table)
{ {
int level, i, last, run, run_diff; int level, i, last, run, run_diff;

View File

@ -26,7 +26,6 @@
#include "config.h" #include "config.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "msmpeg4data.h" #include "msmpeg4data.h"
#include "put_bits.h" #include "put_bits.h"
@ -45,17 +44,17 @@ extern VLC ff_inter_intra_vlc;
void ff_msmpeg4_code012(PutBitContext *pb, int n); void ff_msmpeg4_code012(PutBitContext *pb, int n);
void ff_msmpeg4_common_init(MpegEncContext *s); void ff_msmpeg4_common_init(MpegEncContext *s);
void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n); void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n);
void ff_msmpeg4_handle_slices(MpegEncContext *s); void ff_msmpeg4_handle_slices(MpegEncContext *s);
void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my); void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my);
int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n,
uint8_t **coded_block_ptr); uint8_t **coded_block_ptr);
int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr); int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr);
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block,
int n, int coded, const uint8_t *scan_table); int n, int coded, const uint8_t *scan_table);
int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
int16_t **dc_val_ptr, int *dir_ptr); int16_t **dc_val_ptr, int *dir_ptr);
int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]);
#define CONFIG_MSMPEG4_DECODER (CONFIG_MSMPEG4V1_DECODER || \ #define CONFIG_MSMPEG4_DECODER (CONFIG_MSMPEG4V1_DECODER || \
CONFIG_MSMPEG4V2_DECODER || \ CONFIG_MSMPEG4V2_DECODER || \

View File

@ -368,7 +368,7 @@ static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
} }
void ff_msmpeg4_encode_mb(MpegEncContext * s, void ff_msmpeg4_encode_mb(MpegEncContext * s,
DCTELEM block[6][64], int16_t block[6][64],
int motion_x, int motion_y) int motion_x, int motion_y)
{ {
int cbp, coded_cbp, i; int cbp, coded_cbp, i;
@ -569,7 +569,7 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
/* Encoding of a block. Very similar to MPEG4 except for a different /* Encoding of a block. Very similar to MPEG4 except for a different
escape coding (same as H263) and more vlc tables. escape coding (same as H263) and more vlc tables.
*/ */
void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n) void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n)
{ {
int level, run, last, i, j, last_index; int level, run, last, i, j, last_index;
int last_non_zero, sign, slevel; int last_non_zero, sign, slevel;

View File

@ -476,7 +476,7 @@ static int pix_sum_altivec(uint8_t * pix, int line_size)
return s; return s;
} }
static void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, int line_size) static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels, int line_size)
{ {
int i; int i;
vector unsigned char perm = vec_lvsl(0, pixels); vector unsigned char perm = vec_lvsl(0, pixels);
@ -502,7 +502,7 @@ static void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, i
} }
} }
static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1, static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
const uint8_t *s2, int stride) const uint8_t *s2, int stride)
{ {
int i; int i;
@ -576,7 +576,7 @@ static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
} }
static void clear_block_altivec(DCTELEM *block) { static void clear_block_altivec(int16_t *block) {
LOAD_ZERO; LOAD_ZERO;
vec_st(zero_s16v, 0, block); vec_st(zero_s16v, 0, block);
vec_st(zero_s16v, 16, block); vec_st(zero_s16v, 16, block);

Some files were not shown because too many files have changed in this diff Show More