[x265-commits] [x265] level: VBV buffer size needs to be checked before determi...

Deepthi Nandakumar deepthi at multicorewareinc.com
Wed Feb 4 04:04:24 CET 2015


details:   http://hg.videolan.org/x265/rev/a56c2a3dfec0
branches:  
changeset: 9272:a56c2a3dfec0
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Feb 03 10:22:08 2015 +0530
description:
level: VBV buffer size needs to be checked before determining tier

Also, fix a typo in enforceLevel.
Subject: [x265] blockfill_s_8x8 sse2 asm code optimization

details:   http://hg.videolan.org/x265/rev/4583eda4cf55
branches:  
changeset: 9273:4583eda4cf55
user:      Praveen Tiwari
date:      Mon Feb 02 17:03:40 2015 +0530
description:
blockfill_s_8x8 sse2 asm code optimization

improved, 100.04c -> 90.05c
Subject: [x265] blockcopy_pp_4x8 sse2 asm code optimization

details:   http://hg.videolan.org/x265/rev/b0be54fb45cf
branches:  
changeset: 9274:b0be54fb45cf
user:      Praveen Tiwari
date:      Tue Feb 03 11:25:35 2015 +0530
description:
blockcopy_pp_4x8 sse2 asm code optimization

improved, 130.02c -> 117.50
Subject: [x265] blockcopy_pp[4x16:4x32], sse2 asm code optimization

details:   http://hg.videolan.org/x265/rev/059892f65db3
branches:  
changeset: 9275:059892f65db3
user:      Praveen Tiwari
date:      Tue Feb 03 11:58:18 2015 +0530
description:
blockcopy_pp[4x16:4x32], sse2 asm code optimization

improved, 222.93c -> 206.77c
          409.49c -> 392.13c
Subject: [x265] primitive: rename functions and add testharness code

details:   http://hg.videolan.org/x265/rev/04c0b826d54b
branches:  
changeset: 9276:04c0b826d54b
user:      Rajesh Paulraj
date:      Tue Feb 03 10:51:26 2015 +0530
description:
primitive: rename functions and add testharness code
Subject: [x265] level: choose high tier only if the determined level is greater than or equal to

details:   http://hg.videolan.org/x265/rev/0c5165777046
branches:  
changeset: 9277:0c5165777046
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Feb 03 12:06:08 2015 +0530
description:
level: choose high tier only if the determined level is greater than or equal to
levelIdc.
Subject: [x265] stats: fix double-counting of chroma intra time

details:   http://hg.videolan.org/x265/rev/5418ef20c10c
branches:  
changeset: 9278:5418ef20c10c
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 03 17:58:19 2015 -0600
description:
stats: fix double-counting of chroma intra time
Subject: [x265] stats: keep intra and inter RDO performance stats per-depth

details:   http://hg.videolan.org/x265/rev/0bcc0313f518
branches:  
changeset: 9279:0bcc0313f518
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 03 21:04:04 2015 -0600
description:
stats: keep intra and inter RDO performance stats per-depth

diffstat:

 source/common/ipfilter.cpp       |   41 ++++++++++++---
 source/common/primitives.cpp     |   31 ++++++++++++
 source/common/primitives.h       |   25 ++++++++-
 source/common/x86/blockcopy8.asm |  100 ++++++++++++++++++++++++--------------
 source/encoder/encoder.cpp       |   43 ++++++++++++++--
 source/encoder/level.cpp         |   26 +++++++---
 source/encoder/search.cpp        |   10 +--
 source/encoder/search.h          |   22 +++++---
 source/test/ipfilterharness.cpp  |   73 ++++++++++++++++++++++++++++-
 source/test/ipfilterharness.h    |    4 +-
 10 files changed, 295 insertions(+), 80 deletions(-)

diffs (truncated from 709 to 300 lines):

