[FFmpeg-cvslog] lavc/libxavs2.c: use more descriptive variable names in xavs2_copy_frame* functions

hwren git at videolan.org
Wed Dec 4 21:44:29 EET 2019


ffmpeg | branch: master | hwren <hwrenx at 126.com> | Tue Dec  3 10:41:22 2019 +0800| [3003917a8fe070817bb6a68d27be666456f2cf13] | committer: Michael Niedermayer

lavc/libxavs2.c: use more descriptive variable names in xavs2_copy_frame* functions

Signed-off-by: hwren <hwrenx at 126.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/libxavs2.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 0179a1eb15..3896f3b20d 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -132,16 +132,15 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 
 static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame *frame, const int shift_in)
 {
-    int j, k;
-    for (k = 0; k < 3; k++) {
-        int i_stride = pic->img.i_stride[k];
-        for (j = 0; j < pic->img.i_lines[k]; j++) {
-            uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[k][j * i_stride];
-            int i;
-            uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j;
+    int plane, hIdx, wIdx;
+    for (plane = 0; plane < 3; plane++) {
+        int i_stride = pic->img.i_stride[plane];
+        for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+            uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[plane][hIdx * i_stride];
+            uint8_t *p_buffer = frame->data[plane] + frame->linesize[plane] * hIdx;
             memset(p_plane, 0, i_stride);
-            for (i = 0; i < pic->img.i_width[k]; i++) {
-                p_plane[i] = p_buffer[i] << shift_in;
+            for (wIdx = 0; wIdx < pic->img.i_width[plane]; wIdx++) {
+                p_plane[wIdx] = p_buffer[wIdx] << shift_in;
             }
         }
     }
@@ -149,12 +148,12 @@ static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, const AVFrame *fra
 
 static void xavs2_copy_frame(xavs2_picture_t *pic, const AVFrame *frame)
 {
-    int j, k;
-    for (k = 0; k < 3; k++) {
-        for (j = 0; j < pic->img.i_lines[k]; j++) {
-            memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j,
-                    frame->data[k]+frame->linesize[k] * j,
-                    pic->img.i_width[k] * pic->img.in_sample_size);
+    int plane, hIdx;
+    for (plane = 0; plane < 3; plane++) {
+        for (hIdx = 0; hIdx < pic->img.i_lines[plane]; hIdx++) {
+            memcpy( pic->img.img_planes[plane] + pic->img.i_stride[plane] * hIdx,
+                    frame->data[plane]+frame->linesize[plane] * hIdx,
+                    pic->img.i_width[plane] * pic->img.in_sample_size);
         }
     }
 }



More information about the ffmpeg-cvslog mailing list