summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-09-04 15:04:27 +0200
committerPaul B Mahol <onemda@gmail.com>2021-10-03 11:46:53 +0200
commit114634a51a7ca2ea4d375d62eba55123ce2262d5 (patch)
tree00217b52695c8bcfd984535704aff0006a6655bc /libavcodec/mlpdec.c
parentd2cf2cb0bd3ebfeabab6663b59a82f2c69a75e87 (diff)
downloadffmpeg-114634a51a7ca2ea4d375d62eba55123ce2262d5.tar.gz
avcodec/mlpdec: update matrix encoding only if it changed
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 6c2940903f..d56e214e1e 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -73,6 +73,7 @@ typedef struct SubStream {
uint64_t mask;
/// The matrix encoding mode for this substream
enum AVMatrixEncoding matrix_encoding;
+ enum AVMatrixEncoding prev_matrix_encoding;
/// Channel coding parameters for channels in the substream
ChannelParams channel_params[MAX_CHANNELS];
@@ -1123,8 +1124,12 @@ static int output_data(MLPDecodeContext *m, unsigned int substr,
is32);
/* Update matrix encoding side data */
- if ((ret = ff_side_data_update_matrix_encoding(frame, s->matrix_encoding)) < 0)
- return ret;
+ if (s->matrix_encoding != s->prev_matrix_encoding) {
+ if ((ret = ff_side_data_update_matrix_encoding(frame, s->matrix_encoding)) < 0)
+ return ret;
+
+ s->prev_matrix_encoding = s->matrix_encoding;
+ }
*got_frame_ptr = 1;
@@ -1353,6 +1358,7 @@ static void mlp_decode_flush(AVCodecContext *avctx)
SubStream *s = &m->substream[substr];
s->lossless_check_data = 0xffffffff;
+ s->prev_matrix_encoding = 0;
}
}