[FFmpeg-cvslog] avcodec/imc: Provide non NULL context to av_log()

Michael Niedermayer git at videolan.org
Wed Jan 2 01:24:25 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Dec 31 21:32:37 2018 +0100| [052ad4d25540f9e3a4d46beb10a37257a2c38024] | committer: Michael Niedermayer

avcodec/imc: Provide non NULL context to av_log()

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=052ad4d25540f9e3a4d46beb10a37257a2c38024
---

 libavcodec/imc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 7cd6db930b..82a908160a 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -104,6 +104,8 @@ typedef struct IMCContext {
 
     int8_t cyclTab[32], cyclTab2[32];
     float  weights1[31], weights2[31];
+
+    AVCodecContext *avctx;
 } IMCContext;
 
 static VLC huffman_vlc[4][4];
@@ -466,7 +468,7 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx,
 
     for (i = 0; i < BANDS - 1; i++) {
         if (chctx->flcoeffs5[i] <= 0) {
-            av_log(NULL, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]);
+            av_log(q->avctx, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]);
             return AVERROR_INVALIDDATA;
         }
         chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
@@ -1022,6 +1024,8 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
 
     LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / 2]);
 
+    q->avctx = avctx;
+
     if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
         av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list