aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-18 20:05:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-18 20:07:00 +0200
commit82edf6727f0663601351081ca1e4fb20d1752972 (patch)
tree12479c3ec8cedfa0ec4dda38a72023224f2b5b73 /libavcodec
parentf87dacb27de93f995cb18f9dcc73581ef8fc157b (diff)
parentf61ce90caa909d131ea6ec205823568a38115529 (diff)
downloadffmpeg-82edf6727f0663601351081ca1e4fb20d1752972.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs Add Dolby/DPLII downmix support to libavresample vorbisdec: replace div/mod in loop with a counter fate: vorbis: add 5.1 surround test rtpenc: Allow requesting H264 RTP packetization mode 0 configure: Sort the library listings in the help text alphabetically dwt: remove variable-length arrays RTMPT protocol support http: Properly handle chunked transfer-encoding for replies to post data http: Fail reading if the connection has gone away amr: Mark an array const amr: More space cleanup rtpenc: Fix memory leaks in the muxer open function Conflicts: Changelog configure doc/APIchanges libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dwt.c109
-rw-r--r--libavcodec/dwt.h18
-rw-r--r--libavcodec/snow.c4
-rw-r--r--libavcodec/snow.h2
-rw-r--r--libavcodec/snowdec.c2
-rw-r--r--libavcodec/snowenc.c12
-rw-r--r--libavcodec/vorbisdec.c17
-rw-r--r--libavcodec/x86/snowdsp_mmx.c6
8 files changed, 91 insertions, 79 deletions
diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
index 6c1f1310a3..3980f065b8 100644
--- a/libavcodec/dwt.c
+++ b/libavcodec/dwt.c
@@ -245,9 +245,8 @@ static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src,
}
#endif /* ! liftS */
-static void horizontal_decompose53i(DWTELEM *b, int width)
+static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)
{
- DWTELEM temp[width];
const int width2 = width >> 1;
int x;
const int w2 = (width + 1) >> 1;
@@ -313,8 +312,8 @@ static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
b1[i] += (b0[i] + b2[i] + 2) >> 2;
}
-static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
- int stride)
+static void spatial_decompose53i(DWTELEM *buffer, DWTELEM *temp,
+ int width, int height, int stride)
{
int y;
DWTELEM *b0 = buffer + mirror(-2 - 1, height - 1) * stride;
@@ -325,9 +324,9 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
DWTELEM *b3 = buffer + mirror(y + 2, height - 1) * stride;
if (y + 1 < (unsigned)height)
- horizontal_decompose53i(b2, width);
+ horizontal_decompose53i(b2, temp, width);
if (y + 2 < (unsigned)height)
- horizontal_decompose53i(b3, width);
+ horizontal_decompose53i(b3, temp, width);
if (y + 1 < (unsigned)height)
vertical_decompose53iH0(b1, b2, b3, width);
@@ -339,9 +338,8 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
}
}
-static void horizontal_decompose97i(DWTELEM *b, int width)
+static void horizontal_decompose97i(DWTELEM *b, DWTELEM *temp, int width)
{
- DWTELEM temp[width];
const int w2 = (width + 1) >> 1;
lift(temp + w2, b + 1, b, 1, 2, 2, width, W_AM, W_AO, W_AS, 1, 1);
@@ -391,8 +389,8 @@ static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
b1[i] += (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
}
-static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
- int stride)
+static void spatial_decompose97i(DWTELEM *buffer, DWTELEM *temp,
+ int width, int height, int stride)
{
int y;
DWTELEM *b0 = buffer + mirror(-4 - 1, height - 1) * stride;
@@ -405,9 +403,9 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
DWTELEM *b5 = buffer + mirror(y + 4, height - 1) * stride;
if (y + 3 < (unsigned)height)
- horizontal_decompose97i(b4, width);
+ horizontal_decompose97i(b4, temp, width);
if (y + 4 < (unsigned)height)
- horizontal_decompose97i(b5, width);
+ horizontal_decompose97i(b5, temp, width);
if (y + 3 < (unsigned)height)
vertical_decompose97iH0(b3, b4, b5, width);
@@ -425,20 +423,20 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
}
}
-void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
- int type, int decomposition_count)
+void ff_spatial_dwt(DWTELEM *buffer, DWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count)
{
int level;
for (level = 0; level < decomposition_count; level++) {
switch (type) {
case DWT_97:
- spatial_decompose97i(buffer,
+ spatial_decompose97i(buffer, temp,
width >> level, height >> level,
stride << level);
break;
case DWT_53:
- spatial_decompose53i(buffer,
+ spatial_decompose53i(buffer, temp,
width >> level, height >> level,
stride << level);
break;
@@ -446,9 +444,8 @@ void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
}
}
-static void horizontal_compose53i(IDWTELEM *b, int width)
+static void horizontal_compose53i(IDWTELEM *b, IDWTELEM *temp, int width)
{
- IDWTELEM temp[width];
const int width2 = width >> 1;
const int w2 = (width + 1) >> 1;
int x;
@@ -508,6 +505,7 @@ static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer,
}
static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
+ IDWTELEM *temp,
int width, int height,
int stride_line)
{
@@ -537,17 +535,18 @@ static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
}
if (y - 1 < (unsigned)height)
- horizontal_compose53i(b0, width);
+ horizontal_compose53i(b0, temp, width);
if (y + 0 < (unsigned)height)
- horizontal_compose53i(b1, width);
+ horizontal_compose53i(b1, temp, width);
cs->b0 = b2;
cs->b1 = b3;
cs->y += 2;
}
-static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
- int height, int stride)
+static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride)
{
int y = cs->y;
IDWTELEM *b0 = cs->b0;
@@ -561,27 +560,26 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
vertical_compose53iH0(b0, b1, b2, width);
if (y - 1 < (unsigned)height)
- horizontal_compose53i(b0, width);
+ horizontal_compose53i(b0, temp, width);
if (y + 0 < (unsigned)height)
- horizontal_compose53i(b1, width);
+ horizontal_compose53i(b1, temp, width);
cs->b0 = b2;
cs->b1 = b3;
cs->y += 2;
}
-static void av_unused spatial_compose53i(IDWTELEM *buffer, int width,
- int height, int stride)
+static void av_unused spatial_compose53i(IDWTELEM *buffer, IDWTELEM *temp,
+ int width, int height, int stride)
{
DWTCompose cs;
spatial_compose53i_init(&cs, buffer, height, stride);
while (cs.y <= height)
- spatial_compose53i_dy(&cs, buffer, width, height, stride);
+ spatial_compose53i_dy(&cs, buffer, temp, width, height, stride);
}
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width)
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
{
- IDWTELEM temp[width];
const int w2 = (width + 1) >> 1;
#if 0 //maybe more understadable but slower
@@ -695,8 +693,9 @@ static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height
}
static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
- slice_buffer *sb, int width,
- int height, int stride_line)
+ slice_buffer * sb, IDWTELEM *temp,
+ int width, int height,
+ int stride_line)
{
int y = cs->y;
@@ -725,9 +724,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
}
if (y - 1 < (unsigned)height)
- dsp->horizontal_compose97i(b0, width);
+ dsp->horizontal_compose97i(b0, temp, width);
if (y + 0 < (unsigned)height)
- dsp->horizontal_compose97i(b1, width);
+ dsp->horizontal_compose97i(b1, temp, width);
cs->b0 = b2;
cs->b1 = b3;
@@ -736,8 +735,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
cs->y += 2;
}
-static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
- int height, int stride)
+static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride)
{
int y = cs->y;
IDWTELEM *b0 = cs->b0;
@@ -757,9 +757,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
vertical_compose97iH0(b0, b1, b2, width);
if (y - 1 < (unsigned)height)
- ff_snow_horizontal_compose97i(b0, width);
+ ff_snow_horizontal_compose97i(b0, temp, width);
if (y + 0 < (unsigned)height)
- ff_snow_horizontal_compose97i(b1, width);
+ ff_snow_horizontal_compose97i(b1, temp, width);
cs->b0 = b2;
cs->b1 = b3;
@@ -768,13 +768,13 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
cs->y += 2;
}
-static void av_unused spatial_compose97i(IDWTELEM *buffer, int width,
- int height, int stride)
+static void av_unused spatial_compose97i(IDWTELEM *buffer, IDWTELEM *temp,
+ int width, int height, int stride)
{
DWTCompose cs;
spatial_compose97i_init(&cs, buffer, height, stride);
while (cs.y <= height)
- spatial_compose97i_dy(&cs, buffer, width, height, stride);
+ spatial_compose97i_dy(&cs, buffer, temp, width, height, stride);
}
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
@@ -797,9 +797,9 @@ void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
}
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
- slice_buffer *slice_buf, int width,
- int height, int stride_line, int type,
- int decomposition_count, int y)
+ slice_buffer *slice_buf, IDWTELEM *temp,
+ int width, int height, int stride_line,
+ int type, int decomposition_count, int y)
{
const int support = type == 1 ? 3 : 5;
int level;
@@ -810,13 +810,13 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
switch (type) {
case DWT_97:
- spatial_compose97i_dy_buffered(dsp, cs + level, slice_buf,
+ spatial_compose97i_dy_buffered(dsp, cs + level, slice_buf, temp,
width >> level,
height >> level,
stride_line << level);
break;
case DWT_53:
- spatial_compose53i_dy_buffered(cs + level, slice_buf,
+ spatial_compose53i_dy_buffered(cs + level, slice_buf, temp,
width >> level,
height >> level,
stride_line << level);
@@ -844,8 +844,9 @@ static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width,
}
}
-static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
- int height, int stride, int type,
+static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride, int type,
int decomposition_count, int y)
{
const int support = type == 1 ? 3 : 5;
@@ -857,26 +858,26 @@ static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
switch (type) {
case DWT_97:
- spatial_compose97i_dy(cs + level, buffer, width >> level,
+ spatial_compose97i_dy(cs + level, buffer, temp, width >> level,
height >> level, stride << level);
break;
case DWT_53:
- spatial_compose53i_dy(cs + level, buffer, width >> level,
+ spatial_compose53i_dy(cs + level, buffer, temp, width >> level,
height >> level, stride << level);
break;
}
}
}
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride,
- int type, int decomposition_count)
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count)
{
DWTCompose cs[MAX_DECOMPOSITIONS];
int y;
ff_spatial_idwt_init(cs, buffer, width, height, stride, type,
decomposition_count);
for (y = 0; y < height; y += 4)
- ff_spatial_idwt_slice(cs, buffer, width, height, stride, type,
+ ff_spatial_idwt_slice(cs, buffer, temp, width, height, stride, type,
decomposition_count, y);
}
@@ -885,7 +886,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
{
int s, i, j;
const int dec_count = w == 8 ? 3 : 4;
- int tmp[32 * 32];
+ int tmp[32 * 32], tmp2[32];
int level, ori;
static const int scale[2][2][4][4] = {
{
@@ -927,7 +928,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
pix2 += line_size;
}
- ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
+ ff_spatial_dwt(tmp, tmp2, w, h, 32, type, dec_count);
s = 0;
assert(w == h);
diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h
index aa7d98dc28..53e1aaab06 100644
--- a/libavcodec/dwt.h
+++ b/libavcodec/dwt.h
@@ -79,7 +79,7 @@ typedef struct DWTContext {
void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
int width);
- void (*horizontal_compose97i)(IDWTELEM *b, int width);
+ void (*horizontal_compose97i)(IDWTELEM *b, IDWTELEM *temp, int width);
void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride,
uint8_t **block, int b_w, int b_h, int src_x,
int src_y, int src_stride, slice_buffer *sb,
@@ -239,7 +239,7 @@ IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
int width);
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
uint8_t **block, int b_w, int b_h, int src_x,
int src_y, int src_stride, slice_buffer *sb,
@@ -248,18 +248,18 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type,
- int decomposition_count);
+void ff_spatial_dwt(int *buffer, int *temp, int width, int height, int stride,
+ int type, int decomposition_count);
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
int height, int stride_line, int type,
int decomposition_count);
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
- slice_buffer *slice_buf, int width,
- int height, int stride_line, int type,
- int decomposition_count, int y);
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride,
- int type, int decomposition_count);
+ slice_buffer *slice_buf, IDWTELEM *temp,
+ int width, int height, int stride_line,
+ int type, int decomposition_count, int y);
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count);
void ff_dwt_init(DWTContext *c);
void ff_dwt_init_x86(DWTContext *c);
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index cd0d9feddd..186bc8bd4d 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -440,6 +440,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here
+ s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM));
+ s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM));
for(i=0; i<MAX_REF_FRAMES; i++)
for(j=0; j<MAX_REF_FRAMES; j++)
@@ -618,7 +620,9 @@ av_cold void ff_snow_common_end(SnowContext *s)
int plane_index, level, orientation, i;
av_freep(&s->spatial_dwt_buffer);
+ av_freep(&s->temp_dwt_buffer);
av_freep(&s->spatial_idwt_buffer);
+ av_freep(&s->temp_idwt_buffer);
s->m.me.temp= NULL;
av_freep(&s->m.me.scratchpad);
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 32f116d34d..c3280154dd 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -132,7 +132,9 @@ typedef struct SnowContext{
int16_t (*ref_mvs[MAX_REF_FRAMES])[2];
uint32_t *ref_scores[MAX_REF_FRAMES];
DWTELEM *spatial_dwt_buffer;
+ DWTELEM *temp_dwt_buffer;
IDWTELEM *spatial_idwt_buffer;
+ IDWTELEM *temp_idwt_buffer;
int colorspace_type;
int chroma_h_shift;
int chroma_v_shift;
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index f622252c69..a4d8d4e0d4 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -502,7 +502,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
for(; yd<slice_h; yd+=4){
- ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
+ ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, s->temp_idwt_buffer, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
}
if(s->qlog == LOSSLESS_QLOG){
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 70919603a6..c853a34c6c 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -94,7 +94,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
//FIXME pass the copy cleanly ?
// memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
- ff_spatial_dwt(buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_dwt(buffer, s->temp_dwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
for(level=0; level<s->spatial_decomposition_count; level++){
for(orientation=level ? 1 : 0; orientation<4; orientation++){
@@ -119,7 +119,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
for(xs= 0; xs<Q2_STEP; xs++){
memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
find_sse(s, p, best_score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
for(y=ys; y<b->height; y+= Q2_STEP){
@@ -130,7 +130,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
}
}
dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
find_sse(s, p, score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
for(y=ys; y<b->height; y+= Q2_STEP){
for(x=xs; x<b->width; x+= Q2_STEP){
@@ -1588,7 +1588,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
- ff_spatial_idwt(s->spatial_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
for(y=0; y<height; y++){
for(x=0; x<width; x++){
int64_t d= s->spatial_idwt_buffer[x + y*width]*16;
@@ -1778,7 +1778,7 @@ redo_frame:
/* if(QUANTIZE2)
dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
else*/
- ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_dwt(s->spatial_dwt_buffer, s->temp_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
if(s->pass1_rc && plane_index==0){
int delta_qlog = ratecontrol_1pass(s, pic);
@@ -1818,7 +1818,7 @@ redo_frame:
}
}
- ff_spatial_idwt(s->spatial_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
if(s->qlog == LOSSLESS_QLOG){
for(y=0; y<h; y++){
for(x=0; x<w; x++){
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 65bfb218ea..133f14bd1a 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1413,17 +1413,24 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
}
} else if (vr_type == 2) {
- voffs = voffset;
+ unsigned voffs_div = FASTDIV(voffset, ch);
+ unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
- for (l = 0; l < dim; ++l, ++voffs) {
- vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l]; // FPMATH FIXME use if and counter instead of / and %
+ for (l = 0; l < dim; ++l) {
+ vec[voffs_div + voffs_mod * vlen] +=
+ codebook.codevectors[coffs + l];
av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
- pass, voffset / ch + (voffs % ch) * vlen,
- vec[voffset / ch + (voffs % ch) * vlen],
+ pass, voffs_div + voffs_mod * vlen,
+ vec[voffs_div + voffs_mod * vlen],
codebook.codevectors[coffs + l], coffs, l);
+
+ if (++voffs_mod == ch) {
+ voffs_div++;
+ voffs_mod = 0;
+ }
}
}
}
diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c
index f107d55e87..f340a868be 100644
--- a/libavcodec/x86/snowdsp_mmx.c
+++ b/libavcodec/x86/snowdsp_mmx.c
@@ -26,9 +26,8 @@
#include "libavcodec/dwt.h"
#include "dsputil_mmx.h"
-static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
+static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, IDWTELEM *temp, int width){
const int w2= (width+1)>>1;
- DECLARE_ALIGNED(16, IDWTELEM, temp)[width>>1];
const int w_l= (width>>1);
const int w_r= w2 - 1;
int i;
@@ -215,9 +214,8 @@ static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
}
}
-static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){
+static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, IDWTELEM *temp, int width){
const int w2= (width+1)>>1;
- IDWTELEM temp[width >> 1];
const int w_l= (width>>1);
const int w_r= w2 - 1;
int i;