[FFmpeg-cvslog] avcodec/sonic: add larger version and minor_version fields with version >= 2
Michael Niedermayer
git at videolan.org
Tue Dec 10 16:21:15 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 10 15:54:30 2013 +0100| [c61daa68e4f103ed18ad5af590ea20e9db8da328] | committer: Michael Niedermayer
avcodec/sonic: add larger version and minor_version fields with version >= 2
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c61daa68e4f103ed18ad5af590ea20e9db8da328
---
libavcodec/sonic.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 4d103f2..c55d3dd 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -46,6 +46,7 @@
typedef struct SonicContext {
int version;
+ int minor_version;
int lossless, decorrelation;
int num_taps, downsampling;
@@ -573,8 +574,12 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
init_put_bits(&pb, avctx->extradata, 16*8);
put_bits(&pb, 2, s->version); // version
- if (s->version == 1)
+ if (s->version >= 1)
{
+ if (s->version >= 2) {
+ put_bits(&pb, 8, s->version);
+ put_bits(&pb, 8, s->minor_version);
+ }
put_bits(&pb, 2, s->channels);
put_bits(&pb, 4, code_samplerate(s->samplerate));
}
@@ -589,8 +594,8 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
flush_put_bits(&pb);
avctx->extradata_size = put_bits_count(&pb)/8;
- av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
- s->version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
+ av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
+ s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
avctx->frame_size = s->block_align*s->downsampling;
@@ -762,13 +767,17 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
s->version = get_bits(&gb, 2);
- if (s->version > 1)
+ if (s->version >= 2) {
+ s->version = get_bits(&gb, 8);
+ s->minor_version = get_bits(&gb, 8);
+ }
+ if (s->version > 2)
{
av_log(avctx, AV_LOG_ERROR, "Unsupported Sonic version, please report\n");
return AVERROR_INVALIDDATA;
}
- if (s->version == 1)
+ if (s->version >= 1)
{
s->channels = get_bits(&gb, 2);
s->samplerate = samplerate_table[get_bits(&gb, 4)];
@@ -805,8 +814,8 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
s->frame_size = s->channels*s->block_align*s->downsampling;
// avctx->frame_size = s->block_align;
- av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
- s->version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
+ av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
+ s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
// generate taps
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
More information about the ffmpeg-cvslog
mailing list