diff mbox series

[FFmpeg-devel,3/4] avcodec/cfhdenc: do not try to encode junk

Message ID 20210218230258.1263-3-onemda@gmail.com
State Accepted
Commit 33025ab9760aa7ea12d9f8d9bc4d31970a8dc5b3
Headers show
Series [FFmpeg-devel,1/4] avcodec/cfhdenc: refactor DSP code for CFHD encoder | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Paul B Mahol Feb. 18, 2021, 11:02 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/cfhdenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/cfhdenc.c b/libavcodec/cfhdenc.c
index 9c8ba3700c..b2993cf2a9 100644
--- a/libavcodec/cfhdenc.c
+++ b/libavcodec/cfhdenc.c
@@ -742,7 +742,7 @@  static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
                 for (int m = 0; m < height; m++) {
                     for (int j = 0; j < stride; j++) {
-                        int16_t index = FFSIGN(data[j]) * lut[FFABS(data[j])];
+                        int16_t index = j >= width ? 0 : FFSIGN(data[j]) * lut[FFABS(data[j])];
 
                         if (index < 0)
                             index += 512;