71 for (i = 0; i < nb_words; i++, src += 2, dst += 2)
76 for (i = 0; i < nb_words; i++, src += 3)
81 for (i = 0; i < nb_words; i++, src += 3, dst += 3)
93 int i, ret,
key, mtd_size;
179 for (i = 0, p =
NULL, g = c->
groups; i < c->nb_groups; i++, p = g, g++) {
195 int c =
FFABS(a - b) >> 1;
201 int lwc_val[17] = { 0 };
204 for (i = 0; i < 11; i++) {
209 for (j =
FFMAX(i - 3, 0), k = 0; j <= i + 3; j++, k++) {
218 if (msk_val[i] < thr) {
219 for (j =
FFMAX(max_j - 3, 0),
220 k =
FFMAX(3 - max_j, 0);
221 j <= max_j + 3; j++, k++)
226 for (i = 0; i < 16; i++) {
227 int v =
FFMAX(lwc_val[i], -512);
228 msk_val[i] =
FFMAX(msk_val[i] + v, 0);
234 int fg_spc,
int fg_ofs,
int msk_mod,
int snr_ofs)
246 const uint16_t *fast_decay =
fast_decay_tab[nb_code][dc_code][msk_mod];
251 for (i = 0; i < nb_exponent; i++)
252 psd_val[i] = (48 - exp[i]) * 64;
255 for (i = 0; i < nb_exponent; i++) {
256 fast_leak =
log_add(fast_leak - fast_decay[i],
257 psd_val[i] - fast_gain + fast_gain_adj[i]);
258 slow_leak =
log_add(slow_leak - slow_decay,
259 psd_val[i] - slow_gain[i]);
260 msk_val[i] =
FFMAX(fast_leak, slow_leak);
264 for (i = nb_exponent - 1; i >
band_low_tab[nb_code]; i--) {
265 fast_leak =
log_add(fast_leak - misc_decay, psd_val[i] - fast_gain);
266 msk_val[i] =
FFMAX(msk_val[i], fast_leak);
269 for (i = 0; i < nb_exponent; i++)
270 msk_val[i] =
FFMAX(msk_val[i], hearing_thresh[i]);
275 for (i = 0; i < nb_exponent; i++) {
276 int v = 16 * (snr_ofs - 64) + psd_val[i] - msk_val[i] >> 5;
277 bap[i] =
bap_tab[av_clip_uintp2(v, 6)];
290 if (bap_strategy[i]) {
295 fg_spc[i] = fg_spc[i - 1];
296 fg_ofs[i] = fg_ofs[i - 1];
297 msk_mod[i] = msk_mod[i - 1];
308 memset(c->
bap, 0,
sizeof(c->
bap));
312 for (i = 0, p =
NULL, g = c->
groups; i < c->nb_groups; i++, p = g, g++) {
316 fg_spc[i], fg_ofs[i], msk_mod[i], snr_ofs);
332 for (i = 0, p =
NULL, g = c->
groups; i < c->nb_groups; i++, p = g, g++) {
341 for (j = 0; j <
start; j++)
363 for (i = 0, g = c->
groups; i < c->nb_groups; i++, g++) {
375 memset(mnt, 0, count *
sizeof(*mnt));
378 int escape = -(1 << size1 - 1);
380 for (k = 0; k <
count; k++)
383 for (k = 0; k <
count; k++) {
384 if (values[k] != escape) {
385 mnt[k] = values[k] * scale;
392 mnt[k] = ((value + 1) * a - b) *
exp;
394 mnt[k] = (value * a +
b) * exp;
398 for (k = 0; k <
count; k++)
471 for (ch = start; ch <
end; ch++) {
507 for (i = 0; i < n2; i++)
508 result[n2 + i] = result[n2 - i - 1];
514 imdct->
imdct_half(imdct, result + n2, values);
515 for (i = 0; i < n2; i++)
516 result[i] = -result[n - i - 1];
530 memset(result, 0, 1152 *
sizeof(
float));
531 for (i = 0, g = c->
groups; i < c->nb_groups; i++, g++) {
533 float *dst = result + g->
dst_ofs;
540 for (i = 0; i < 256; i++)
541 output[i] = history[i] + result[i];
542 for (i = 256; i < 896; i++)
543 output[i] = result[i];
544 for (i = 0; i < 256; i++)
545 history[i] = result[896 + i];
550 if (begin == 960 && end == 960)
561 output[i] *= a * (FRAME_SAMPLES - i - 1) + b * i;
594 int *got_frame_ptr,
AVPacket *avpkt)
603 if ((hdr & 0xfffffe) == 0x7888e) {
605 }
else if ((hdr & 0xffffe0) == 0x788e0) {
607 }
else if ((hdr & 0xfffe00) == 0x78e00) {
677 for (i = 0; i < 3; i++)
689 for (i = 1; i < 17; i++)
692 for (i = 2; i < 16; i++) {
702 for (i = 1; i < 17; i++) {
706 for (j = 1; j < 4; j++)
707 mantissa_tab3[i][j] = 1.0
f / (1 << i) + 1.0f / (1 << j) - 1.0
f / (1 << i + j);
712 for (i = 0; i < 25; i++) {
717 for (i = 1; i < 1024; i++)
722 for (i = 0; i < 128; i++)
726 for (i = 0; i < 192; i++)
730 for (i = 0; i < 192; i++)
732 for (i = 0; i < 64; i++)
736 for (i = 0; i < 64; i++)
738 for (i = 0; i < 192; i++)
742 for (i = 0; i < 128; i++)
744 for (i = 0; i < 64; i++)
749 for (i = 0; i < 640; i++)
751 for (i = 0; i < 256; i++)
755 for (i = 0; i < 192; i++)
759 for (i = 0; i < 256; i++)
763 for (i = 0; i < 256; i++)
767 for (i = 0; i < 448; i++)
780 for (i = 0; i < 3; i++)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int parse_bit_alloc(DBEContext *s, DBEChannel *c)
#define AV_CH_LAYOUT_7POINT1
int exp_strategy[MAX_GROUPS]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const uint8_t mantissa_size2[16][4]
This structure describes decoded (raw) audio or video data.
static const uint8_t nb_groups_tab[4]
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
static const uint8_t mantissa_size1[16][4]
static float mantissa_tab2[17][4]
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
av_cold void ff_kbd_window_init(float *window, float alpha, int n)
Generate a Kaiser-Bessel Derived Window.
uint8_t nb_bias_exp[MAX_MSTR_EXP]
Memory handling functions.
static float win(SuperEqualizerContext *s, float n, int N)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
DBEGroup groups[MAX_GROUPS]
static const uint16_t fast_gain_adj_tab[3][2][62]
static const uint8_t bap_tab[64]
#define AV_CH_LAYOUT_4POINT0
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
static const uint8_t nb_mstr_exp_tab[4]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
static float mantissa_tab3[17][4]
static int get_sbits(GetBitContext *s, int n)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int parse_metadata(DBEContext *s)
static const uint8_t ch_reorder_4[4]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
enum AVSampleFormat sample_fmt
audio sample format
static const uint8_t log_add_tab[212]
uint8_t buffer[1024 *3+AV_INPUT_BUFFER_PADDING_SIZE]
static int dolby_e_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static av_cold int end(AVCodecContext *avctx)
static const uint8_t dc_code_tab[5]
#define u(width, name, range_min, range_max)
static void apply_gain(DBEContext *s, int begin, int end, float *output)
static const int16_t lwc_gain_tab[11][7]
static const uint8_t imdct_bits_tab[3]
bitstream reader API header.
int ch_size[MAX_CHANNELS]
#define AV_CH_LAYOUT_5POINT1
static int parse_meter(DBEContext *s)
static int parse_key(DBEContext *s)
static const uint8_t ch_reorder_8[8]
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
static int parse_audio(DBEContext *s, int start, int end, int seg_id)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
static const uint8_t band_low_tab[3]
int end_gain[MAX_CHANNELS]
AVCodec ff_dolby_e_decoder
static int parse_indices(DBEContext *s, DBEChannel *c)
static av_cold int dolby_e_init(AVCodecContext *avctx)
uint64_t channel_layout
Audio channel layout.
void(* imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
static SDL_Window * window
static const uint8_t ch_reorder_6[6]
static const uint16_t sample_rate_tab[16]
static const uint8_t nb_programs_tab[MAX_PROG_CONF+1]
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
int begin_gain[MAX_CHANNELS]
GLsizei GLboolean const GLfloat * value
static int parse_channel(DBEContext *s, int ch, int seg_id)
static const float short_window2[192]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
#define AV_EF_EXPLODE
abort decoding on minor error detection
float history[MAX_CHANNELS][256]
static const uint16_t fast_gain_tab[8]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static const float start_window[192]
static const uint8_t ch_reorder_n[8]
float mantissas[MAX_MANTISSAS]
static const uint16_t hearing_thresh_tab[3][3][50]
static const int8_t lfe_channel_tab[MAX_PROG_CONF+1]
AVSampleFormat
Audio sample formats.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
int sample_rate
samples per second
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
main external API structure.
static const uint16_t misc_decay_tab[3][2][2]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void calc_lowcomp(int *msk_val)
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
void(* vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len)
Calculate the entry wise product of two vectors of floats, add a third vector of floats and store the...
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static const uint8_t nb_channels_tab[MAX_PROG_CONF+1]
static void skip_bits(GetBitContext *s, int n)
static int parse_mantissas(DBEContext *s, DBEChannel *c)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static const uint8_t band_ofs_tab[3][4]
static float exponent_tab[50]
static int log_add(int a, int b)
static av_cold void dolby_e_flush(AVCodecContext *avctx)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int filter_frame(DBEContext *s, AVFrame *frame)
static float mantissa_tab1[17][4]
#define LOCAL_ALIGNED_32(t, v,...)
static void bit_allocate(int nb_exponent, int nb_code, int fr_code, int *exp, int *bap, int fg_spc, int fg_ofs, int msk_mod, int snr_ofs)
const uint8_t * nb_mantissa
static const float short_window3[64]
common internal api header.
static const uint16_t slow_decay_tab[2][2]
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
DBEChannel channels[MAX_SEGMENTS][MAX_CHANNELS]
static const uint8_t ht_code_tab[5]
static void transform(DBEContext *s, DBEChannel *c, float *history, float *output)
static float gain_tab[1024]
static const DBEGroup *const frm_ofs_tab[2][4]
static void imdct_calc(DBEContext *s, DBEGroup *g, float *result, float *values)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static int parse_metadata_ext(DBEContext *s)
static const uint16_t fast_decay_tab[3][2][2][50]
int exponents[MAX_EXPONENTS]
int channels
number of audio channels
static int parse_exponents(DBEContext *s, DBEChannel *c)
static int ff_thread_once(char *control, void(*routine)(void))
static int skip_input(DBEContext *s, int nb_words)
static int convert_input(DBEContext *s, int nb_words, int key)
static av_cold void init_tables(void)
static const int16_t lwc_adj_tab[7]
static enum AVSampleFormat sample_fmts[]
uint8_t ** extended_data
pointers to the data planes/channels.
static const uint16_t slow_gain_tab[3][2][50]
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
static void unbias_exponents(DBEContext *s, DBEChannel *c, DBEGroup *g)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
static av_cold int dolby_e_close(AVCodecContext *avctx)