Lines Matching defs:avctx

52     AVCodecContext *avctx;                          ///< parent AVCodecContext
145 static int set_bps_params(AVCodecContext *avctx)
147 switch (avctx->bits_per_raw_sample) {
149 avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
152 avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
155 avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
158 av_log(avctx, AV_LOG_ERROR, "invalid/unsupported bits per sample: %d\n",
159 avctx->bits_per_raw_sample);
166 static void set_sample_rate_params(AVCodecContext *avctx)
168 TAKDecContext *s = avctx->priv_data;
171 if (avctx->sample_rate < 11025) {
173 } else if (avctx->sample_rate < 22050) {
175 } else if (avctx->sample_rate < 44100) {
180 s->uval = FFALIGN(avctx->sample_rate + 511LL >> 9, 4) << shift;
181 s->subframe_scale = FFALIGN(avctx->sample_rate + 511LL >> 9, 4) << 1;
184 static av_cold int tak_decode_init(AVCodecContext *avctx)
186 TAKDecContext *s = avctx->priv_data;
191 s->avctx = avctx;
192 avctx->bits_per_raw_sample = avctx->bits_per_coded_sample;
194 set_sample_rate_params(avctx);
196 return set_bps_params(avctx);
512 AVCodecContext *avctx = s->avctx;
519 if (s->sample_shift[chan] >= avctx->bits_per_raw_sample)
522 *decoded++ = get_sbits(gb, avctx->bits_per_raw_sample - s->sample_shift[chan]);
677 static int tak_decode_frame(AVCodecContext *avctx, AVFrame *frame,
680 TAKDecContext *s = avctx->priv_data;
690 if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0)
694 if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_COMPLIANT)) {
696 av_log(avctx, AV_LOG_ERROR, "CRC error\n");
697 if (avctx->err_recognition & AV_EF_EXPLODE)
704 avpriv_report_missing_feature(avctx, "TAK codec type %d", s->ti.codec);
708 av_log(avctx, AV_LOG_ERROR,
713 av_log(avctx, AV_LOG_ERROR,
718 av_log(avctx, AV_LOG_ERROR,
724 av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of samples\n");
728 avctx->bits_per_raw_sample = s->ti.bps;
729 if ((ret = set_bps_params(avctx)) < 0)
731 if (s->ti.sample_rate != avctx->sample_rate) {
732 avctx->sample_rate = s->ti.sample_rate;
733 set_sample_rate_params(avctx);
736 av_channel_layout_uninit(&avctx->ch_layout);
738 av_channel_layout_from_mask(&avctx->ch_layout, s->ti.ch_layout);
740 avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
741 avctx->ch_layout.nb_channels = s->ti.channels;
748 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
750 ff_thread_finish_setup(avctx);
752 if (avctx->bits_per_raw_sample <= 16) {
753 int buf_size = av_samples_get_buffer_size(NULL, avctx->ch_layout.nb_channels,
762 s->decode_buffer, avctx->ch_layout.nb_channels,
767 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++)
772 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++) {
775 decoded[i] = get_sbits(gb, avctx->bits_per_raw_sample);
779 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++)
783 if (avctx->ch_layout.nb_channels == 2) {
798 if (chan > avctx->ch_layout.nb_channels)
804 if (nbit >= avctx->ch_layout.nb_channels)
814 if (s->mcdparams[i].chan2 >= avctx->ch_layout.nb_channels) {
815 av_log(avctx, AV_LOG_ERROR,
817 s->mcdparams[i].chan2, avctx->ch_layout.nb_channels);
835 chan = avctx->ch_layout.nb_channels;
861 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++) {
876 av_log(avctx, AV_LOG_DEBUG, "overread\n");
878 av_log(avctx, AV_LOG_DEBUG, "underread\n");
880 if (avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_COMPLIANT)) {
883 av_log(avctx, AV_LOG_ERROR, "CRC error\n");
884 if (avctx->err_recognition & AV_EF_EXPLODE)
890 switch (avctx->sample_fmt) {
892 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++) {
900 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++) {
908 for (chan = 0; chan < avctx->ch_layout.nb_channels; chan++) {
935 static av_cold int tak_decode_close(AVCodecContext *avctx)
937 TAKDecContext *s = avctx->priv_data;