diff -r f189b9328d93 -r 0bcc0313f518 source/common/ipfilter.cpp
--- a/source/common/ipfilter.cpp	Mon Feb 02 17:08:08 2015 -0600
+++ b/source/common/ipfilter.cpp	Tue Feb 03 21:04:04 2015 -0600
@@ -34,8 +34,27 @@ using namespace x265;
 #endif
 
 namespace {
+template<int dstStride, int width, int height>
+void pixelToShort_c(const pixel* src, intptr_t srcStride, int16_t* dst)
+{
+    int shift = IF_INTERNAL_PREC - X265_DEPTH;
+    int row, col;
+
+    for (row = 0; row < height; row++)
+    {
+        for (col = 0; col < width; col++)
+        {
+            int16_t val = src[col] << shift;
+            dst[col] = val - (int16_t)IF_INTERNAL_OFFS;
+        }
+
+        src += srcStride;
+        dst += dstStride;
+    }
+}
+
 template<int dstStride>
-void filterConvertPelToShort_c(const pixel* src, intptr_t srcStride, int16_t* dst, int width, int height)
+void filterPixelToShort_c(const pixel* src, intptr_t srcStride, int16_t* dst, int width, int height)
 {
     int shift = IF_INTERNAL_PREC - X265_DEPTH;
     int row, col;
@@ -378,7 +397,8 @@ namespace x265 {
     p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].filter_vpp = interp_vert_pp_c<4, W, H>;  \
     p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].filter_vps = interp_vert_ps_c<4, W, H>;  \
     p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].filter_vsp = interp_vert_sp_c<4, W, H>;  \
