Opened 13 years ago

Closed 13 years ago

#871 closed defect (fixed)

wavpack 24bit hybrid regression

Reported by: ami_stuff Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: wavpack regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

wavpack: Clip samples after shifting

It doesn't make much sense to clip pre-shift,
nor is it correct for proper decoding.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=365e1ec26d7e89a951ebd7851214f59f4aefdec0
---

 libavcodec/wavpack.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 11e9904..5358967 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -405,12 +405,12 @@ static inline int wv_get_value_integer(WavpackFrameContext *s, uint32_t *crc, in
     }
 
     bit = (S & s->and) | s->or;
-    bit = (((S + bit) << s->shift) - bit);
+    bit = (((S + bit) << s->shift) - bit) << s->post_shift;
 
     if(s->hybrid)
         bit = av_clip(bit, -s->hybrid_maxclip, s->hybrid_maxclip - 1);
 
-    return bit << s->post_shift;
+    return bit;
 }
 
 static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
C:\>ffmpeg -i 512kbps.wv
ffmpeg version N-36193-gf514695, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 26 2011 17:50:37 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 54.100 /  2. 54.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, wv, from '512kbps.wv':
  Duration: 00:00:30.98, start: 0.000000, bitrate: 539 kb/s
    Stream #0:0: Audio: wavpack, 48000 Hz, stereo, s32
At least one output file must be specified

Attachments (1)

512kbps.wv (2.0 MB ) - added by ami_stuff 13 years ago.

Download all attachments as: .zip

Change History (3)

by ami_stuff, 13 years ago

Attachment: 512kbps.wv added

comment:1 by Carl Eugen Hoyos, 13 years ago

Component: undeterminedavcodec
Keywords: wavpack regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

comment:2 by Carl Eugen Hoyos, 13 years ago

Resolution: fixed
Status: openclosed

The attached sample should be fixed.

It is likely that the code for lossy wavpack is not correct, but without a failing sample, this is unlikely to get fixed.

Note: See TracTickets for help on using tickets.