diff mbox series

[FFmpeg-devel,11/30] lavc/libx264: use a local variable to shorten code

Message ID 20221127170351.11477-11-anton@khirnov.net
State Accepted
Commit 89761c2122289a565f5efb5dad6697e01150e1b3
Headers show
Series [FFmpeg-devel,01/30] lavc/libx264: factor out setting up the input frame | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Anton Khirnov Nov. 27, 2022, 5:03 p.m. UTC
---
 libavcodec/libx264.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 1819809a48..b680e2098e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -410,6 +410,7 @@  static int setup_frame(AVCodecContext *ctx, const AVFrame *frame,
                        x264_picture_t **ppic)
 {
     X264Context *x4 = ctx->priv_data;
+    X264Opaque  *opaque = &x4->reordered_opaque[x4->next_reordered_opaque];
     x264_picture_t *pic = &x4->pic;
     x264_sei_t     *sei = &pic->extra_sei;
     unsigned int sei_data_size = 0;
@@ -439,11 +440,13 @@  static int setup_frame(AVCodecContext *ctx, const AVFrame *frame,
 
     pic->i_pts  = frame->pts;
 
-    x4->reordered_opaque[x4->next_reordered_opaque].reordered_opaque = frame->reordered_opaque;
-    x4->reordered_opaque[x4->next_reordered_opaque].wallclock = wallclock;
+    opaque->reordered_opaque = frame->reordered_opaque;
+    opaque->wallclock = wallclock;
     if (ctx->export_side_data & AV_CODEC_EXPORT_DATA_PRFT)
-        x4->reordered_opaque[x4->next_reordered_opaque].wallclock = av_gettime();
-    pic->opaque = &x4->reordered_opaque[x4->next_reordered_opaque];
+        opaque->wallclock = av_gettime();
+
+    pic->opaque = opaque;
+
     x4->next_reordered_opaque++;
     x4->next_reordered_opaque %= x4->nb_reordered_opaque;