From patchwork Tue Dec 3 02:41:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hwren X-Patchwork-Id: 16545 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 64B9444AF07 for ; Tue, 3 Dec 2019 04:41:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B28168AFBC; Tue, 3 Dec 2019 04:41:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-m964.mail.126.com (mail-m964.mail.126.com [123.126.96.4]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4538668AF43 for ; Tue, 3 Dec 2019 04:41:34 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=49D9O5YB3thG0e03/O bAmmo3tw5inenpTZaRhMi/oqY=; b=G3Tbx60UfsCxc2E034Wh0sKKTVw4dy4Af2 vnRXwzTjbze2bvgtA0DlwTuD00dYeJCWDk6wW7E8HTCYFr/MJZL5b1Rek45lXyzy mjsCr+qzxvFp61oINGyKOQoLN8dwhMHm52td/60VMXR3BkVd9+B1miFETpUkgGIX 22HX6NNws= Received: from localhost.localdomain (unknown [27.38.17.122]) by smtp9 (Coremail) with SMTP id NeRpCgB3CspYy+VdkJ8vAA--.302S3; Tue, 03 Dec 2019 10:41:30 +0800 (CST) From: hwren To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 Dec 2019 10:41:22 +0800 Message-Id: <1575340886-29065-1-git-send-email-hwrenx@126.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20191202125032.GA9290@sunshine.barsnick.net> References: <20191202125032.GA9290@sunshine.barsnick.net> X-CM-TRANSID: NeRpCgB3CspYy+VdkJ8vAA--.302S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar47tw18Gw4UXw43CFWUtwb_yoW8urWDp3 WfGrnFqr13WF1SyFZ3Jw4SqF43WFWkW3W8Crs7Jw1vvFyYvFyUXFy7GFWxC3yYgrZrW3WY kF4vg3Z8GF1kJrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j1MKZUUUUU= X-Originating-IP: [27.38.17.122] X-CM-SenderInfo: pkzuv0b06rjloofrz/1tbiuxqA6VpD-HytgQAAs9 Subject: [FFmpeg-devel] [PATCH v2 1/5] lavc/libxavs2.c: use more descriptive variable names in xavs2_copy_frame* functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: hwren --- libavcodec/libxavs2.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 0179a1e..3896f3b 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); } } }