@ -146,9 +146,9 @@ static const struct CParam {
{ 0x1A , 0x1800000 , 0x1800000 , 0x6800000 , 0xC000000 } ,
} ;
static void tak_set_bps ( AVCodecContext * avctx )
static void tak_set_bps ( AVCodecContext * avctx , int bps )
{
switch ( avctx - > bits_ per_coded_ sample ) {
switch ( bps ) {
case 8 :
avctx - > sample_fmt = AV_SAMPLE_FMT_U8P ;
break ;
@ -196,7 +196,7 @@ static av_cold int tak_decode_init(AVCodecContext *avctx)
s - > uval = get_scale ( avctx - > sample_rate , get_shift ( avctx - > sample_rate ) ) ;
s - > subframe_scale = get_scale ( avctx - > sample_rate , 1 ) ;
tak_set_bps ( avctx ) ;
tak_set_bps ( avctx , avctx - > bits_per_coded_sample ) ;
return 0 ;
}
@ -564,10 +564,10 @@ static int decode_channel(TAKDecContext *s, int chan)
int left = s - > nb_samples - 1 ;
s - > sample_shift [ chan ] = get_b ( gb ) ;
if ( s - > sample_shift [ chan ] > = avctx - > bits_per_coded _sample )
if ( s - > sample_shift [ chan ] > = avctx - > bits_per_raw _sample )
return AVERROR_INVALIDDATA ;
* dst + + = get_code ( gb , avctx - > bits_per_coded _sample - s - > sample_shift [ chan ] ) ;
* dst + + = get_code ( gb , avctx - > bits_per_raw _sample - s - > sample_shift [ chan ] ) ;
s - > lpc_mode [ chan ] = get_bits ( gb , 2 ) ;
s - > nb_subframes = get_bits ( gb , 3 ) + 1 ;
@ -773,9 +773,9 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA ;
}
if ( s - > ti . bps ! = avctx - > bits_per_coded _sample ) {
avctx - > bits_per_coded _sample = s - > ti . bps ;
tak_set_bps ( avctx ) ;
if ( s - > ti . bps ! = avctx - > bits_per_raw _sample ) {
avctx - > bits_per_raw _sample = s - > ti . bps ;
tak_set_bps ( avctx , avctx - > bits_per_raw_sample ) ;
}
if ( s - > ti . sample_rate ! = avctx - > sample_rate ) {
avctx - > sample_rate = s - > ti . sample_rate ;
@ -793,7 +793,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
if ( ( ret = avctx - > get_buffer ( avctx , & s - > frame ) ) < 0 )
return ret ;
if ( avctx - > bits_per_coded _sample < = 16 ) {
if ( avctx - > bits_per_raw _sample < = 16 ) {
av_fast_malloc ( & s - > decode_buffer , & s - > decode_buffer_size ,
sizeof ( * s - > decode_buffer ) * FFALIGN ( s - > nb_samples , 8 ) *
avctx - > channels + FF_INPUT_BUFFER_PADDING_SIZE ) ;
@ -811,7 +811,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
for ( chan = 0 ; chan < avctx - > channels ; chan + + ) {
p = s - > decoded [ chan ] ;
for ( i = 0 ; i < s - > nb_samples ; i + + )
* p + + = get_code ( gb , avctx - > bits_per_coded _sample ) ;
* p + + = get_code ( gb , avctx - > bits_per_raw _sample ) ;
}
} else {
if ( s - > ti . codec = = 2 ) {
@ -918,7 +918,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
}
// convert to output buffer
switch ( avctx - > bits_per_coded _sample ) {
switch ( avctx - > bits_per_raw _sample ) {
case 8 :
for ( chan = 0 ; chan < avctx - > channels ; chan + + ) {
uint8_t * samples = ( uint8_t * ) s - > frame . data [ chan ] ;