+ chctx->decoder_reset = 1;
+ return AVERROR_INVALIDDATA;
+ }
+
+ memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
+
+ imc_imdct256(q, chctx, avctx->channels);
+
+ return 0;
+}
+
+static int imc_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ AVFrame *frame = data;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ int ret, i;
+
+ IMCContext *q = avctx->priv_data;
+
+ LOCAL_ALIGNED_16(uint16_t, buf16, [IMC_BLOCK_SIZE / 2]);
+
+ if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* get output buffer */
+ frame->nb_samples = COEFFS;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;