1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Add support for vorbis 6.1 and 7.1 channel configurations as per the new spec

http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9

Originally committed as revision 21527 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Robert Swain 2010-01-29 13:51:25 +00:00
parent 012dc2c426
commit 4a27f326c5
3 changed files with 11 additions and 7 deletions

View File

@ -25,8 +25,8 @@
extern const float ff_vorbis_floor1_inverse_db_table[256]; extern const float ff_vorbis_floor1_inverse_db_table[256];
extern const float * const ff_vorbis_vwin[8]; extern const float * const ff_vorbis_vwin[8];
extern const uint8_t ff_vorbis_channel_layout_offsets[6][6]; extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
extern const int64_t ff_vorbis_channel_layouts[7]; extern const int64_t ff_vorbis_channel_layouts[9];
typedef struct { typedef struct {
uint_fast16_t x; uint_fast16_t x;

View File

@ -21,22 +21,26 @@
#include "dsputil.h" #include "dsputil.h"
#include "vorbis.h" #include "vorbis.h"
const uint8_t ff_vorbis_channel_layout_offsets[6][6] = { const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
{ 0, }, { 0, },
{ 0, 1, }, { 0, 1, },
{ 0, 2, 1, }, { 0, 2, 1, },
{ 0, 1, 2, 3, }, { 0, 1, 2, 3, },
{ 0, 2, 1, 3, 4, }, { 0, 2, 1, 3, 4, },
{ 0, 2, 1, 5, 3, 4, } { 0, 2, 1, 5, 3, 4, },
{ 0, 2, 1, 6, 5, 3, 4, },
{ 0, 2, 1, 7, 5, 6, 3, 4},
}; };
const int64_t ff_vorbis_channel_layouts[7] = { const int64_t ff_vorbis_channel_layouts[9] = {
CH_LAYOUT_MONO, CH_LAYOUT_MONO,
CH_LAYOUT_STEREO, CH_LAYOUT_STEREO,
CH_LAYOUT_SURROUND, CH_LAYOUT_SURROUND,
CH_LAYOUT_QUAD, CH_LAYOUT_QUAD,
CH_LAYOUT_5POINT0_BACK, CH_LAYOUT_5POINT0_BACK,
CH_LAYOUT_5POINT1_BACK, CH_LAYOUT_5POINT1_BACK,
CH_LAYOUT_5POINT1|CH_BACK_CENTER,
CH_LAYOUT_7POINT1,
0 0
}; };

View File

@ -984,7 +984,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
return -1; return -1;
} }
if (vc->audio_channels > 6) if (vc->audio_channels > 8)
avccontext->channel_layout = 0; avccontext->channel_layout = 0;
else else
avccontext->channel_layout = ff_vorbis_channel_layouts[vc->audio_channels - 1]; avccontext->channel_layout = ff_vorbis_channel_layouts[vc->audio_channels - 1];
@ -1616,7 +1616,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
AV_DEBUG("parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb)/8, get_bits_count(gb)%8, len); AV_DEBUG("parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb)/8, get_bits_count(gb)%8, len);
if (vc->audio_channels > 6) { if (vc->audio_channels > 8) {
for (i = 0; i < vc->audio_channels; i++) for (i = 0; i < vc->audio_channels; i++)
channel_ptrs[i] = vc->channel_floors + i * len; channel_ptrs[i] = vc->channel_floors + i * len;
} else { } else {