[FFmpeg-cvslog] avcodec/hcadec: implement proper .flush callback
Paul B Mahol
git at videolan.org
Mon Oct 9 22:32:33 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Oct 9 21:16:15 2023 +0200| [1703bfa133ffebf0234a20199d54c27e0a5ffd0c] | committer: Paul B Mahol
avcodec/hcadec: implement proper .flush callback
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1703bfa133ffebf0234a20199d54c27e0a5ffd0c
---
libavcodec/hcadec.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index 4e30d553de..026b998341 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -65,7 +65,7 @@ typedef struct HCAContext {
uint8_t stereo_band_count;
uint8_t bands_per_hfr_group;
- // Set during init() and freed on close(). Untouched on flush()
+ // Set during init() and freed on close(). Untouched on init_flush()
av_tx_fn tx_fn;
AVTXContext *tx_ctx;
AVFloatDSPContext *fdsp;
@@ -197,7 +197,7 @@ static inline unsigned ceil2(unsigned a, unsigned b)
return (b > 0) ? (a / b + ((a % b) ? 1 : 0)) : 0;
}
-static av_cold void decode_flush(AVCodecContext *avctx)
+static av_cold void init_flush(AVCodecContext *avctx)
{
HCAContext *c = avctx->priv_data;
@@ -213,7 +213,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata,
unsigned b, chunk;
int version, ret;
- decode_flush(avctx);
+ init_flush(avctx);
if (extradata_size < 36)
return AVERROR_INVALIDDATA;
@@ -609,6 +609,14 @@ static av_cold int decode_close(AVCodecContext *avctx)
return 0;
}
+static av_cold void decode_flush(AVCodecContext *avctx)
+{
+ HCAContext *c = avctx->priv_data;
+
+ for (int ch = 0; ch < MAX_CHANNELS; ch++)
+ memset(c->ch[ch].imdct_prev, 0, sizeof(c->ch[ch].imdct_prev));
+}
+
const FFCodec ff_hca_decoder = {
.p.name = "hca",
CODEC_LONG_NAME("CRI HCA"),
More information about the ffmpeg-cvslog
mailing list