-    p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>;
+    p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>; \
+    p.chroma[X265_CSP_I420].pu[CHROMA_420_ ## W ## x ## H].chroma_p2s = pixelToShort_c<MAX_CU_SIZE / 2, W, H>; 
 
 #define CHROMA_422(W, H) \
     p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_hpp = interp_horiz_pp_c<4, W, H>; \
@@ -386,7 +406,8 @@ namespace x265 {
     p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_vpp = interp_vert_pp_c<4, W, H>;  \
     p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_vps = interp_vert_ps_c<4, W, H>;  \
     p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_vsp = interp_vert_sp_c<4, W, H>;  \
-    p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>;
+    p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>; \
+    p.chroma[X265_CSP_I422].pu[CHROMA_422_ ## W ## x ## H].chroma_p2s = pixelToShort_c<MAX_CU_SIZE / 2, W, H>; 
 
 #define CHROMA_444(W, H) \
     p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_hpp = interp_horiz_pp_c<4, W, H>; \
@@ -394,7 +415,8 @@ namespace x265 {
     p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_vpp = interp_vert_pp_c<4, W, H>;  \
     p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_vps = interp_vert_ps_c<4, W, H>;  \
     p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_vsp = interp_vert_sp_c<4, W, H>;  \
-    p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>;
+    p.chroma[X265_CSP_I444].pu[LUMA_ ## W ## x ## H].filter_vss = interp_vert_ss_c<4, W, H>; \
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_ ## W ## x ## H].chroma_p2s = pixelToShort_c<MAX_CU_SIZE, W, H>; 
 
 #define LUMA(W, H) \
     p.pu[LUMA_ ## W ## x ## H].luma_hpp     = interp_horiz_pp_c<8, W, H>; \
@@ -403,7 +425,8 @@ namespace x265 {
     p.pu[LUMA_ ## W ## x ## H].luma_vps     = interp_vert_ps_c<8, W, H>;  \
     p.pu[LUMA_ ## W ## x ## H].luma_vsp     = interp_vert_sp_c<8, W, H>;  \
     p.pu[LUMA_ ## W ## x ## H].luma_vss     = interp_vert_ss_c<8, W, H>;  \
-    p.pu[LUMA_ ## W ## x ## H].luma_hvpp    = interp_hv_pp_c<8, W, H>;
+    p.pu[LUMA_ ## W ## x ## H].luma_hvpp    = interp_hv_pp_c<8, W, H>; \
+    p.pu[LUMA_ ## W ## x ## H].filter_p2s = pixelToShort_c<MAX_CU_SIZE, W, H>
 
 void setupFilterPrimitives_c(EncoderPrimitives& p)
 {
@@ -507,11 +530,11 @@ void setupFilterPrimitives_c(EncoderPrim
     CHROMA_444(48, 64);
     CHROMA_444(64, 16);
     CHROMA_444(16, 64);
-    p.luma_p2s = filterConvertPelToShort_c<MAX_CU_SIZE>;
+    p.luma_p2s = filterPixelToShort_c<MAX_CU_SIZE>;
 
-    p.chroma[X265_CSP_I444].p2s = filterConvertPelToShort_c<MAX_CU_SIZE>;
-    p.chroma[X265_CSP_I420].p2s = filterConvertPelToShort_c<MAX_CU_SIZE / 2>;
-    p.chroma[X265_CSP_I422].p2s = filterConvertPelToShort_c<MAX_CU_SIZE / 2>;
+    p.chroma[X265_CSP_I444].p2s = filterPixelToShort_c<MAX_CU_SIZE>;
+    p.chroma[X265_CSP_I420].p2s = filterPixelToShort_c<MAX_CU_SIZE / 2>;
+    p.chroma[X265_CSP_I422].p2s = filterPixelToShort_c<MAX_CU_SIZE / 2>;
 
     p.extendRowBorder = extendCURowColBorder;
 }
diff -r f189b9328d93 -r 0bcc0313f518 source/common/primitives.cpp
--- a/source/common/primitives.cpp	Mon Feb 02 17:08:08 2015 -0600
+++ b/source/common/primitives.cpp	Tue Feb 03 21:04:04 2015 -0600
@@ -98,6 +98,7 @@ void setupAliasPrimitives(EncoderPrimiti
         p.chroma[X265_CSP_I444].pu[i].copy_pp = p.pu[i].copy_pp;
         p.chroma[X265_CSP_I444].pu[i].addAvg  = p.pu[i].addAvg;
         p.chroma[X265_CSP_I444].pu[i].satd    = p.pu[i].satd;
+        p.chroma[X265_CSP_I444].pu[i].chroma_p2s = p.pu[i].filter_p2s;
     }
 
     for (int i = 0; i < NUM_CU_SIZES; i++)
@@ -168,6 +169,36 @@ void setupAliasPrimitives(EncoderPrimiti
     p.chroma[X265_CSP_I422].cu[BLOCK_422_2x4].sa8d = NULL;
     p.chroma[X265_CSP_I422].cu[BLOCK_422_4x8].sa8d = p.pu[LUMA_4x8].satd;
 
+    /* Chroma PU can often use filter_p2s primitives */
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_4x4].chroma_p2s   = p.pu[LUMA_4x4].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_8x8].chroma_p2s   = p.pu[LUMA_8x8].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x16].chroma_p2s = p.pu[LUMA_16x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_32x32].chroma_p2s = p.pu[LUMA_32x32].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_64x64].chroma_p2s = p.pu[LUMA_64x64].filter_p2s;
+	
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_8x4].chroma_p2s   = p.pu[LUMA_8x4].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_4x8].chroma_p2s   = p.pu[LUMA_4x8].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x8].chroma_p2s  = p.pu[LUMA_16x8].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_8x16].chroma_p2s  = p.pu[LUMA_8x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_32x16].chroma_p2s = p.pu[LUMA_32x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x32].chroma_p2s = p.pu[LUMA_16x32].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_64x32].chroma_p2s = p.pu[LUMA_64x32].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_32x64].chroma_p2s = p.pu[LUMA_32x64].filter_p2s;
+
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x12].chroma_p2s = p.pu[LUMA_16x12].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_12x16].chroma_p2s = p.pu[LUMA_12x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x4].chroma_p2s  = p.pu[LUMA_16x4].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_4x16].chroma_p2s  = p.pu[LUMA_4x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_32x24].chroma_p2s = p.pu[LUMA_32x24].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_24x32].chroma_p2s = p.pu[LUMA_24x32].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_32x8].chroma_p2s  = p.pu[LUMA_32x8].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_8x32].chroma_p2s  = p.pu[LUMA_8x32].filter_p2s;
+
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_64x48].chroma_p2s = p.pu[LUMA_64x48].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_48x64].chroma_p2s = p.pu[LUMA_48x64].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_64x16].chroma_p2s = p.pu[LUMA_64x16].filter_p2s;
+    p.chroma[X265_CSP_I444].pu[CHROMA_444_16x64].chroma_p2s = p.pu[LUMA_16x64].filter_p2s;
+
     /* alias CU copy_pp from square PU copy_pp */
     for (int i = 0; i < NUM_CU_SIZES; i++)
     {
diff -r f189b9328d93 -r 0bcc0313f518 source/common/primitives.h
--- a/source/common/primitives.h	Mon Feb 02 17:08:08 2015 -0600
+++ b/source/common/primitives.h	Tue Feb 03 21:04:04 2015 -0600
@@ -110,6 +110,21 @@ enum ChromaCU422
     BLOCK_422_32x64
 };
 
