On 9/17/2021 5:54 PM, Paul B Mahol wrote:
+static int speex_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ SpeexContext *s = avctx->priv_data;
+ AVFrame *frame = data;
+ float *dst;
+ int ret;
+
+ if ((ret = init_get_bits8(&s->gb, avpkt->data, avpkt->size)) < 0)
+ return ret;
+
+ frame->nb_samples = s->frame_size * s->frames_per_packet;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+ return ret;
+
+ dst = s->out;
+ for (int i = 0; i < s->frames_per_packet; i++) {
+ ret = speex_modes[s->mode]->decode(avctx, &s->st[s->mode], &s->gb, dst +
i * s->frame_size);
+ if (ret < 0)
+ return ret;
+ if (avctx->channels == 2)
+ speex_decode_stereo(dst + i * s->frame_size, s->frame_size,
&s->stereo);
+ }
+
+ dst = (float *)frame->extended_data[0];
+ for (int n = 0; n < frame->nb_samples * avctx->channels; n++)
+ dst[n] = s->out[n] / 32768.f;
This loop is a huge bottleneck. No way to merge this with the actual
decoding? Does s->out need to remain untouched to be used for future frames?
+
+ *got_frame_ptr = 1;
+
+ return avpkt->size;
+}
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".