[x265-commits] [x265] slicetype: make b-adapt 0 set lastNonB, leadingBframes, a...

Steve Borho steve at borho.org
Wed Nov 6 09:07:38 CET 2013


details:   http://hg.videolan.org/x265/rev/7aa33c9734f5
branches:  
changeset: 4837:7aa33c9734f5
user:      Steve Borho <steve at borho.org>
date:      Mon Nov 04 23:26:59 2013 -0600
description:
slicetype: make b-adapt 0 set lastNonB, leadingBframes, and bLastMiniGopBFrame
Subject: [x265] collect global stats of psnr and ssim

details:   http://hg.videolan.org/x265/rev/6f19e6ef9ab5
branches:  
changeset: 4838:6f19e6ef9ab5
user:      Santhoshini Sekar <santhoshini at multicorewareinc.com>
date:      Tue Nov 05 10:11:46 2013 +0530
description:
collect global stats of psnr and ssim
Subject: [x265] api: use uint64_t to accumulate bits

details:   http://hg.videolan.org/x265/rev/c57ed1fd7bd5
branches:  
changeset: 4839:c57ed1fd7bd5
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 00:39:00 2013 -0600
description:
api: use uint64_t to accumulate bits
Subject: [x265] Adding function pointer type & array definition for luma vps filter functions.

details:   http://hg.videolan.org/x265/rev/ed0dd83bb7ca
branches:  
changeset: 4840:ed0dd83bb7ca
user:      Nabajit Deka
date:      Tue Nov 05 12:45:18 2013 +0530
description:
Adding function pointer type & array definition for luma vps filter functions.
Subject: [x265] Adding C primitive for luma vps filter functions.

details:   http://hg.videolan.org/x265/rev/9d29fff93f3a
branches:  
changeset: 4841:9d29fff93f3a
user:      Nabajit Deka
date:      Tue Nov 05 12:47:42 2013 +0530
description:
Adding C primitive for luma vps filter functions.
Subject: [x265] Adding test bench code for luma vps filter functions.

details:   http://hg.videolan.org/x265/rev/f8053c69b732
branches:  
changeset: 4842:f8053c69b732
user:      Nabajit Deka
date:      Tue Nov 05 12:50:01 2013 +0530
description:
Adding test bench code for luma vps filter functions.
Subject: [x265] asm: routines for luma vps filter functions for all block sizes.

details:   http://hg.videolan.org/x265/rev/29d3861c5370
branches:  
changeset: 4843:29d3861c5370
user:      Nabajit Deka
date:      Tue Nov 05 13:06:09 2013 +0530
description:
asm: routines for luma vps filter functions for all block sizes.
Subject: [x265] Adding asm function declaration and function pointer initializations for luma vps functions.

details:   http://hg.videolan.org/x265/rev/df9d7d85a146
branches:  
changeset: 4844:df9d7d85a146
user:      Nabajit Deka
date:      Tue Nov 05 13:17:25 2013 +0530
description:
Adding asm function declaration and function pointer initializations for luma vps functions.
Subject: [x265] tenccu:remove calling outTempCU->initEstData() multiple time without changing outTempCU from xCompressIntraCU

details:   http://hg.videolan.org/x265/rev/925ed6f7ed34
branches:  
changeset: 4845:925ed6f7ed34
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 14:59:09 2013 +0530
description:
tenccu:remove calling outTempCU->initEstData() multiple time without changing outTempCU from xCompressIntraCU
Subject: [x265] input:reset the file pointer before return in guessFrameCount()

