Michael Niedermayer
e976e68fc5
avcodec/atrac3: Check init_get_bits8() for failure
...
This is more for correctness than actually fixing a missing error path
Fixes CID1399967
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Carl Eugen Hoyos
b47582f43a
lavc/atrac3: Constify a pointer declaration.
...
Silences an "assignment discards ‘const’ qualifier" warning.
8 years ago
Paul B Mahol
280a40dd27
avcodec: add ATRAC Advanced Lossless decoders
...
Only lossy part is decoded for now.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years ago
bnnm
c61b28e042
avcodec/atrac3: Add multichannel joint stereo ATRAC3
...
Multichannel joint stereo simply interleaves stereo pairs (6ch: 2ch + 2ch + 2ch), so each pair is decoded separatedly.
***
To test my changes, I converted examples to wav with ffmpeg.exe (old and new), and compared them to see they are byte-exact.
Regular 2ch files (JS and normal) were straightforward to test.
For multichannel, to check each JS pair is correctly decoded separatedly I did:
- manually demux 6ch.msf into 3 pairs and convert them (2ch_1.wav + 2ch_2.wav + 2ch_3.wav)
- convert the 6ch.msf file to wav (with my changes)
- manually demux the 6ch.wav into 3 pairs (6ch_d1.wav + 6ch_d2.wav + 6ch_d3.wav)
- compare each pair (ex. 2ch_3.wav vs 6ch_d3.wav): all pairs are byte-exact.
The new code just processes each JS pair separatedly, there are no algorithm changes.
It could be improved a bit but I'm not sure about typical styles.
I've only seen 6ch .MSF (probably the AT3 spec only supports 2ch audio).
Signed-off-by: bnnm <bananaman255@gmail.com>
8 years ago
bnnm
cab0f3abc5
avcodec/atrac3: allow 6 channels (non-joint stereo)
...
Raises max channels to 6 (for non joint-stereo only),
there is no difference decoding 1 or N discrete channels.
Fixes trac issue #5840
Signed-off-by: bnnm <bananaman255@gmail.com>
8 years ago
Alexandra Hájková
0272119202
atrac: Convert to the new bitstream reader
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
8 years ago
Paul B Mahol
c9fb81ff41
avcodec/atrac3: pass AVCodecContext to av_log if available
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Vittorio Giovara
059a934806
lavc: Consistently prefix input buffer defines
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Vittorio Giovara
def97856de
lavc: AV-prefix all codec capabilities
...
Express bitfields more simply.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Vittorio Giovara
7c6eb0a1b7
lavc: AV-prefix all codec flags
...
Convert doxygen to multiline and express bitfields more simply.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Anton Khirnov
ee964145b5
lavc: remove unused traces of fmtconvert usage
...
Those decoders have been switched to float output and so do not use
fmtconvert anymore.
10 years ago
Michael Niedermayer
93f959b672
avcodec/atrac3: Use avpriv_float_dsp_alloc()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
ea77d3b889
avcodec/atrac3: use av_freep(), do not leave stale pointers in memory
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Gabriel Dume
f929ab0569
cosmetics: Write NULL pointer equality checks more compactly
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
10 years ago
Michael Niedermayer
606a49d2e6
avcodec/atrac3: Use av_mallocz_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
2d52834910
atrac3: Better name for imdct window initialization
...
Patch by Diego Biurrun.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
4fb8de08e1
atrac3: Remove unused gain compensation tables
...
Patch by Diego Biurrun.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
ed796fba76
atrac3: Better name for IMDCT window initialization
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Maxim Poliakovski
be76415047
atrac3: Remove unused gain compensation tables
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Maxim Poliakovski
79cbac8cd4
atrac3: Generalize gain compensation code
...
Move it to the ATRAC common code, to reuse in the upcoming ATRAC3+ decoder.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Diego Biurrun
5ce04c14dd
Use correct Doxygen syntax
11 years ago
Diego Biurrun
be0b4c70ec
atrac3: Replace a silly counter variable name with plain 'j'
11 years ago
Maxim Poliakovski
d49f3fa579
atrac3: Generalize gain compensation code
...
Move it to the ATRAC common code, so it can be reused
in the umpcoming ATRAC3+ decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
4fa2484067
atrac3/decode_gain_control: cosmetics
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
4978be2bc6
atrac3: rename num_gain_data to num_points
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Maxim Poliakovski
dc80e250fc
atrac3: Rename GainInfo to AtracGainInfo
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Diego Biurrun
7df9e693a3
cosmetics: Fix ATRAC codec name spelling
11 years ago
Luca Barbato
5eaed6d336
atrac3: fix error handling
...
decode_tonal_components returns a proper AVERROR.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Luca Barbato
22e76ec635
atrac3: set the getbits context the right buffer_end
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
50cf5a7fb7
atrac3: Error on impossible encoding/channel combinations
...
Joint stereo encoded mono is impossible.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
874c8a17ac
atrac3: fix error handling
...
decode_tonal_components returns a proper AVERROR.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Diego Biurrun
6fee1b90ce
avcodec: Add av_cold attributes to init functions missing them
12 years ago
Xi Wang
eba1ff3130
atrac3: avoid oversized shifting in decode_bytes()
...
When `off' is 0, `0x537F6103 << 32' in the following expression invokes
undefined behavior, the result of which is not necessarily 0.
(0x537F6103 >> (off * 8)) | (0x537F6103 << (32 - (off * 8)))
Avoid oversized shifting.
CC: libav-stable@libav.org
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Diego Biurrun
6d97484d72
avcodec: av_log_ask_for_sample() ---> avpriv_request_sample()
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Justin Ruggles
9a75ace2b2
atrac3: decode directly to the user-provided AVFrame
12 years ago
Carl Eugen Hoyos
034a125c8c
Support more atrac3-in-mkv samples.
...
The mkv demuxer sometimes finds 12 bytes of realmedia
extradata after the matroska real audio properties.
12 years ago
Michael Niedermayer
c8f25cafd2
atrac3: fix buffer size for get_bits.
...
Fixes out of array reads
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Karcher
dcbb920f15
Fix atrac3 decoder broken in e55d53905f
...
Signed-off-by: Michael Karcher <ffmpeg@mkarcher.dialup.fu-berlin.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Karcher
0e3afacd4d
atrac3: use correct loop variable in add_tonal_components()
...
Signed-off-by: Michael Karcher <ffmpeg@mkarcher.dialup.fu-berlin.de>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
CC:libav-stable@libav.org
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Reimar Döffinger
8aa29f063c
atrac3: do not use init_static_data to init VLC data.
...
It would be called while registering the codec, which means
it needlessly wastes memory when it is never used.
Instead do the work when first opening the codec.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
12 years ago
Peter Ross
9ccc349f77
ensure comment blocks that contain doxygen commands start with double asterix
...
Reveiwed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
13451f5520
atrac3dec: Check coding mode against channels.
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
44d854a518
atrac3: return an error if extradata_size is not a specific known size
...
Also fixes 3 compiler warnings about using uninitialized variables.
12 years ago
Justin Ruggles
5d1007f74d
atrac3: initialize static tables in AVCodec.init_static_data()
12 years ago
Justin Ruggles
a1f4cd371a
atrac3: replace a calculation with FFALIGN()
...
This allocates 4 bytes less than the previous code if avctx->block_align is
a multiple of 4, but the extra 4 bytes is not really needed.
12 years ago
Justin Ruggles
78edce3f19
atrac3: separate window initialization from IMDCT initialization
12 years ago
Justin Ruggles
808686fc1e
atrac3: remove unused ATRAC3Context field, sample_rate
12 years ago