|
|
|
@ -39,6 +39,7 @@ |
|
|
|
|
|
|
|
|
|
#include "libavutil/channel_layout.h" |
|
|
|
|
#include "libavutil/float_dsp.h" |
|
|
|
|
#include "libavutil/thread.h" |
|
|
|
|
#include "avcodec.h" |
|
|
|
|
#include "get_bits.h" |
|
|
|
|
#include "internal.h" |
|
|
|
@ -144,8 +145,15 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static av_cold void atrac3p_init_static(void) |
|
|
|
|
{ |
|
|
|
|
ff_atrac3p_init_vlcs(); |
|
|
|
|
ff_atrac3p_init_dsp_static(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static av_cold int atrac3p_decode_init(AVCodecContext *avctx) |
|
|
|
|
{ |
|
|
|
|
static AVOnce init_static_once = AV_ONCE_INIT; |
|
|
|
|
ATRAC3PContext *ctx = avctx->priv_data; |
|
|
|
|
int i, ch, ret; |
|
|
|
|
|
|
|
|
@ -154,8 +162,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) |
|
|
|
|
return AVERROR(EINVAL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ff_atrac3p_init_vlcs(); |
|
|
|
|
|
|
|
|
|
/* initialize IPQF */ |
|
|
|
|
ff_mdct_init(&ctx->ipqf_dct_ctx, 5, 1, 32.0 / 32768.0); |
|
|
|
|
|
|
|
|
@ -163,8 +169,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) |
|
|
|
|
|
|
|
|
|
ff_atrac_init_gain_compensation(&ctx->gainc_ctx, 6, 2); |
|
|
|
|
|
|
|
|
|
ff_atrac3p_init_wave_synth(); |
|
|
|
|
|
|
|
|
|
if ((ret = set_channel_params(ctx, avctx)) < 0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
@ -194,6 +198,8 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) |
|
|
|
|
|
|
|
|
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; |
|
|
|
|
|
|
|
|
|
ff_thread_once(&init_static_once, atrac3p_init_static); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -392,7 +398,7 @@ AVCodec ff_atrac3p_decoder = { |
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO, |
|
|
|
|
.id = AV_CODEC_ID_ATRAC3P, |
|
|
|
|
.capabilities = AV_CODEC_CAP_DR1, |
|
|
|
|
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, |
|
|
|
|
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, |
|
|
|
|
.priv_data_size = sizeof(ATRAC3PContext), |
|
|
|
|
.init = atrac3p_decode_init, |
|
|
|
|
.close = atrac3p_decode_close, |
|
|
|
@ -405,7 +411,7 @@ AVCodec ff_atrac3pal_decoder = { |
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO, |
|
|
|
|
.id = AV_CODEC_ID_ATRAC3PAL, |
|
|
|
|
.capabilities = AV_CODEC_CAP_DR1, |
|
|
|
|
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, |
|
|
|
|
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, |
|
|
|
|
.priv_data_size = sizeof(ATRAC3PContext), |
|
|
|
|
.init = atrac3p_decode_init, |
|
|
|
|
.close = atrac3p_decode_close, |
|
|
|
|