MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / twin_decode_init

Function twin_decode_init

libavcodec/twinvq.c:1058–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1056}
1057
1058static av_cold int twin_decode_init(AVCodecContext *avctx)
1059{
1060 TwinContext *tctx = avctx->priv_data;
1061 int isampf = avctx->sample_rate/1000;
1062 int ibps = avctx->bit_rate/(1000 * avctx->channels);
1063
1064 tctx->avctx = avctx;
1065 avctx->sample_fmt = SAMPLE_FMT_FLT;
1066
1067 if (avctx->channels > 2) {
1068 av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n",
1069 avctx->channels);
1070 return -1;
1071 }
1072
1073 switch ((isampf << 8) + ibps) {
1074 case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;
1075 case (11<<8) + 8: tctx->mtab = &mode_11_08; break;
1076 case (11<<8) + 10: tctx->mtab = &mode_11_10; break;
1077 case (16<<8) + 16: tctx->mtab = &mode_16_16; break;
1078 case (22<<8) + 20: tctx->mtab = &mode_22_20; break;
1079 case (22<<8) + 24: tctx->mtab = &mode_22_24; break;
1080 case (22<<8) + 32: tctx->mtab = &mode_22_32; break;
1081 case (44<<8) + 40: tctx->mtab = &mode_44_40; break;
1082 case (44<<8) + 48: tctx->mtab = &mode_44_48; break;
1083 default:
1084 av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf);
1085 return -1;
1086 }
1087
1088 dsputil_init(&tctx->dsp, avctx);
1089 init_mdct_win(tctx);
1090 init_bitstream_params(tctx);
1091
1092 memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist));
1093
1094 return 0;
1095}
1096
1097static av_cold int twin_decode_close(AVCodecContext *avctx)
1098{

Callers

nothing calls this directly

Calls 5

av_logFunction · 0.85
dsputil_initFunction · 0.85
init_mdct_winFunction · 0.85
init_bitstream_paramsFunction · 0.85
memset_floatFunction · 0.85

Tested by

no test coverage detected