Commit b0368839 authored by Michael Niedermayer's avatar Michael Niedermayer

MpegEncContext.(i)dct_* -> DspContext.(i)dct_*

bitexact cleanup

Originally committed as revision 1617 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent a5dbb247
......@@ -154,6 +154,7 @@ static int do_play = 0;
static int do_psnr = 0;
static int do_vstats = 0;
static int do_pass = 0;
static int bitexact = 0;
static char *pass_logfilename = NULL;
static int audio_stream_copy = 0;
static int video_stream_copy = 0;
......@@ -2075,6 +2076,9 @@ static void opt_input_file(const char *filename)
enc->flags|= CODEC_FLAG_TRUNCATED; */
if(/*enc->codec_id==CODEC_ID_MPEG4 || */enc->codec_id==CODEC_ID_MPEG1VIDEO)
enc->flags|= CODEC_FLAG_TRUNCATED;
if(bitexact)
enc->flags|= CODEC_FLAG_BITEXACT;
if (enc->frame_rate != rfps) {
fprintf(stderr,"\nSeems that stream %d comes from film source: %2.2f->%2.2f\n",
......@@ -2219,7 +2223,10 @@ static void opt_output_file(const char *filename)
video_enc->flags |= CODEC_FLAG_QSCALE;
st->quality = video_qscale;
}
if(bitexact)
video_enc->flags |= CODEC_FLAG_BITEXACT;
if (use_hq) {
video_enc->flags |= CODEC_FLAG_HQ;
}
......@@ -2557,7 +2564,7 @@ extern int ffm_nopts;
static void opt_bitexact(void)
{
avcodec_set_bit_exact();
bitexact=1;
/* disable generate of real time pts in ffm (need to be supressed anyway) */
ffm_nopts = 1;
}
......
......@@ -20,6 +20,9 @@
#include "asm.h"
#include "../dsputil.h"
extern void simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block);
extern void simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block);
void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
int line_size, int h);
void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels,
......@@ -295,7 +298,7 @@ static int sad8x8_mvi(void *s, uint8_t *a, uint8_t *b, int stride)
return pix_abs8x8_mvi(a, b, stride);
}
void dsputil_init_alpha(DSPContext* c, unsigned mask)
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
{
c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
......@@ -357,4 +360,7 @@ void dsputil_init_alpha(DSPContext* c, unsigned mask)
put_pixels_clamped_axp_p = c->put_pixels_clamped;
add_pixels_clamped_axp_p = c->add_pixels_clamped;
c->idct_put = simple_idct_put_axp;
c->idct_add = simple_idct_add_axp;
}
......@@ -21,9 +21,6 @@
#include "../dsputil.h"
#include "../mpegvideo.h"
extern void simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block);
extern void simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block);
static void dct_unquantize_h263_axp(MpegEncContext *s, DCTELEM *block,
int n, int qscale)
{
......@@ -97,6 +94,4 @@ static void dct_unquantize_h263_axp(MpegEncContext *s, DCTELEM *block,
void MPV_common_init_axp(MpegEncContext *s)
{
s->dct_unquantize_h263 = dct_unquantize_h263_axp;
s->idct_put = simple_idct_put_axp;
s->idct_add = simple_idct_add_axp;
}
......@@ -21,7 +21,33 @@
extern void j_rev_dct_ARM(DCTELEM *data);
void dsputil_init_armv4l(DSPContext* c, unsigned mask)
/* XXX: local hack */
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
/* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */
static void arm_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct_ARM (block);
ff_put_pixels_clamped(block, dest, line_size);
}
static void arm_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct_ARM (block);
ff_add_pixels_clamped(block, dest, line_size);
}
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx)
{
// ff_idct = j_rev_dct_ARM;
const int idct_algo= avctx->idct_algo;
ff_put_pixels_clamped = c->put_pixels_clamped;
ff_add_pixels_clamped = c->add_pixels_clamped;
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){
c->idct_put= arm_idct_put;
c->idct_add= arm_idct_add;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;/* FF_NO_IDCT_PERM */
}
}
......@@ -21,35 +21,6 @@
#include "../mpegvideo.h"
#include "../avcodec.h"
extern void j_rev_dct_ARM(DCTELEM *data);
/* XXX: local hack */
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
/* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */
static void arm_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct_ARM (block);
ff_put_pixels_clamped(block, dest, line_size);
}
static void arm_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct_ARM (block);
ff_add_pixels_clamped(block, dest, line_size);
}
void MPV_common_init_armv4l(MpegEncContext *s)
{
int i;
const int idct_algo= s->avctx->idct_algo;
ff_put_pixels_clamped = s->dsp.put_pixels_clamped;
ff_add_pixels_clamped = s->dsp.add_pixels_clamped;
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){
s->idct_put= arm_idct_put;
s->idct_add= arm_idct_add;
s->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;/* FF_NO_IDCT_PERM */
}
}
......@@ -16,8 +16,8 @@ extern "C" {
#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6"
#define LIBAVCODEC_BUILD 4659
#define LIBAVCODEC_BUILD_STR "4659"
#define LIBAVCODEC_BUILD 4660
#define LIBAVCODEC_BUILD_STR "4660"
enum CodecID {
CODEC_ID_NONE,
......@@ -159,6 +159,7 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
#define CODEC_FLAG_ALT_SCAN 0x00100000 /* use alternate scan */
#define CODEC_FLAG_TRELLIS_QUANT 0x00200000 /* use trellis quantization */
#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 /* place global headers in extradata instead of every keyframe */
#define CODEC_FLAG_BITEXACT 0x00800000 /* use only bitexact stuff (except (i)dct) */
/* codec capabilities */
......@@ -1167,8 +1168,6 @@ unsigned avcodec_version(void);
unsigned avcodec_build(void);
void avcodec_init(void);
void avcodec_set_bit_exact(void);
void register_avcodec(AVCodec *format);
AVCodec *avcodec_find_encoder(enum CodecID id);
AVCodec *avcodec_find_encoder_by_name(const char *name);
......
......@@ -21,8 +21,8 @@
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include "simple_idct.h"
int ff_bit_exact=0;
uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
uint32_t squareTbl[512];
......@@ -99,6 +99,18 @@ const uint32_t inverse[256]={
17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010,
};
/* Input permutation for the simple_idct_mmx */
static const uint8_t simple_mmx_permutation[64]={
0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
};
static int pix_sum_c(uint8_t * pix, int line_size)
{
int s, i, j;
......@@ -1787,7 +1799,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
int sum=0, i;
s->dsp.diff_pixels(temp, src1, src2, stride);
s->fdct(temp);
s->dsp.fdct(temp);
for(i=0; i<64; i++)
sum+= ABS(temp[i]);
......@@ -1887,7 +1899,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int
s->dct_unquantize(s, temp, 0, s->qscale);
}
s->idct_add(bak, stride, temp);
s->dsp.idct_add(bak, stride, temp);
distoration= s->dsp.sse[1](NULL, bak, src1, stride);
......@@ -1959,7 +1971,20 @@ WARPER88_1616(quant_psnr8x8_c, quant_psnr16x16_c)
WARPER88_1616(rd8x8_c, rd16x16_c)
WARPER88_1616(bit8x8_c, bit16x16_c)
void dsputil_init(DSPContext* c, unsigned mask)
/* XXX: those functions should be suppressed ASAP when all IDCTs are
converted */
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct (block);
put_pixels_clamped_c(block, dest, line_size);
}
static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
j_rev_dct (block);
add_pixels_clamped_c(block, dest, line_size);
}
void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
static int init_done = 0;
int i;
......@@ -1980,6 +2005,23 @@ void dsputil_init(DSPContext* c, unsigned mask)
init_done = 1;
}
#ifdef CONFIG_ENCODERS
if(avctx->dct_algo==FF_DCT_FASTINT)
c->fdct = fdct_ifast;
else
c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
#endif //CONFIG_ENCODERS
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else{ //accurate/default
c->idct_put= simple_idct_put;
c->idct_add= simple_idct_add;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
c->get_pixels = get_pixels_c;
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = put_pixels_clamped_c;
......@@ -2082,37 +2124,43 @@ void dsputil_init(DSPContext* c, unsigned mask)
c->diff_bytes= diff_bytes_c;
#ifdef HAVE_MMX
dsputil_init_mmx(c, mask);
if (ff_bit_exact)
{
/* FIXME - AVCodec context should have flag for bitexact match */
/* fprintf(stderr, "\n\n\nff_bit_exact %d\n\n\n\n", ff_bit_exact); */
dsputil_set_bit_exact_mmx(c, mask);
}
dsputil_init_mmx(c, avctx);
#endif
#ifdef ARCH_ARMV4L
dsputil_init_armv4l(c, mask);
dsputil_init_armv4l(c, avctx);
#endif
#ifdef HAVE_MLIB
dsputil_init_mlib(c, mask);
dsputil_init_mlib(c, avctx);
#endif
#ifdef ARCH_ALPHA
dsputil_init_alpha(c, mask);
dsputil_init_alpha(c, avctx);
#endif
#ifdef ARCH_POWERPC
dsputil_init_ppc(c, mask);
dsputil_init_ppc(c, avctx);
#endif
#ifdef HAVE_MMI
dsputil_init_mmi(c, mask);
dsputil_init_mmi(c, avctx);
#endif
}
/* remove any non bit exact operation (testing purpose) */
void avcodec_set_bit_exact(void)
{
ff_bit_exact=1;
#ifdef HAVE_MMX
// FIXME - better set_bit_exact
// dsputil_set_bit_exact_mmx();
#endif
switch(c->idct_permutation_type){
case FF_NO_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= i;
break;
case FF_LIBMPEG2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= simple_mmx_permutation[i];
break;
case FF_TRANSPOSE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
default:
fprintf(stderr, "Internal error, IDCT permutation not set\n");
}
}
......@@ -149,9 +149,21 @@ typedef struct DSPContext {
/* huffyuv specific */
void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
/* (I)DCT */
void (*fdct)(DCTELEM *block/* align 16*/);
void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
uint8_t idct_permutation[64];
int idct_permutation_type;
#define FF_NO_IDCT_PERM 1
#define FF_LIBMPEG2_IDCT_PERM 2
#define FF_SIMPLE_IDCT_PERM 3
#define FF_TRANSPOSE_IDCT_PERM 4
} DSPContext;
void dsputil_init(DSPContext* p, unsigned mask);
void dsputil_init(DSPContext* p, AVCodecContext *avctx);
/**
* permute block according to permuatation.
......@@ -194,11 +206,8 @@ static inline void emms(void)
#define __align8 __attribute__ ((aligned (8)))
void dsputil_init_mmx(DSPContext* c, unsigned mask);
void dsputil_set_bit_exact_mmx(DSPContext* c, unsigned mask);
void dsputil_init_pix_mmx(DSPContext* c, unsigned mask);
void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask);
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
#elif defined(ARCH_ARMV4L)
......@@ -206,20 +215,20 @@ void dsputil_set_bit_exact_pix_mmx(DSPContext* c, unsigned mask);
line ptimizations */
#define __align8 __attribute__ ((aligned (4)))
void dsputil_init_armv4l(DSPContext* c, unsigned mask);
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
#elif defined(HAVE_MLIB)
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
#define __align8 __attribute__ ((aligned (8)))
void dsputil_init_mlib(DSPContext* c, unsigned mask);
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
#elif defined(ARCH_ALPHA)
#define __align8 __attribute__ ((aligned (8)))
void dsputil_init_alpha(DSPContext* c, unsigned mask);
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
#elif defined(ARCH_POWERPC)
......@@ -233,13 +242,13 @@ extern int mm_flags;
#define __align8 __attribute__ ((aligned (16)))
void dsputil_init_ppc(DSPContext* c, unsigned mask);
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
#elif defined(HAVE_MMI)
#define __align8 __attribute__ ((aligned (16)))
void dsputil_init_mmi(DSPContext* c, unsigned mask);
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
#else
......
......@@ -115,12 +115,12 @@ static int dvvideo_decode_init(AVCodecContext *avctx)
/* XXX: fix it */
memset(&s2, 0, sizeof(MpegEncContext));
s2.avctx = avctx;
dsputil_init(&s2.dsp, avctx->dsp_mask);
dsputil_init(&s2.dsp, avctx);
if (DCT_common_init(&s2) < 0)
return -1;
s->idct_put[0] = s2.idct_put;
memcpy(s->idct_permutation, s2.idct_permutation, 64);
s->idct_put[0] = s2.dsp.idct_put;
memcpy(s->idct_permutation, s2.dsp.idct_permutation, 64);
memcpy(s->dv_zigzag[0], s2.intra_scantable.permutated, 64);
/* XXX: use MMX also for idct248 */
......
......@@ -297,19 +297,19 @@ static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], int d
if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
/* same qscale */
for(i=1; i<8; i++){
const int level= block[n][s->idct_permutation[i ]];
const int level= block[n][s->dsp.idct_permutation[i ]];
score0+= ABS(level);
score1+= ABS(level - ac_val[i+8]);
ac_val1[i ]= block[n][s->idct_permutation[i<<3]];
ac_val1[i ]= block[n][s->dsp.idct_permutation[i<<3]];
ac_val1[i+8]= level;
}
}else{
/* different qscale, we must rescale */
for(i=1; i<8; i++){
const int level= block[n][s->idct_permutation[i ]];
const int level= block[n][s->dsp.idct_permutation[i ]];
score0+= ABS(level);
score1+= ABS(level - ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale));
ac_val1[i ]= block[n][s->idct_permutation[i<<3]];
ac_val1[i ]= block[n][s->dsp.idct_permutation[i<<3]];
ac_val1[i+8]= level;
}
}
......@@ -320,20 +320,20 @@ static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], int d
if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
/* same qscale */
for(i=1; i<8; i++){
const int level= block[n][s->idct_permutation[i<<3]];
const int level= block[n][s->dsp.idct_permutation[i<<3]];
score0+= ABS(level);
score1+= ABS(level - ac_val[i]);
ac_val1[i ]= level;
ac_val1[i+8]= block[n][s->idct_permutation[i ]];
ac_val1[i+8]= block[n][s->dsp.idct_permutation[i ]];
}
}else{
/* different qscale, we must rescale */
for(i=1; i<8; i++){
const int level= block[n][s->idct_permutation[i<<3]];
const int level= block[n][s->dsp.idct_permutation[i<<3]];
score0+= ABS(level);
score1+= ABS(level - ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale));
ac_val1[i ]= level;
ac_val1[i+8]= block[n][s->idct_permutation[i ]];
ac_val1[i+8]= block[n][s->dsp.idct_permutation[i ]];
}
}
}
......@@ -831,10 +831,10 @@ void mpeg4_encode_mb(MpegEncContext * s,
if(dir[i]){
for(j=1; j<8; j++)
block[i][s->idct_permutation[j ]]= ac_val[j+8];
block[i][s->dsp.idct_permutation[j ]]= ac_val[j+8];
}else{
for(j=1; j<8; j++)
block[i][s->idct_permutation[j<<3]]= ac_val[j ];
block[i][s->dsp.idct_permutation[j<<3]]= ac_val[j ];
}
s->block_last_index[i]= zigzag_last_index[i];
}
......@@ -1059,7 +1059,7 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
if (a != 1024) {
ac_val -= 16;
for(i=1;i<8;i++) {
block[s->idct_permutation[i<<3]] += ac_val[i];
block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
}
pred_dc = a;
}
......@@ -1068,7 +1068,7 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
if (c != 1024) {
ac_val -= 16 * wrap;
for(i=1;i<8;i++) {
block[s->idct_permutation[i ]] += ac_val[i + 8];
block[s->dsp.idct_permutation[i ]] += ac_val[i + 8];
}
pred_dc = c;
}
......@@ -1096,10 +1096,10 @@ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
/* left copy */
for(i=1;i<8;i++)
ac_val1[i ] = block[s->idct_permutation[i<<3]];
ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]];
/* top copy */
for(i=1;i<8;i++)
ac_val1[8 + i] = block[s->idct_permutation[i ]];
ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]];
}
int16_t *h263_pred_motion(MpegEncContext * s, int block,
......@@ -1752,7 +1752,7 @@ static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_n
ff_mpeg4_stuffing(&s->pb);
/* user data */
if(!ff_bit_exact){
if(!(s->flags & CODEC_FLAG_BITEXACT)){
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1B2); /* user_data */
sprintf(buf, "FFmpeg%sb%s", FFMPEG_VERSION, LIBAVCODEC_BUILD_STR);
......@@ -1926,12 +1926,12 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
/* same qscale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i<<3]] += ac_val[i];
block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
}
}else{
/* different qscale, we must rescale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
block[s->dsp.idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
}
}
} else {
......@@ -1942,23 +1942,23 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
/* same qscale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i]] += ac_val[i + 8];
block[s->dsp.idct_permutation[i]] += ac_val[i + 8];
}
}else{
/* different qscale, we must rescale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
}
}
}
}
/* left copy */
for(i=1;i<8;i++)
ac_val1[i ] = block[s->idct_permutation[i<<3]];
ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]];
/* top copy */
for(i=1;i<8;i++)
ac_val1[8 + i] = block[s->idct_permutation[i ]];
ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]];
}
......@@ -1981,12 +1981,12 @@ static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
/* same qscale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i<<3]] -= ac_val[i];
block[s->dsp.idct_permutation[i<<3]] -= ac_val[i];
}
}else{
/* different qscale, we must rescale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i<<3]] -= ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
block[s->dsp.idct_permutation[i<<3]] -= ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
}
}
} else {
......@@ -1996,12 +1996,12 @@ static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
/* same qscale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i]] -= ac_val[i + 8];
block[s->dsp.idct_permutation[i]] -= ac_val[i + 8];
}
}else{
/* different qscale, we must rescale */
for(i=1;i<8;i++) {
block[s->idct_permutation[i]] -= ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
block[s->dsp.idct_permutation[i]] -= ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);