details:   http://hg.videolan.org/x265/rev/ece7af249573
branches:  
changeset: 4846:ece7af249573
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 14:12:39 2013 +0530
description:
input:reset the file pointer before return in guessFrameCount()
Subject: [x265] cli: use 64bit byte counter (closes #1)

details:   http://hg.videolan.org/x265/rev/3c15a9f74091
branches:  stable
changeset: 4847:3c15a9f74091
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 12:06:07 2013 -0600
description:
cli: use 64bit byte counter (closes #1)
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/ba8c09070e54
branches:  
changeset: 4848:ba8c09070e54
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 12:43:10 2013 -0600
description:
Merge with stable
Subject: [x265] cmake: document minimum cmake required version for VC12

details:   http://hg.videolan.org/x265/rev/be7af3216ebd
branches:  
changeset: 4849:be7af3216ebd
user:      Neil Piken <neilpiken at gmail.com>
date:      Sat Nov 02 10:02:26 2013 +0800
description:
cmake: document minimum cmake required version for VC12
Subject: [x265] changed naming convention and added unit test code for blockcopy_sp function

details:   http://hg.videolan.org/x265/rev/9deec9d96ed4
branches:  
changeset: 4850:9deec9d96ed4
user:      Praveen Tiwari
date:      Tue Nov 05 15:13:42 2013 +0530
description:
changed naming convention and added unit test code for blockcopy_sp function
Subject: [x265] changed the naming convention for blockcopy_sp

details:   http://hg.videolan.org/x265/rev/e3853b2cbaa8
branches:  
changeset: 4851:e3853b2cbaa8
user:      Praveen Tiwari
date:      Tue Nov 05 15:28:56 2013 +0530
description:
changed the naming convention for blockcopy_sp
Subject: [x265] tcomdatacu: remove unused setOutsideCUPart() function

details:   http://hg.videolan.org/x265/rev/a38c5f57cf7e
branches:  
changeset: 4852:a38c5f57cf7e
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 16:33:31 2013 +0530
description:
tcomdatacu: remove unused setOutsideCUPart() function
Subject: [x265] tcomdatacu: remove unused copyInterPredInfoFrom() function

details:   http://hg.videolan.org/x265/rev/f3f510808287
branches:  
changeset: 4853:f3f510808287
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 16:36:49 2013 +0530
description:
tcomdatacu: remove unused copyInterPredInfoFrom() function
Subject: [x265] tcomdatacu: remove unused copySubCU() function

details:   http://hg.videolan.org/x265/rev/1028756870f7
branches:  
changeset: 4854:1028756870f7
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 16:40:59 2013 +0530
description:
tcomdatacu: remove unused copySubCU() function
Subject: [x265] tcomdatacu: Remove memset from create(), these variables are initialized in initCU()

details:   http://hg.videolan.org/x265/rev/67ec1b965461
branches:  
changeset: 4855:67ec1b965461
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 15:56:31 2013 +0530
description:
tcomdatacu: Remove memset from create(), these variables are initialized in initCU()
Subject: [x265] tenccu: remove calling outTempCU->initEstData() multiple time without modifying outTempCU

details:   http://hg.videolan.org/x265/rev/486f2cff2c3e
branches:  
changeset: 4856:486f2cff2c3e
user:      Gopu Govindaswamy <gopu at multicorewareinc.com>
date:      Tue Nov 05 16:59:37 2013 +0530
description:
tenccu: remove calling outTempCU->initEstData() multiple time without modifying outTempCU
Subject: [x265] Display also version info during encoding instead of primitives setup.

details:   http://hg.videolan.org/x265/rev/5895ca0d36be
branches:  
changeset: 4857:5895ca0d36be
user:      Kurtnoise <kurtnoise at free.fr>
date:      Wed Oct 30 18:34:31 2013 +0100
description:
Display also version info during encoding instead of primitives setup.
Subject: [x265] log: white-space nit

details:   http://hg.videolan.org/x265/rev/f6cb006b3628
branches:  
changeset: 4858:f6cb006b3628
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 12:08:49 2013 -0600
description:
log: white-space nit
Subject: [x265] cli: add option to turn on AQ

details:   http://hg.videolan.org/x265/rev/ddf4d33e8c15
branches:  
changeset: 4859:ddf4d33e8c15
user:      Aarthi Thirumalai<aarthi at multicorewareinc.com>
date:      Tue Nov 05 21:14:50 2013 +0530
description:
cli: add option to turn on AQ
Subject: [x265] log: only log primitve status if some primitives are missing

details:   http://hg.videolan.org/x265/rev/e566ef4d3e95
branches:  
changeset: 4860:e566ef4d3e95
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 12:59:06 2013 -0600
description:
log: only log primitve status if some primitives are missing

Don't waste a line of log output to report everything is normal
Subject: [x265] slicetype: do not force P before I with --b-adapt 0

details:   http://hg.videolan.org/x265/rev/f7e55b468373
branches:  
changeset: 4861:f7e55b468373
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 13:00:18 2013 -0600
description:
slicetype: do not force P before I with --b-adapt 0

I don't remember what bug this was covering up, but it's no longer necessary and
it was breaking the later code which expected a single non-B per mini-GOP
Subject: [x265] log: cleanup Encoder::printSummary()

details:   http://hg.videolan.org/x265/rev/d8513c114f42
branches:  
changeset: 4862:d8513c114f42
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 14:04:41 2013 -0600
description:
log: cleanup Encoder::printSummary()
Subject: [x265] encoder: nits

details:   http://hg.videolan.org/x265/rev/9b7ca5a14605
branches:  
changeset: 4863:9b7ca5a14605
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 14:15:49 2013 -0600
description:
encoder: nits
Subject: [x265] cli: re-introduce x265_setup_primitives() call prior to printVersion()

details:   http://hg.videolan.org/x265/rev/76d1d1aa3700
branches:  
changeset: 4864:76d1d1aa3700
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 20:25:03 2013 -0600
description:
cli: re-introduce x265_setup_primitives() call prior to printVersion()

This way --cpuid N is properly respected.  This orders the output of the log
messages, but the total number is the same.
Subject: [x265] slicetype: better fix for --b-adapt 0

details:   http://hg.videolan.org/x265/rev/f56a9fc5e999
branches:  
changeset: 4865:f56a9fc5e999
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 20:48:58 2013 -0600
description:
slicetype: better fix for --b-adapt 0

Don't allow an IDR to be re-ordered
Subject: [x265] uncrustify source tree

details:   http://hg.videolan.org/x265/rev/0c9d8360e1b0
branches:  
changeset: 4866:0c9d8360e1b0
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 21:21:27 2013 -0600
description:
uncrustify source tree
Subject: [x265] main10: fix dct and MC primitives to correctly respect larger pixel sizes

details:   http://hg.videolan.org/x265/rev/b24d05dd4990
branches:  
changeset: 4867:b24d05dd4990
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 14:42:46 2013 -0600
description:
main10: fix dct and MC primitives to correctly respect larger pixel sizes
Subject: [x265] main10: allow pixel sizes of 10 and 12 for HIGH_BIT_DEPTH builds

details:   http://hg.videolan.org/x265/rev/6a94dca867c8
branches:  
changeset: 4868:6a94dca867c8
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 14:54:13 2013 -0600
description:
main10: allow pixel sizes of 10 and 12 for HIGH_BIT_DEPTH builds

Removes param.internalBitDepth and uses inputBitDepth to mean both the size of
input pixels and internal pixels (x265 will do no color space conversions)
Subject: [x265] rext: partial support for 4:2:2 and 4:4:4 color spaces

details:   http://hg.videolan.org/x265/rev/7cdcf1a03d93
branches:  
changeset: 4869:7cdcf1a03d93
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 14:53:10 2013 -0600
description:
rext: partial support for 4:2:2 and 4:4:4 color spaces

reconFileBitDepth did not need to be a member of x265_param, and the comment
for inputBitDepth needed to mention that it also determined the internal bit
depth of the encoder.
Subject: [x265] cmake: use detected yasm executable for CMAKE_ASM_YASM_COMPILER variable

details:   http://hg.videolan.org/x265/rev/ae906d212c5e
branches:  
changeset: 4870:ae906d212c5e
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 23:42:27 2013 -0600
description:
cmake: use detected yasm executable for CMAKE_ASM_YASM_COMPILER variable
Subject: [x265] cmake: link platform libraries into the shared library (fixes PPA builds)

details:   http://hg.videolan.org/x265/rev/0234bd136cb9
branches:  
changeset: 4871:0234bd136cb9
user:      Steve Borho <steve at borho.org>
date:      Wed Nov 06 02:05:19 2013 -0600
description:
cmake: link platform libraries into the shared library (fixes PPA builds)
Subject: [x265] motion: move StarPatternSearch higher in the file, no behavior change

details:   http://hg.videolan.org/x265/rev/bc99537483f1
branches:  
changeset: 4872:bc99537483f1
user:      Steve Borho <steve at borho.org>
date:      Tue Nov 05 22:21:55 2013 -0600
description:
motion: move StarPatternSearch higher in the file, no behavior change

diffstat:

 build/README.txt                                    |    6 +-
 source/CMakeLists.txt                               |    1 +
 source/Lib/TLibCommon/ContextTables.h               |    3 +-
 source/Lib/TLibCommon/TComDataCU.cpp                |  231 +----
 source/Lib/TLibCommon/TComDataCU.h                  |  112 +-
 source/Lib/TLibCommon/TComPattern.cpp               |   15 +-
 source/Lib/TLibCommon/TComPic.cpp                   |    8 +-
 source/Lib/TLibCommon/TComPic.h                     |    4 +
 source/Lib/TLibCommon/TComPicSym.cpp                |    4 +-
 source/Lib/TLibCommon/TComPicSym.h                  |    2 +-
 source/Lib/TLibCommon/TComPicYuv.cpp                |   98 +-
 source/Lib/TLibCommon/TComPicYuv.h                  |    9 +-
 source/Lib/TLibCommon/TComPicYuvMD5.cpp             |    2 +
 source/Lib/TLibCommon/TComPrediction.cpp            |   18 +-
 source/Lib/TLibCommon/TComPrediction.h              |    2 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  |    2 +-
 source/Lib/TLibCommon/TComSlice.cpp                 |    2 -
 source/Lib/TLibCommon/TComSlice.h                   |    4 -
 source/Lib/TLibCommon/TComTrQuant.cpp               |   44 +-
 source/Lib/TLibCommon/TComTrQuant.h                 |    4 +-
 source/Lib/TLibCommon/TComYuv.cpp                   |   40 +-
 source/Lib/TLibCommon/TComYuv.h                     |    9 +-
 source/Lib/TLibCommon/TypeDef.h                     |    3 +
 source/Lib/TLibEncoder/NALwrite.h                   |    4 +-
 source/Lib/TLibEncoder/TEncAnalyze.h                |  157 ----
 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp        |    1 +
 source/Lib/TLibEncoder/TEncCfg.h                    |    4 +
 source/Lib/TLibEncoder/TEncCu.cpp                   |   53 +-
 source/Lib/TLibEncoder/TEncCu.h                     |    2 +-
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |    2 +-
 source/Lib/TLibEncoder/TEncSearch.cpp               |   42 +-
 source/Lib/TLibEncoder/TEncSearch.h                 |    8 +-
 source/cmake/CMakeDetermineASM_YASMCompiler.cmake   |    2 +-
 source/common/TShortYUV.cpp                         |   28 +-
 source/common/TShortYUV.h                           |    6 +-
 source/common/common.cpp                            |  200 ++--
 source/common/common.h                              |    1 +
 source/common/cpu.cpp                               |    2 +-
 source/common/dct.cpp                               |   40 +-
 source/common/ipfilter.cpp                          |  132 ++-
 source/common/lowres.cpp                            |    3 +-
 source/common/lowres.h                              |    2 +-
 source/common/pixel.cpp                             |  124 +-
 source/common/primitives.cpp                        |   17 +-
 source/common/primitives.h                          |    8 +-
 source/common/vec/dct-sse41.cpp                     |    6 +-
 source/common/vec/intra-sse41.cpp                   |    7 +-
 source/common/vec/intra-ssse3.cpp                   |  785 ++++++++++---------
 source/common/vec/ipfilter-sse41.cpp                |    6 +-
 source/common/vec/ipfilter-ssse3.cpp                |    6 +-
 source/common/vec/pixel-avx2.cpp                    |    5 +-
 source/common/vec/pixel16-sse41.cpp                 |    1 +
 source/common/version.cpp                           |    2 +-
 source/common/x86/asm-primitives.cpp                |   31 +-
 source/common/x86/ipfilter8.asm                     |  304 +++++-
 source/common/x86/ipfilter8.h                       |    7 +-
 source/common/x86/mc.h                              |    2 +-
 source/common/x86/pixel.h                           |   12 +-
 source/encoder/CMakeLists.txt                       |    1 -
 source/encoder/bitcost.cpp                          |    3 +-
 source/encoder/compress.cpp                         |    7 +-
 source/encoder/cturow.cpp                           |    6 +-
 source/encoder/encoder.cpp                          |  143 ++-
 source/encoder/encoder.h                            |   35 +-
 source/encoder/frameencoder.cpp                     |   11 +-
 source/encoder/frameencoder.h                       |    2 +-
 source/encoder/framefilter.cpp                      |    8 +-
 source/encoder/motion.cpp                           |  484 ++++++------
 source/encoder/ratecontrol.cpp                      |   14 +-
 source/encoder/slicetype.cpp                        |   28 +-
 source/input/input.cpp                              |    6 +-
 source/input/input.h                                |    6 +-
 source/input/y4m.cpp                                |  137 ++-
 source/input/y4m.h                                  |   34 +-
 source/input/yuv.cpp                                |   16 +-
 source/input/yuv.h                                  |   12 +-
 source/output/output.cpp                            |    6 +-
 source/output/output.h                              |    2 +-
 source/output/y4m.cpp                               |   92 +-
 source/output/y4m.h                                 |    6 +-
 source/output/yuv.cpp                               |   76 +-
 source/output/yuv.h                                 |    6 +-
 source/test/ipfilterharness.cpp                     |   76 +-
 source/test/ipfilterharness.h                       |    1 +
 source/test/pixelharness.cpp                        |   55 +
 source/test/pixelharness.h                          |    2 +
 source/test/testbench.cpp                           |    2 +-
 source/x265.cpp                                     |  103 +-
 source/x265.h                                       |   52 +-
 89 files changed, 2219 insertions(+), 1848 deletions(-)

diffs (truncated from 7398 to 300 lines):

diff -r 686b5b502797 -r bc99537483f1 build/README.txt
--- a/build/README.txt	Mon Nov 04 22:50:48 2013 -0600
+++ b/build/README.txt	Tue Nov 05 22:21:55 2013 -0600
@@ -1,9 +1,11 @@
 = Mandatory Prerequisites =
 
-* GCC, MSVC (9, 10, or 11), or Intel C/C++
-* CMake 2.6 or later http://www.cmake.org
+* GCC, MSVC (9, 10, 11, 12), Xcode or Intel C/C++
+* CMake 2.8.8 or later http://www.cmake.org
 * On linux, ccmake is helpful, usually a package named cmake-curses-gui 
 
+Note: MSVC12 requires cmake 2.8.11 or later
+
 
 = Optional Prerequisites =
 
diff -r 686b5b502797 -r bc99537483f1 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Nov 04 22:50:48 2013 -0600
+++ b/source/CMakeLists.txt	Tue Nov 05 22:21:55 2013 -0600
@@ -179,6 +179,7 @@ endif()
 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
 add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
                                $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
+target_link_libraries(x265-shared ${PLATFORM_LIBS})
 set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
 if(NOT MSVC)
     set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
diff -r 686b5b502797 -r bc99537483f1 source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h	Mon Nov 04 22:50:48 2013 -0600
+++ b/source/Lib/TLibCommon/ContextTables.h	Tue Nov 05 22:21:55 2013 -0600
@@ -129,7 +129,8 @@
 // ====================================================================================================================
 // Sbac interface
 // ====================================================================================================================
-typedef struct ContextModel {
+typedef struct ContextModel
+{
     uint8_t m_state;  ///< internal state variable
     uint8_t bBinsCoded;
 } ContextModel;
diff -r 686b5b502797 -r bc99537483f1 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Nov 04 22:50:48 2013 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Nov 05 22:21:55 2013 -0600
@@ -100,13 +100,18 @@ TComDataCU::TComDataCU()
     m_mvpIdx[1] = NULL;
     m_mvpNum[0] = NULL;
     m_mvpNum[1] = NULL;
+    m_chromaFormat = 0;
 }
 
 TComDataCU::~TComDataCU()
 {}
 
-void TComDataCU::create(uint32_t numPartition, uint32_t width, uint32_t height, int unitSize)
+void TComDataCU::create(uint32_t numPartition, uint32_t width, uint32_t height, int unitSize, int csp)
 {
+    m_hChromaShift = CHROMA_H_SHIFT(csp);
+    m_vChromaShift = CHROMA_V_SHIFT(csp);
+    m_chromaFormat = csp;
+
     m_pic           = NULL;
     m_slice         = NULL;
     m_numPartitions = numPartition;
@@ -149,20 +154,15 @@ void TComDataCU::create(uint32_t numPart
     m_mvpIdx[1] = new char[numPartition];
     m_mvpNum[0] = new char[numPartition];
     m_mvpNum[1] = new char[numPartition];
-    memset(m_mvpIdx[0], -1, numPartition * sizeof(char));
-    memset(m_mvpIdx[1], -1, numPartition * sizeof(char));
 
     m_trCoeffY  = (TCoeff*)X265_MALLOC(TCoeff, width * height);
-    m_trCoeffCb = (TCoeff*)X265_MALLOC(TCoeff, width * height / 4);
-    m_trCoeffCr = (TCoeff*)X265_MALLOC(TCoeff, width * height / 4);
-    memset(m_trCoeffY, 0, width * height * sizeof(TCoeff));
-    memset(m_trCoeffCb, 0, width * height / 4 * sizeof(TCoeff));
-    memset(m_trCoeffCr, 0, width * height / 4 * sizeof(TCoeff));
+    m_trCoeffCb = (TCoeff*)X265_MALLOC(TCoeff, (width >> m_hChromaShift) * (height >> m_vChromaShift));
+    m_trCoeffCr = (TCoeff*)X265_MALLOC(TCoeff, (width >> m_hChromaShift) * (height >> m_vChromaShift));
 
     m_iPCMFlags   = (bool*)X265_MALLOC(bool, numPartition);
     m_iPCMSampleY  = (Pel*)X265_MALLOC(Pel, width * height);
-    m_iPCMSampleCb = (Pel*)X265_MALLOC(Pel, width * height / 4);
-    m_iPCMSampleCr = (Pel*)X265_MALLOC(Pel, width * height / 4);
+    m_iPCMSampleCb = (Pel*)X265_MALLOC(Pel, (width >> m_hChromaShift) * (height >> m_vChromaShift));
+    m_iPCMSampleCr = (Pel*)X265_MALLOC(Pel, (width >> m_hChromaShift) * (height >> m_vChromaShift));
 
     m_cuMvField[0].create(numPartition);
     m_cuMvField[1].create(numPartition);
@@ -316,31 +316,32 @@ void TComDataCU::initCU(TComPic* pic, ui
         memset(m_iPCMFlags        + firstElement, false,                    numElements * sizeof(*m_iPCMFlags));
     }
 
-    uint32_t tmp = g_maxCUWidth * g_maxCUHeight;
+    uint32_t y_tmp = g_maxCUWidth * g_maxCUHeight;
+    uint32_t c_tmp = (g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift);
     if (0 >= partStartIdx)
     {
         m_cuMvField[0].clearMvField();
         m_cuMvField[1].clearMvField();
-        memset(m_trCoeffY, 0, sizeof(TCoeff) * tmp);
-        memset(m_iPCMSampleY, 0, sizeof(Pel) * tmp);
-        tmp  >>= 2;
-        memset(m_trCoeffCb, 0, sizeof(TCoeff) * tmp);
-        memset(m_trCoeffCr, 0, sizeof(TCoeff) * tmp);
-        memset(m_iPCMSampleCb, 0, sizeof(Pel) * tmp);
-        memset(m_iPCMSampleCr, 0, sizeof(Pel) * tmp);
+        memset(m_trCoeffY, 0, sizeof(TCoeff) * y_tmp);
+        memset(m_iPCMSampleY, 0, sizeof(Pel) * y_tmp);
+
+        memset(m_trCoeffCb, 0, sizeof(TCoeff) * c_tmp);
+        memset(m_trCoeffCr, 0, sizeof(TCoeff) * c_tmp);
+        memset(m_iPCMSampleCb, 0, sizeof(Pel) * c_tmp);
+        memset(m_iPCMSampleCr, 0, sizeof(Pel) * c_tmp);
     }
     else
     {
         TComDataCU * from = pic->getCU(getAddr());
         m_cuMvField[0].copyFrom(&from->m_cuMvField[0], m_numPartitions, 0);
         m_cuMvField[1].copyFrom(&from->m_cuMvField[1], m_numPartitions, 0);
-        for (int i = 0; i < tmp; i++)
+        for (int i = 0; i < y_tmp; i++)
         {
             m_trCoeffY[i] = from->m_trCoeffY[i];
             m_iPCMSampleY[i] = from->m_iPCMSampleY[i];
         }
 
-        for (int i = 0; i < (tmp >> 2); i++)
+        for (int i = 0; i < c_tmp; i++)
         {
             m_trCoeffCb[i] = from->m_trCoeffCb[i];
             m_trCoeffCr[i] = from->m_trCoeffCr[i];
@@ -435,22 +436,18 @@ void TComDataCU::initEstData(uint32_t de
         m_cbf[2][i] = 0;
     }
 
-    uint32_t uiTmp = width * height;
-
-    {
-        m_cuMvField[0].clearMvField();
-        m_cuMvField[1].clearMvField();
-        uiTmp = width * height;
-
-        memset(m_trCoeffY,    0, uiTmp * sizeof(*m_trCoeffY));
-        memset(m_iPCMSampleY, 0, uiTmp * sizeof(*m_iPCMSampleY));
-
-        uiTmp >>= 2;
-        memset(m_trCoeffCb,    0, uiTmp * sizeof(*m_trCoeffCb));
-        memset(m_trCoeffCr,    0, uiTmp * sizeof(*m_trCoeffCr));
-        memset(m_iPCMSampleCb, 0, uiTmp * sizeof(*m_iPCMSampleCb));
-        memset(m_iPCMSampleCr, 0, uiTmp * sizeof(*m_iPCMSampleCr));
-    }
+    m_cuMvField[0].clearMvField();
+    m_cuMvField[1].clearMvField();
+
+    uint32_t tmp = width * height;
+    memset(m_trCoeffY,    0, tmp * sizeof(*m_trCoeffY));
+    memset(m_iPCMSampleY, 0, tmp * sizeof(*m_iPCMSampleY));
+
+    tmp = (width >> m_hChromaShift) * (height >> m_vChromaShift);
+    memset(m_trCoeffCb,    0, tmp * sizeof(*m_trCoeffCb));
+    memset(m_trCoeffCr,    0, tmp * sizeof(*m_trCoeffCr));
+    memset(m_iPCMSampleCb, 0, tmp * sizeof(*m_iPCMSampleCb));
+    memset(m_iPCMSampleCr, 0, tmp * sizeof(*m_iPCMSampleCr));
 }
 
 // initialize Sub partition
@@ -519,11 +516,13 @@ void TComDataCU::initSubCU(TComDataCU* c
     uint32_t tmp = width * heigth;
     memset(m_trCoeffY, 0, sizeof(TCoeff) * tmp);
     memset(m_iPCMSampleY, 0, sizeof(Pel) * tmp);
-    tmp >>= 2;
+
+    tmp = (width >> m_hChromaShift) * (heigth >> m_vChromaShift);
     memset(m_trCoeffCb, 0, sizeof(TCoeff) * tmp);
     memset(m_trCoeffCr, 0, sizeof(TCoeff) * tmp);
     memset(m_iPCMSampleCb, 0, sizeof(Pel) * tmp);
     memset(m_iPCMSampleCr, 0, sizeof(Pel) * tmp);
+
     m_cuMvField[0].clearMvField();
     m_cuMvField[1].clearMvField();
 
@@ -536,138 +535,10 @@ void TComDataCU::initSubCU(TComDataCU* c
     m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
 }
 
-void TComDataCU::setOutsideCUPart(uint32_t absPartIdx, uint32_t depth)
-{
-    uint32_t numPartition = m_numPartitions >> (depth << 1);
-    uint32_t sizeInUChar = sizeof(UChar) * numPartition;
-
-    UChar width  = g_maxCUWidth  >> depth;
-    UChar height = g_maxCUHeight >> depth;
-
-    memset(m_depth  + absPartIdx, depth,  sizeInUChar);
-    memset(m_width  + absPartIdx, width,  sizeInUChar);
-    memset(m_height + absPartIdx, height, sizeInUChar);
-}
-
 // --------------------------------------------------------------------------------------------------------------------
 // Copy
 // --------------------------------------------------------------------------------------------------------------------
 
-void TComDataCU::copySubCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth)
-{
-    uint32_t part = absPartIdx;
-
-    m_pic              = cu->getPic();
-    m_slice            = cu->getSlice();
-    m_cuAddr           = cu->getAddr();
-    m_absIdxInLCU      = absPartIdx;
-
-    m_cuPelX           = cu->getCUPelX() + g_rasterToPelX[g_zscanToRaster[absPartIdx]];
-    m_cuPelY           = cu->getCUPelY() + g_rasterToPelY[g_zscanToRaster[absPartIdx]];
-
-    uint32_t width         = g_maxCUWidth  >> depth;
-    uint32_t height        = g_maxCUHeight >> depth;
-
-    m_skipFlag = cu->getSkipFlag() + part;
-
-    m_qp = cu->getQP() + part;
-    m_partSizes = cu->getPartitionSize() + part;
-    m_predModes = cu->getPredictionMode() + part;
-    m_cuTransquantBypass  = cu->getCUTransquantBypass() + part;
-
-    m_bMergeFlags      = cu->getMergeFlag() + part;
-    m_mergeIndex       = cu->getMergeIndex() + part;
-
-    m_lumaIntraDir     = cu->getLumaIntraDir()     + part;
-    m_chromaIntraDir   = cu->getChromaIntraDir()   + part;
-    m_interDir         = cu->getInterDir()         + part;
-    m_trIdx            = cu->getTransformIdx()     + part;
-    m_transformSkip[0] = cu->getTransformSkip(TEXT_LUMA)     + part;
-    m_transformSkip[1] = cu->getTransformSkip(TEXT_CHROMA_U) + part;
-    m_transformSkip[2] = cu->getTransformSkip(TEXT_CHROMA_V) + part;
-
-    m_cbf[0] = cu->getCbf(TEXT_LUMA)     + part;
-    m_cbf[1] = cu->getCbf(TEXT_CHROMA_U) + part;
-    m_cbf[2] = cu->getCbf(TEXT_CHROMA_V) + part;
-
-    m_depth = cu->getDepth()   + part;
-    m_width = cu->getWidth()   + part;
-    m_height = cu->getHeight() + part;
-
-    m_mvpIdx[0] = cu->getMVPIdx(REF_PIC_LIST_0)  + part;
-    m_mvpIdx[1] = cu->getMVPIdx(REF_PIC_LIST_1)  + part;
-    m_mvpNum[0] = cu->getMVPNum(REF_PIC_LIST_0)  + part;
-    m_mvpNum[1] = cu->getMVPNum(REF_PIC_LIST_1)  + part;
-
-    m_iPCMFlags = cu->getIPCMFlag() + part;
-
-    m_cuAboveLeft  = cu->getCUAboveLeft();
-    m_cuAboveRight = cu->getCUAboveRight();
-    m_cuAbove      = cu->getCUAbove();
-    m_cuLeft       = cu->getCULeft();
-
-    m_cuColocated[0] = cu->getCUColocated(REF_PIC_LIST_0);
-    m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
-
-    uint32_t tmp = width * height;
-    uint32_t maxCUWidth = cu->getSlice()->getSPS()->getMaxCUWidth();
-    uint32_t maxCUHeight = cu->getSlice()->getSPS()->getMaxCUHeight();
-    uint32_t coeffOffset = maxCUWidth * maxCUHeight * absPartIdx / cu->getPic()->getNumPartInCU();
-
-    m_trCoeffY = cu->getCoeffY() + coeffOffset;
-    m_iPCMSampleY = cu->getPCMSampleY() + coeffOffset;
-
-    tmp >>= 2;
-    coeffOffset >>= 2;
-    m_trCoeffCb = cu->getCoeffCb() + coeffOffset;
-    m_trCoeffCr = cu->getCoeffCr() + coeffOffset;
-    m_iPCMSampleCb = cu->getPCMSampleCb() + coeffOffset;
-    m_iPCMSampleCr = cu->getPCMSampleCr() + coeffOffset;
-
-    m_cuMvField[0].linkToWithOffset(cu->getCUMvField(REF_PIC_LIST_0), part);
-    m_cuMvField[1].linkToWithOffset(cu->getCUMvField(REF_PIC_LIST_1), part);
-}
-
-// Copy inter prediction info from the biggest CU
-void TComDataCU::copyInterPredInfoFrom(TComDataCU* cu, uint32_t absPartIdx, int picList)
-{
-    m_pic              = cu->getPic();
-    m_slice            = cu->getSlice();
-    m_cuAddr           = cu->getAddr();
-    m_absIdxInLCU      = absPartIdx;
-
-    int rastPartIdx     = g_zscanToRaster[absPartIdx];
-    m_cuPelX           = cu->getCUPelX() + m_pic->getMinCUWidth() * (rastPartIdx % m_pic->getNumPartInWidth());
-    m_cuPelY           = cu->getCUPelY() + m_pic->getMinCUHeight() * (rastPartIdx / m_pic->getNumPartInWidth());
-
-    m_cuAboveLeft      = cu->getCUAboveLeft();
-    m_cuAboveRight     = cu->getCUAboveRight();
-    m_cuAbove          = cu->getCUAbove();
-    m_cuLeft           = cu->getCULeft();
-
-    m_cuColocated[0]  = cu->getCUColocated(REF_PIC_LIST_0);
-    m_cuColocated[1]  = cu->getCUColocated(REF_PIC_LIST_1);
-
-    m_skipFlag           = cu->getSkipFlag() + absPartIdx;
-


More information about the x265-commits mailing list