+enum ChromaPU444
+{
+    // Square (the first 5 PUs match the CU sizes)
+    CHROMA_444_4x4,   CHROMA_444_8x8,   CHROMA_444_16x16, CHROMA_444_32x32, CHROMA_444_64x64,
+    // Rectangular
+    CHROMA_444_8x4,   CHROMA_444_4x8,
+    CHROMA_444_16x8,  CHROMA_444_8x16,
+    CHROMA_444_32x16, CHROMA_444_16x32,
+    CHROMA_444_64x32, CHROMA_444_32x64,
+    // Asymmetrical (0.75, 0.25)
+    CHROMA_444_16x12, CHROMA_444_12x16, CHROMA_444_16x4,  CHROMA_444_4x16,
+    CHROMA_444_32x24, CHROMA_444_24x32, CHROMA_444_32x8,  CHROMA_444_8x32,
+    CHROMA_444_64x48, CHROMA_444_48x64, CHROMA_444_64x16, CHROMA_444_16x64,
+};
+
 typedef int  (*pixelcmp_t)(const pixel* fenc, intptr_t fencstride, const pixel* fref, intptr_t frefstride); // fenc is aligned
 typedef int  (*pixelcmp_ss_t)(const int16_t* fenc, intptr_t fencstride, const int16_t* fref, intptr_t frefstride);
 typedef int  (*pixel_ssd_s_t)(const int16_t* fenc, intptr_t fencstride);
@@ -155,7 +170,8 @@ typedef void (*filter_ps_t) (const pixel
 typedef void (*filter_sp_t) (const int16_t* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int coeffIdx);
 typedef void (*filter_ss_t) (const int16_t* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride, int coeffIdx);
 typedef void (*filter_hv_pp_t) (const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY);
-typedef void (*filter_p2s_t)(const pixel* src, intptr_t srcStride, int16_t* dst, int width, int height);
+typedef void (*filter_p2s_wxh_t)(const pixel* src, intptr_t srcStride, int16_t* dst, int width, int height);
+typedef void (*filter_p2s_t)(const pixel* src, intptr_t srcStride, int16_t* dst);
 
 typedef void (*copy_pp_t)(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride); // dst is aligned
 typedef void (*copy_sp_t)(pixel* dst, intptr_t dstStride, const int16_t* src, intptr_t srcStride);
@@ -207,6 +223,7 @@ struct EncoderPrimitives
         addAvg_t       addAvg;      // bidir motion compensation, uses 16bit values
 
         copy_pp_t      copy_pp;
+        filter_p2s_t   filter_p2s;
     }
     pu[NUM_PU_SIZES];
 
