diff mbox series

[FFmpeg-devel,5/6] avcodec/huffyuvenc: Avoid duplicate variables

Message ID GV1P250MB0737DEC3D6FB200F95F78C7D8F3C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit d517c9e51be52159930668032f087e3478bf8821
Headers show
Series [FFmpeg-devel,1/6] avcodec/huffyuvdec: Don't zero unnecessarily | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt April 4, 2024, 5:02 a.m. UTC
Also simplify assigningfake strides.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/huffyuvenc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 152f94cefb..fd6b01de81 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -755,16 +755,15 @@  static inline int encode_bgra_bitstream(HYuvEncContext *s, int count, int planes
 }
 
 static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
-                        const AVFrame *pict, int *got_packet)
+                        const AVFrame *p, int *got_packet)
 {
     HYuvEncContext *s = avctx->priv_data;
     const int width = avctx->width;
     const int width2 = avctx->width >> 1;
     const int height = avctx->height;
-    const int fake_ystride = s->interlaced ? pict->linesize[0]*2  : pict->linesize[0];
-    const int fake_ustride = s->interlaced ? pict->linesize[1]*2  : pict->linesize[1];
-    const int fake_vstride = s->interlaced ? pict->linesize[2]*2  : pict->linesize[2];
-    const AVFrame * const p = pict;
+    const int fake_ystride = (1 + s->interlaced) * p->linesize[0];
+    const int fake_ustride = (1 + s->interlaced) * p->linesize[1];
+    const int fake_vstride = (1 + s->interlaced) * p->linesize[2];
     int i, j, size = 0, ret;
 
     if ((ret = ff_alloc_packet(avctx, pkt, width * height * 3 * 4 + FF_INPUT_BUFFER_MIN_SIZE)) < 0)