[x265] [PATCH] replace for loops with memcpy

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Wed Apr 1 10:18:22 CEST 2015


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1427870017 -19800
#      Wed Apr 01 12:03:37 2015 +0530
# Node ID 95c1c565c38373b3edf651f96c4d5f50ed0e01d2
# Parent  cfc64c1861c282a2aa8dec3f0be127eaaf121469
replace for loops with memcpy

diff -r cfc64c1861c2 -r 95c1c565c383 source/common/picyuv.cpp
--- a/source/common/picyuv.cpp	Tue Mar 31 17:40:39 2015 +0530
+++ b/source/common/picyuv.cpp	Wed Apr 01 12:03:37 2015 +0530
@@ -175,8 +175,7 @@
 
         for (int r = 0; r < height; r++)
         {
-            for (int c = 0; c < width; c++)
-                yPixel[c] = (pixel)yChar[c];
+            memcpy(yPixel, yChar, width * sizeof(pixel));
 
             yPixel += m_stride;
             yChar += pic.stride[0] / sizeof(*yChar);
@@ -184,11 +183,8 @@
 
         for (int r = 0; r < height >> m_vChromaShift; r++)
         {
-            for (int c = 0; c < width >> m_hChromaShift; c++)
-            {
-                uPixel[c] = (pixel)uChar[c];
-                vPixel[c] = (pixel)vChar[c];
-            }
+            memcpy(uPixel, uChar, (width >> m_hChromaShift) * sizeof(pixel));
+            memcpy(vPixel, vChar, (width >> m_hChromaShift) * sizeof(pixel));
 
             uPixel += m_strideC;
             vPixel += m_strideC;


More information about the x265-devel mailing list