@@ -286,7 +303,7 @@ struct EncoderPrimitives
     weightp_sp_t          weight_sp;
     weightp_pp_t          weight_pp;
 
-    filter_p2s_t          luma_p2s;
+    filter_p2s_wxh_t      luma_p2s;
 
     /* There is one set of chroma primitives per color space. An encoder will
      * have just a single color space and thus it will only ever use one entry
@@ -311,6 +328,8 @@ struct EncoderPrimitives
             filter_hps_t filter_hps;
             addAvg_t     addAvg;
             copy_pp_t    copy_pp;
+            filter_p2s_t chroma_p2s;
+
         }
         pu[NUM_PU_SIZES];
 
@@ -329,7 +348,7 @@ struct EncoderPrimitives
         }
         cu[NUM_CU_SIZES];
 
-        filter_p2s_t p2s; // takes width/height as arguments
+        filter_p2s_wxh_t p2s; // takes width/height as arguments
     }
     chroma[X265_CSP_COUNT];
 };
diff -r f189b9328d93 -r 0bcc0313f518 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm	Mon Feb 02 17:08:08 2015 -0600
+++ b/source/common/x86/blockcopy8.asm	Tue Feb 03 21:04:04 2015 -0600
@@ -145,50 +145,79 @@ cglobal blockcopy_pp_4x4, 4, 4, 4
     RET
 
 ;-----------------------------------------------------------------------------
+; void blockcopy_pp_4x8(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal blockcopy_pp_4x8, 4, 6, 4
+
+    lea     r4,    [3 * r1]
+    lea     r5,    [3 * r3]
+
+    movd     m0,     [r2]
+    movd     m1,     [r2 + r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r5]
+
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2
+    movd     [r0 + r4],     m3
+
+    lea      r2,     [r2 + 4 * r3]
+    movd     m0,     [r2]
+    movd     m1,     [r2 + r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r5]
+
+    lea      r0,            [r0 + 4 * r1]
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2
+    movd     [r0 + r4],     m3
+    RET
+
+;-----------------------------------------------------------------------------
 ; void blockcopy_pp_%1x%2(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride)
 ;-----------------------------------------------------------------------------
 %macro BLOCKCOPY_PP_W4_H8 2
 INIT_XMM sse2
-cglobal blockcopy_pp_%1x%2, 4, 5, 4
+cglobal blockcopy_pp_%1x%2, 4, 7, 4
     mov    r4d,    %2/8
+    lea    r5,     [3 * r1]
+    lea    r6,     [3 * r3]
+
 .loop:
     movd     m0,     [r2]
     movd     m1,     [r2 + r3]
-    lea      r2,     [r2 + 2 * r3]
-    movd     m2,     [r2]
-    movd     m3,     [r2 + r3]
-
-    movd     [r0],                m0
-    movd     [r0 + r1],           m1
-    lea      r0,                  [r0 + 2 * r1]
-    movd     [r0],                m2
-    movd     [r0 + r1],           m3
-
-    lea       r0,     [r0 + 2 * r1]
-    lea       r2,     [r2 + 2 * r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r6]
+
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2
+    movd     [r0 + r5],     m3
+
+    lea      r2,     [r2 + 4 * r3]
     movd     m0,     [r2]
     movd     m1,     [r2 + r3]
-    lea      r2,     [r2 + 2 * r3]
-    movd     m2,     [r2]
-    movd     m3,     [r2 + r3]
-
-    movd     [r0],                m0
-    movd     [r0 + r1],           m1
-    lea      r0,                  [r0 + 2 * r1]
-    movd     [r0],                m2
-    movd     [r0 + r1],           m3
-
-    lea       r0,                  [r0 + 2 * r1]
-    lea       r2,                  [r2 + 2 * r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r6]
+
+    lea      r0,            [r0 + 4 * r1]
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2


More information about the x265-commits mailing list