changeset 851:f34557bd0c1b

Merged multicoreware/xhevc into default
author Deepthi Devaki Akkoorath <deepthidevaki@multicorewareinc.com>
date Fri, 26 Apr 2013 10:47:57 +0530
parents 8cc213785f0f (current diff) 062b636765af (diff)
children 2af6e7c7b715
files
diffstat 16 files changed, 676 insertions(+-), 519 deletions(-) [+]
line wrap: on
line diff
--- a/source/CMakeLists.txt	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/CMakeLists.txt	Fri Apr 26 10:47:57 2013 +0530
@@ -44,18 +44,11 @@ endif(HIGH_BIT_DEPTH)
 option(ENABLE_PRIMITIVES "Enable use of optimized encoder primitives" ON)
 if(ENABLE_PRIMITIVES)
     add_definitions(-DENABLE_PRIMITIVES)
-
     option(ENABLE_PRIMITIVES_VEC "Enable use of SIMD vector class primitives" ON)
-    if(ENABLE_PRIMITIVES_VEC)
-        add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
-    endif(ENABLE_PRIMITIVES_VEC)
 
     find_package(Yasm)
     if(YASM_FOUND)
         option(ENABLE_PRIMITIVES_ASM "Enable use of assembly coded primitives" ON)
-        if(ENABLE_PRIMITIVES_ASM)
-            add_definitions(-DENABLE_ASM_PRIMITIVES=1)
-        endif(ENABLE_PRIMITIVES_ASM)
     endif(YASM_FOUND)
 endif(ENABLE_PRIMITIVES)
 
@@ -65,7 +58,7 @@ if(ENABLE_PPA)
     add_subdirectory(PPA)
 endif(ENABLE_PPA)
 
-include_directories(. Lib VectorClass encoder)
+include_directories(. Lib encoder)
 add_subdirectory(Lib)
 add_subdirectory(encoder)
 
@@ -76,7 +69,6 @@ if(ENABLE_CLI)
         add_definitions(/wd4100) # unreferenced formal parameter
         add_definitions(/wd4244) # type conversion, possible loss of data
         add_definitions(/wd4512) # assignment operator could not be generated
-        SET(EXTRAS compat/msvc/getopt.c compat/msvc/getopt.h)
     endif(MSVC)
     if(GCC)
         add_definitions(-Wno-sign-compare)
@@ -88,8 +80,10 @@ if(ENABLE_CLI)
     add_subdirectory(input)
     add_subdirectory(output)
 
+    file(GLOB APPCOMMON  Lib/TAppCommon/*.h Lib/TAppCommon/*.cpp)
+
     add_executable(x265-cli
-        x265main.cpp ${EXTRAS}
+        x265main.cpp ${EXTRAS} ${APPCOMMON}
         x265cfg.cpp x265cfg.h
         x265enc.cpp x265enc.h)
 
--- a/source/Lib/CMakeLists.txt	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/Lib/CMakeLists.txt	Fri Apr 26 10:47:57 2013 +0530
@@ -13,12 +13,10 @@ if(MSVC)
     add_definitions(/wd4389) # signed/unsigned mismatch
 endif(MSVC)
 
-file(GLOB APPCOMMON  TAppCommon/*.h TAppCommon/*.cpp)
 file(GLOB LIBCOMMON  TLibCommon/*.h TLibCommon/*.cpp)
 file(GLOB LIBENCODER TLibEncoder/*.h TLibEncoder/*.cpp)
 
-source_group(TAppCommon  FILES ${APPCOMMON})
 source_group(TLibCommon  FILES ${LIBCOMMON})
 source_group(TLibEncoder FILES ${LIBENCODER})
 
-add_library(HM ${LIBCOMMON} ${LIBENCODER} ${APPCOMMON})
+add_library(HM ${LIBCOMMON} ${LIBENCODER})
--- a/source/Lib/TLibCommon/TComRdCost.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/Lib/TLibCommon/TComRdCost.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -547,14 +547,6 @@ UInt TComRdCost::xGetSAD(DistParam* pcDt
     Int  iCols   = pcDtParam->iCols;
     Int  iStrideCur = pcDtParam->iStrideCur;
     Int  iStrideOrg = pcDtParam->iStrideOrg;
-
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(iCols, iRows);
-    if (part >= 0)
-        return x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows--)
@@ -585,14 +577,6 @@ UInt TComRdCost::xGetSAD4(DistParam* pcD
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(4, iRows >> iSubShift);
-    if (part >= 0)
-        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows -= iSubStep)
@@ -624,14 +608,6 @@ UInt TComRdCost::xGetSAD8(DistParam* pcD
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(8, iRows >> iSubShift);
-    if (part >= 0)
-        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows -= iSubStep)
@@ -667,14 +643,6 @@ UInt TComRdCost::xGetSAD16(DistParam* pc
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(16, iRows >> iSubShift);
-    if (part >= 0)
-        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows -= iSubStep)
@@ -757,16 +725,8 @@ UInt TComRdCost::xGetSAD16N(DistParam* p
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
     UInt uiSum = 0;
 
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(iCols, iRows >> iSubShift);
-    if (part >= 0)
-        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     for (; iRows != 0; iRows -= iSubStep)
     {
         for (Int n = 0; n < iCols; n += 16)
@@ -811,14 +771,6 @@ UInt TComRdCost::xGetSAD32(DistParam* pc
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
-#if ENABLE_PRIMITIVES
-    int part = x265::PartitionFromSizes(32, iRows >> iSubShift);
-    if (part >= 0)
-        return (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
-               DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
-#endif
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows -= iSubStep)
@@ -879,7 +831,6 @@ UInt TComRdCost::xGetSAD24(DistParam* pc
     Int  iSubStep   = (1 << iSubShift);
     Int  iStrideCur = pcDtParam->iStrideCur * iSubStep;
     Int  iStrideOrg = pcDtParam->iStrideOrg * iSubStep;
-
     UInt uiSum = 0;
 
     for (; iRows != 0; iRows -= iSubStep)
--- a/source/Lib/TLibCommon/TComRdCost.h	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/Lib/TLibCommon/TComRdCost.h	Fri Apr 26 10:47:57 2013 +0530
@@ -230,6 +230,11 @@ public:
 #endif
     }
 
+    __inline FpDistFunc * GetsadFunctions()
+    {
+        return m_afpDistortFunc;
+    }
+
 private:
 
     static UInt xGetSSE(DistParam* pcDtParam);
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -315,30 +315,83 @@ void TEncSearch::init(TEncCfg*     pcEnc
 
 __inline Void TEncSearch::xTZSearchHelp(TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance)
 {
-    UInt  uiSad;
-
+    UInt  uiSad = 0;
     Pel*  piRefSrch;
 
     piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX;
-
-    //-- jclee for using the SAD function pointer
-    m_pcRdCost->setDistParam(pcPatternKey, piRefSrch, rcStruct.iYStride,  m_cDistParam);
+    //Initialise the DistParam for HM Primitives and Optimized Primitives
+    m_cDistParam.pOrg = pcPatternKey->getROIY();
+    m_cDistParam.pCur = piRefSrch;
+    m_cDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
+    m_cDistParam.iStrideCur = rcStruct.iYStride;
+    m_cDistParam.iCols    = pcPatternKey->getROIYWidth();
+    m_cDistParam.iRows    = pcPatternKey->getROIYHeight();
+    m_cDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
+    m_cDistParam.iStrideCur = rcStruct.iYStride;
+    m_cDistParam.iSubShift = 0;
 
     // fast encoder decision: use subsampled SAD when rows > 8 for integer ME
     if (m_pcEncCfg->getUseFastEnc())
     {
-        if (m_cDistParam.iRows > 8)
+        if (m_cDistParam.iRows > 8
+#if ENABLE_PRIMITIVES
+            && x265::FastHeight(m_cDistParam.iRows >> 1)
+#endif
+            )
         {
             m_cDistParam.iSubShift = 1;
         }
     }
-
-    setDistParamComp(0); // Y component
+    //setDistParamComp(0); // Y component
+    m_cDistParam.uiComp = 0;
 
     // distortion
     m_cDistParam.bitDepth = g_bitDepthY;
-    uiSad = m_cDistParam.DistFunc(&m_cDistParam);
-    x264_cpu_emms();
+
+    // Call the sad Primitive function if not HM sad Functions
+    Pel* piOrg   = m_cDistParam.pOrg;
+    Pel* piCur   = m_cDistParam.pCur;
+    Int  iRows   = m_cDistParam.iRows;
+    Int  iSubShift  = m_cDistParam.iSubShift;
+    Int  iSubStep   = (1 << iSubShift);
+    Int  iStrideCur = m_cDistParam.iStrideCur * iSubStep;
+    Int  iStrideOrg = m_cDistParam.iStrideOrg * iSubStep;
+
+#if ENABLE_PRIMITIVES
+    int part = x265::PartitionFromSizes(m_cDistParam.iCols, m_cDistParam.iRows >> iSubShift);
+
+    //Call the Vector or C Primitives
+    if (part >= 0)
+    {
+        uiSad = (x265::primitives.sad[part]((pixel*)piOrg, iStrideOrg, (pixel*)piCur, iStrideCur) << iSubShift) >>
+            DISTORTION_PRECISION_ADJUSTMENT(m_cDistParam.bitDepth - 8);
+
+        x264_cpu_emms();
+    }
+    else      // if None of C and Vector Primitives are available while Primitives are Enabled then call the HM Sad Functions
+#endif // if ENABLE_PRIMITIVES
+    {
+        FpDistFunc  *m_afpDistortFunc;
+        m_afpDistortFunc =  m_pcRdCost->GetsadFunctions();
+        m_cDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[m_cDistParam.iCols] + 1];
+
+#if AMP_SAD
+
+        if (m_cDistParam.iCols == 12)
+        {
+            m_cDistParam.DistFunc = m_afpDistortFunc[43];
+        }
+        else if (m_cDistParam.iCols == 24)
+        {
+            m_cDistParam.DistFunc = m_afpDistortFunc[44];
+        }
+        else if (m_cDistParam.iCols == 48)
+        {
+            m_cDistParam.DistFunc = m_afpDistortFunc[45];
+        }
+#endif     // if AMP_SAD
+        uiSad = m_cDistParam.DistFunc(&m_cDistParam);
+    }
 
     // motion cost
     uiSad += m_pcRdCost->getCost(iSearchX, iSearchY);
--- a/source/encoder/CMakeLists.txt	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/encoder/CMakeLists.txt	Fri Apr 26 10:47:57 2013 +0530
@@ -7,8 +7,16 @@ endif(GCC)
 
 if(ENABLE_PRIMITIVES)
     set(CPRIMITIVES pixel.cpp macroblock.cpp InterpolationFilter.cpp)
+    if(ENABLE_PRIMITIVES_VEC)
+        add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
+    endif(ENABLE_PRIMITIVES_VEC)
+    if(ENABLE_PRIMITIVES_ASM)
+        add_definitions(-DENABLE_ASM_PRIMITIVES=1)
+    endif(ENABLE_PRIMITIVES_ASM)
 endif(ENABLE_PRIMITIVES)
 
+include_directories(../VectorClass)
+
 add_library(x265 ../../COPYING
     ${CPRIMITIVES}
     primitives.cpp primitives.h
--- a/source/encoder/pixel.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/encoder/pixel.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -154,6 +154,22 @@ int CDECL satd8(pixel *pix1, intptr_t st
     return satd;
 }
 
+template<int h>
+int CDECL satd12(pixel *pix1, intptr_t stride_pix1, pixel *pix2, intptr_t stride_pix2)
+{
+    int satd = 0;
+
+    for (int row = 0; row < h; row += 4)
+    {
+        satd += satd_8x4(pix1 + row * stride_pix1, stride_pix1,
+                         pix2 + row * stride_pix2, stride_pix2);
+        satd += satd_4x4(pix1 + row * stride_pix1 + 8, stride_pix1,
+                         pix2 + row * stride_pix2 + 8, stride_pix2);
+    }
+
+    return satd;
+}
+
 int CDECL sa8d_8x8(pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2)
 {
     sum2_t tmp[8][4];
@@ -216,47 +232,116 @@ namespace x265 {
 void Setup_C_PixelPrimitives(EncoderPrimitives &p)
 {
     p.sad[PARTITION_4x4]   = sad<4, 4>;
-    p.sad[PARTITION_8x4]   = sad<8, 4>;
     p.sad[PARTITION_4x8]   = sad<4, 8>;
-    p.sad[PARTITION_8x8]   = sad<8, 8>;
-    p.sad[PARTITION_16x4]  = sad<16, 4>;
+    p.sad[PARTITION_4x12]  = sad<4, 12>;
     p.sad[PARTITION_4x16]  = sad<4, 16>;
-    p.sad[PARTITION_8x16]  = sad<8, 16>;
-    p.sad[PARTITION_16x8]  = sad<16, 8>;
-    p.sad[PARTITION_16x16] = sad<16, 16>;
-    p.sad[PARTITION_8x32]  = sad<8, 32>;
-    p.sad[PARTITION_32x8]  = sad<32, 8>;
+    p.sad[PARTITION_4x24]  = sad<4, 24>;
     p.sad[PARTITION_4x32]  = sad<4, 32>;
-    p.sad[PARTITION_32x4]  = sad<32, 4>;
+    p.sad[PARTITION_4x64]  = sad<4, 64>;
+
+    p.sad[PARTITION_8x4]   = sad<8, 4>;
+    p.sad[PARTITION_8x8]   = sad<8, 8>;
+    p.sad[PARTITION_8x12]  = sad<8, 12>;
+    p.sad[PARTITION_8x16]  = sad<8, 16>;
+    p.sad[PARTITION_8x24]  = sad<8, 24>;
+    p.sad[PARTITION_8x32]  = sad<8, 32>;
+    p.sad[PARTITION_8x64]  = sad<8, 64>;
+
+    p.sad[PARTITION_12x4]  = sad<12, 4>;
+    p.sad[PARTITION_12x8]  = sad<12, 8>;
+    p.sad[PARTITION_12x12] = sad<12, 12>;
+    p.sad[PARTITION_12x16] = sad<12, 16>;
+    p.sad[PARTITION_12x24] = sad<12, 24>;
+    p.sad[PARTITION_12x32] = sad<12, 32>;
+    p.sad[PARTITION_12x64] = sad<12, 64>;
+
+    p.sad[PARTITION_16x4]  = sad<16, 4>;
+    p.sad[PARTITION_16x8]  = sad<16, 8>;
+    p.sad[PARTITION_16x12] = sad<16, 12>;
+    p.sad[PARTITION_16x16] = sad<16, 16>;
+    p.sad[PARTITION_16x24] = sad<16, 24>;
     p.sad[PARTITION_16x32] = sad<16, 32>;
+    p.sad[PARTITION_16x64] = sad<16, 64>;
+
+    p.sad[PARTITION_24x4]  = sad<24, 4>;
+    p.sad[PARTITION_24x8]  = sad<24, 8>;
+    p.sad[PARTITION_24x12] = sad<24, 12>;
+    p.sad[PARTITION_24x16] = sad<24, 16>;
+    p.sad[PARTITION_24x24] = sad<24, 24>;
+    p.sad[PARTITION_24x32] = sad<24, 32>;
+    p.sad[PARTITION_24x64] = sad<24, 64>;
+
+    p.sad[PARTITION_32x4]  = sad<32, 4>;
+    p.sad[PARTITION_32x8]  = sad<32, 8>;
+    p.sad[PARTITION_32x12] = sad<32, 12>;
     p.sad[PARTITION_32x16] = sad<32, 16>;
+    p.sad[PARTITION_32x24] = sad<32, 24>;
     p.sad[PARTITION_32x32] = sad<32, 32>;
+    p.sad[PARTITION_32x64] = sad<32, 64>;
+
     p.sad[PARTITION_64x4]  = sad<64, 4>;
-    p.sad[PARTITION_4x64]  = sad<4, 64>;
     p.sad[PARTITION_64x8]  = sad<64, 8>;
-    p.sad[PARTITION_8x64]  = sad<8, 64>;
-    p.sad[PARTITION_16x64] = sad<16, 64>;
+    p.sad[PARTITION_64x12] = sad<64, 12>;
     p.sad[PARTITION_64x16] = sad<64, 16>;
-    p.sad[PARTITION_32x64] = sad<32, 64>;
+    p.sad[PARTITION_64x24] = sad<64, 24>;
     p.sad[PARTITION_64x32] = sad<64, 32>;
     p.sad[PARTITION_64x64] = sad<64, 64>;
 
     p.satd[PARTITION_4x4]   = satd_4x4;
+    p.satd[PARTITION_4x8]   = satd4<4, 8>;
+    p.satd[PARTITION_4x12]  = satd4<4, 12>;
+    p.satd[PARTITION_4x16]  = satd4<4, 16>;
+    p.satd[PARTITION_4x24]  = satd4<4, 24>;
+    p.satd[PARTITION_4x32]  = satd4<4, 32>;
+    p.satd[PARTITION_4x64]  = satd4<4, 64>;
+
     p.satd[PARTITION_8x4]   = satd_8x4;
-    p.satd[PARTITION_4x8]   = satd4<4, 8>;
     p.satd[PARTITION_8x8]   = satd8<8, 8>;
+    p.satd[PARTITION_8x12]  = satd8<8, 12>;
+    p.satd[PARTITION_8x16]  = satd8<8, 16>;
+    p.satd[PARTITION_8x24]  = satd8<8, 24>;
+    p.satd[PARTITION_8x32]  = satd8<8, 32>;
+    p.satd[PARTITION_8x64]  = satd8<8, 64>;
+
+    p.satd[PARTITION_12x4]  = satd12<4>;
+    p.satd[PARTITION_12x8]  = satd12<8>;
+    p.satd[PARTITION_12x12] = satd12<12>;
+    p.satd[PARTITION_12x16] = satd12<16>;
+    p.satd[PARTITION_12x24] = satd12<24>;
+    p.satd[PARTITION_12x32] = satd12<32>;
+    p.satd[PARTITION_12x64] = satd12<64>;
+
     p.satd[PARTITION_16x4]  = satd8<16, 4>;
-    p.satd[PARTITION_4x16]  = satd4<4, 16>;
-    p.satd[PARTITION_8x16]  = satd8<8, 16>;
     p.satd[PARTITION_16x8]  = satd8<16, 8>;
+    p.satd[PARTITION_16x12] = satd8<16, 12>;
     p.satd[PARTITION_16x16] = satd8<16, 16>;
-    p.satd[PARTITION_4x32]  = satd4<4, 32>;
+    p.satd[PARTITION_16x24] = satd8<16, 24>;
+    p.satd[PARTITION_16x32] = satd8<16, 32>;
+    p.satd[PARTITION_16x64] = satd8<16, 64>;
+
+    p.satd[PARTITION_24x4]  = satd8<24, 4>;
+    p.satd[PARTITION_24x8]  = satd8<24, 8>;
+    p.satd[PARTITION_24x12] = satd8<24, 12>;
+    p.satd[PARTITION_24x16] = satd8<24, 16>;
+    p.satd[PARTITION_24x24] = satd8<24, 24>;
+    p.satd[PARTITION_24x32] = satd8<24, 32>;
+    p.satd[PARTITION_24x64] = satd8<24, 64>;
+
     p.satd[PARTITION_32x4]  = satd8<32, 4>;
-    p.satd[PARTITION_8x32]  = satd8<8, 32>;
     p.satd[PARTITION_32x8]  = satd8<32, 8>;
-    p.satd[PARTITION_16x32] = satd8<16, 32>;
+    p.satd[PARTITION_32x12] = satd8<32, 12>;
     p.satd[PARTITION_32x16] = satd8<32, 16>;
+    p.satd[PARTITION_32x24] = satd8<32, 24>;
     p.satd[PARTITION_32x32] = satd8<32, 32>;
+    p.satd[PARTITION_32x64] = satd8<32, 64>;
+
+    p.satd[PARTITION_64x4]  = satd8<64, 4>;
+    p.satd[PARTITION_64x8]  = satd8<64, 8>;
+    p.satd[PARTITION_64x12] = satd8<64, 12>;
+    p.satd[PARTITION_64x16] = satd8<64, 16>;
+    p.satd[PARTITION_64x24] = satd8<64, 24>;
+    p.satd[PARTITION_64x32] = satd8<64, 32>;
+    p.satd[PARTITION_64x64] = satd8<64, 64>;
 
     p.sa8d_8x8 = pixel_sa8d_8x8;
     p.sa8d_16x16 = pixel_sa8d_16x16;
--- a/source/encoder/primitives.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/encoder/primitives.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -32,43 +32,28 @@ namespace x265 {
 // x265 private namespace
 
 #if ENABLE_PRIMITIVES
-static int8_t psize[16][16] =
+                        //  4   8  12  16      24     32 / 64
+static int8_t psize[16] = { 0,  1,  2,  3, -1,  4, -1, 5, 
+                           -1, -1, -1, -1, -1, -1, -1, 6 };
+
+// Returns true if the given height could support an optimized primitive
+bool FastHeight(int Height)
 {
-    // 4, 8, 12, 16, 20, 24, 28, 32
-    { PARTITION_4x4, PARTITION_4x8, -1, PARTITION_4x16, -1, -1, -1, PARTITION_4x32
-      - 1, -1, -1, -1, -1, -1, -1, PARTITION_4x64 },
-    { PARTITION_8x4, PARTITION_8x8, -1, PARTITION_8x16, -1, -1, -1, PARTITION_8x32,
-      -1, -1, -1, -1, -1, -1, -1, PARTITION_8x64 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { PARTITION_16x4, PARTITION_16x8, -1, PARTITION_16x16, -1, -1, -1, PARTITION_16x32,
-      -1, -1, -1, -1, -1, -1, -1, PARTITION_16x64 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { PARTITION_32x4, PARTITION_32x8, -1, PARTITION_32x16, -1, -1, -1, PARTITION_32x32,
-      -1, -1, -1, -1, -1, -1, -1, PARTITION_32x64 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-    { PARTITION_64x4, PARTITION_64x8, -1, PARTITION_64x16, -1, -1, -1, PARTITION_64x32,
-      -1, -1, -1, -1, -1, -1, -1, PARTITION_64x64 }
-};
+    return !(Height & ~3) && psize[(Height >> 2) - 1] >= 0;
+}
 
 // Returns a Partitions enum if the size matches a supported performance primitive,
 // else returns -1 (in which case you should use the slow path)
 int PartitionFromSizes(int Width, int Height)
 {
-    if ((Width | Height) & ~(4 | 8 | 16 | 32)) // Check for bits in the wrong places
-        return -1;
+    int8_t w = psize[(Width >> 2) - 1];
+    int8_t h = psize[(Height >> 2) - 1];
 
-    if (Width > 32 || Height > 32)
-        return -1;
+    assert(((Width | Height) & ~(4 | 8 | 16 | 32 | 64)) == 0);
+    assert((w | h) >= 0);
 
-    return (int)psize[(Width >> 2) - 1][(Height >> 2) - 1];
+    // there are currently seven height partitions per width
+    return w * 7 + h;
 }
 
 /* the "authoritative" set of encoder primitives */
@@ -82,7 +67,7 @@ void Setup_C_Primitives(EncoderPrimitive
 {
     Setup_C_PixelPrimitives(p);      // pixel.cpp
     Setup_C_MacroblockPrimitives(p); // macroblock.cpp
-    Setup_C_IPFilterPrimitives(p);
+    Setup_C_IPFilterPrimitives(p);   // InterpolationFilter.cpp
 }
 
 #endif // if ENABLE_PRIMITIVES
--- a/source/encoder/primitives.h	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/encoder/primitives.h	Fri Apr 26 10:47:57 2013 +0530
@@ -39,10 +39,12 @@ extern "C" void x264_cpu_emms(void);
 #if defined(__GNUC__)
 #define ALIGN_VAR_8(T, var)  T var __attribute__((aligned(8)))
 #define ALIGN_VAR_16(T, var) T var __attribute__((aligned(16)))
+#define ALIGN_VAR_32(T, var) T var __attribute__((aligned(32)))
 #define CDECL
 #elif defined(_MSC_VER)
 #define ALIGN_VAR_8(T, var)  __declspec(align(8)) T var
 #define ALIGN_VAR_16(T, var) __declspec(align(16)) T var
+#define ALIGN_VAR_32(T, var) __declspec(align(32)) T var
 #define CDECL                _cdecl
 #endif
 
@@ -65,31 +67,13 @@ namespace x265 {
 
 enum Partitions
 {
-    PARTITION_4x4,
-    PARTITION_8x4,
-    PARTITION_4x8,
-    PARTITION_8x8,
-    PARTITION_4x16,
-    PARTITION_16x4,
-    PARTITION_8x16,
-    PARTITION_16x8,
-    PARTITION_16x16,
-    PARTITION_4x32,
-    PARTITION_32x4,
-    PARTITION_8x32,
-    PARTITION_32x8,
-    PARTITION_16x32,
-    PARTITION_32x16,
-    PARTITION_32x32,
-    PARTITION_4x64,
-    PARTITION_64x4,
-    PARTITION_8x64,
-    PARTITION_64x8,
-    PARTITION_16x64,
-    PARTITION_64x16,
-    PARTITION_32x64,
-    PARTITION_64x32,
-    PARTITION_64x64,
+    PARTITION_4x4,  PARTITION_4x8,  PARTITION_4x12,  PARTITION_4x16,  PARTITION_4x24,  PARTITION_4x32,  PARTITION_4x64,
+    PARTITION_8x4,  PARTITION_8x8,  PARTITION_8x12,  PARTITION_8x16,  PARTITION_8x24,  PARTITION_8x32,  PARTITION_8x64,
+    PARTITION_12x4, PARTITION_12x8, PARTITION_12x12, PARTITION_12x16, PARTITION_12x24, PARTITION_12x32, PARTITION_12x64,
+    PARTITION_16x4, PARTITION_16x8, PARTITION_16x12, PARTITION_16x16, PARTITION_16x24, PARTITION_16x32, PARTITION_16x64,
+    PARTITION_24x4, PARTITION_24x8, PARTITION_24x12, PARTITION_24x16, PARTITION_24x24, PARTITION_24x32, PARTITION_24x64,
+    PARTITION_32x4, PARTITION_32x8, PARTITION_32x12, PARTITION_32x16, PARTITION_32x24, PARTITION_32x32, PARTITION_32x64,
+    PARTITION_64x4, PARTITION_64x8, PARTITION_64x12, PARTITION_64x16, PARTITION_64x24, PARTITION_64x32, PARTITION_64x64,
     NUM_PARTITIONS
 };
 
@@ -155,6 +139,8 @@ enum IPFilterConf_S_P
 // Returns a Partitions enum if the size matches a supported performance primitive,
 // else returns -1 (in which case you should use the slow path)
 int PartitionFromSizes(int Width, int Height);
+// Returns true if the given height could support an optimized primitive
+bool FastHeight(int Height);
 
 typedef int (CDECL * pixelcmp)(pixel *fenc, intptr_t fencstride, pixel *fref, intptr_t frefstride);
 typedef void (CDECL * mbdst)(short *block, short *coeff, int shift);
--- a/source/encoder/vec/pixel.inc	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/encoder/vec/pixel.inc	Fri Apr 26 10:47:57 2013 +0530
@@ -113,7 +113,6 @@ int CDECL sad_32(pixel * piOrg, intptr_t
     }
     return horizontal_add_x(extend_low(sum)) +
            horizontal_add_x(extend_high(sum));
-
 }
 
 int CDECL satd_4x4(pixel * piOrg, intptr_t iStrideOrg, pixel * piCur, intptr_t iStrideCur)
@@ -462,6 +461,70 @@ int CDECL sad_16x16(pixel * piOrg, intpt
 }
 
 template<int lx, int ly>
+int CDECL sad_32x8(pixel * piOrg, intptr_t strideOrg, pixel * piCur, intptr_t strideCur)
+{
+    int sum = 0;
+    for (int row = 0; row < ly; row += 8)
+    {
+        for (int col = 0; col < lx; col += 32)
+        {
+            sum += sad_32<32, 8>(piOrg + row * strideOrg + col, strideOrg,
+                                 piCur + row * strideCur + col, strideCur);
+        }
+    }
+    return sum;
+}
+
+template<int ly>
+int CDECL sad_12(pixel * piOrg, intptr_t strideOrg, pixel * piCur, intptr_t strideCur)
+{
+    int sum = 0;
+    for (int row = 0; row < ly; row += 4)
+    {
+        // cannot assume 8pel alignment, must use 4x4
+        sum += sad_4<4>(piOrg + row * strideOrg, strideOrg,
+                        piCur + row * strideCur, strideCur);
+        sum += sad_4<4>(piOrg + row * strideOrg + 4, strideOrg,
+                        piCur + row * strideCur + 4, strideCur);
+        sum += sad_4<4>(piOrg + row * strideOrg + 8, strideOrg,
+                        piCur + row * strideCur + 8, strideCur);
+    }
+    return sum;
+}
+
+template<int ly>
+int CDECL sad_12x8(pixel * piOrg, intptr_t strideOrg, pixel * piCur, intptr_t strideCur)
+{
+    int sum = 0;
+    for (int row = 0; row < ly; row += 8)
+    {
+        // cannot assume 8pel alignment, must use 4x8
+        sum += sad_4<8>(piOrg + row * strideOrg, strideOrg,
+                        piCur + row * strideCur, strideCur);
+        sum += sad_4<8>(piOrg + row * strideOrg + 4, strideOrg,
+                        piCur + row * strideCur + 4, strideCur);
+        sum += sad_4<8>(piOrg + row * strideOrg + 8, strideOrg,
+                        piCur + row * strideCur + 8, strideCur);
+    }
+    return sum;
+}
+
+template<int lx, int ly>
+int CDECL sad_24(pixel * piOrg, intptr_t strideOrg, pixel * piCur, intptr_t strideCur)
+{
+    int sum = 0;
+    for (int row = 0; row < ly; row += 4)
+    {
+        for (int col = 0; col < lx; col += 8)
+        {
+            sum += sad_8<4>(piOrg + row * strideOrg + col, strideOrg,
+                            piCur + row * strideCur + col, strideCur);
+        }
+    }
+    return sum;
+}
+
+template<int lx, int ly>
 int CDECL satd(pixel * piOrg, intptr_t strideOrg, pixel * piCur, intptr_t strideCur)
 {
     int uiSum = 0;
@@ -482,27 +545,49 @@ void Setup_Vec_PixelPrimitives(EncoderPr
 {
     p.sad[PARTITION_4x4] = sad_4<4>;
     p.sad[PARTITION_4x8] = sad_4<8>;
+    p.sad[PARTITION_4x12] = sad_4<12>;
+    p.sad[PARTITION_4x16] = sad_4<16>;
+    p.sad[PARTITION_4x24] = sad_4<24>;
+    p.sad[PARTITION_4x32] = sad_4<32>;
+    p.sad[PARTITION_4x64] = sad_4<64>;
+
     p.sad[PARTITION_8x4] = sad_8<4>;
     p.sad[PARTITION_8x8] = sad_8<8>;
-    p.sad[PARTITION_16x4] = sad_16<4>;
-    p.sad[PARTITION_4x16] = sad_4<16>;
-    p.sad[PARTITION_16x8] = sad_16<8>;
+    p.sad[PARTITION_8x12] = sad_8<12>;
     p.sad[PARTITION_8x16] = sad_8<16>;
-    p.sad[PARTITION_16x16] = sad_16<16>;
-    p.sad[PARTITION_4x32] = sad_4<32>;
-    p.sad[PARTITION_32x4] = sad_32<32, 4>;
+    p.sad[PARTITION_8x24] = sad_8<24>;
     p.sad[PARTITION_8x32] = sad_8x16<32>;
-    p.sad[PARTITION_32x8] = sad_32<32, 8>;
+    p.sad[PARTITION_8x64] = sad_8x16<64>;
+
+    p.sad[PARTITION_12x4] = sad_12<4>;
+    p.sad[PARTITION_12x8] = sad_12<8>;
+    p.sad[PARTITION_12x12] = sad_12<12>;
+    p.sad[PARTITION_12x16] = sad_12x8<16>;
+    p.sad[PARTITION_12x24] = sad_12x8<24>;
+    p.sad[PARTITION_12x32] = sad_12x8<32>;
+    p.sad[PARTITION_12x64] = sad_12x8<64>;
+
+    p.sad[PARTITION_16x4] = sad_16<4>;
+    p.sad[PARTITION_16x8] = sad_16<8>;
+    p.sad[PARTITION_16x12] = sad_16<12>;
+    p.sad[PARTITION_16x16] = sad_16<16>;
+    p.sad[PARTITION_16x24] = sad_16<24>;
     p.sad[PARTITION_16x32] = sad_16x16<16, 32>;
+    p.sad[PARTITION_16x64] = sad_16x16<16, 64>;
+
+    p.sad[PARTITION_32x4] = sad_32<32, 4>;
+    p.sad[PARTITION_32x8] = sad_32x8<32, 8>;
+    p.sad[PARTITION_32x12] = sad_32<32, 12>;
     p.sad[PARTITION_32x16] = sad_16x16<32, 16>;
+    p.sad[PARTITION_32x24] = sad_32x8<32, 24>;
     p.sad[PARTITION_32x32] = sad_16x16<32, 32>;
-    p.sad[PARTITION_4x64] = sad_4<64>;
+    p.sad[PARTITION_32x64] = sad_16x16<32, 64>;
+
     p.sad[PARTITION_64x4] = sad_32<64, 4>;
-    p.sad[PARTITION_64x8] = sad_32<64, 8>;
-    p.sad[PARTITION_8x64] = sad_8x16<64>;
-    p.sad[PARTITION_16x64] = sad_16x16<16, 64>;
+    p.sad[PARTITION_64x8] = sad_32x8<64, 8>;
+    p.sad[PARTITION_64x12] = sad_32<64, 12>;
     p.sad[PARTITION_64x16] = sad_16x16<64, 16>;
-    p.sad[PARTITION_32x64] = sad_16x16<32, 64>;
+    p.sad[PARTITION_64x24] = sad_32x8<64, 24>;
     p.sad[PARTITION_64x32] = sad_16x16<64, 32>;
     p.sad[PARTITION_64x64] = sad_16x16<64, 64>;
 
--- a/source/test/pixelharness.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/test/pixelharness.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -37,9 +37,13 @@ using namespace x265;
 // Initialize the Func Names for all the Pixel Comp
 static const char *FuncNames[NUM_PARTITIONS] =
 {
-    "4x4", "8x4", "4x8", "8x8", "4x16", "16x4", "8x16", "16x8", "16x16",
-    "4x32", "32x4", "8x32", "32x8", "16x32", "32x16", "32x32", "4x64",
-    "64x4", "8x64", "64x8", "16x64", "64x16", "32x64", "64x32", "64x64"
+    "  4x4", "  4x8", " 4x12", " 4x16", " 4x24", " 4x32", " 4x64",
+    "  8x4", "  8x8", " 8x12", " 8x16", " 8x24", " 8x32", " 8x64",
+    " 12x4", " 12x8", "12x12", "12x16", "12x24", "12x32", "12x64",
+    " 16x4", " 16x8", "16x12", "16x16", "16x24", "16x32", "16x64",
+    " 24x4", " 24x8", "24x12", "24x16", "24x24", "24x32", "24x64",
+    " 32x4", " 32x8", "32x12", "32x16", "32x24", "32x32", "32x64",
+    " 64x4", " 64x8", "64x12", "64x16", "64x24", "64x32", "64x64"
 };
 
 #if HIGH_BIT_DEPTH
@@ -166,14 +170,14 @@ void PixelHarness::measureSpeed(const En
 
         if (opt.sad[curpar])
         {
-            printf("sad[%s]", FuncNames[curpar]);
+            printf(" sad[%s]", FuncNames[curpar]);
             REPORT_SPEEDUP(iters,
                 opt.sad[curpar](pbuf1, STRIDE, pbuf2, STRIDE),
                 ref.sad[curpar](pbuf1, STRIDE, pbuf2, STRIDE));
         }
 
         // adaptive iteration count, reduce as partition size increases
-        if ((curpar & 7) == 7) iters >>= 1;
+        if ((curpar & 15) == 15) iters >>= 1;
     }
 
     if (opt.sa8d_8x8)
--- a/source/x265.h	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/x265.h	Fri Apr 26 10:47:57 2013 +0530
@@ -24,7 +24,9 @@
 #ifndef _X265_H_
 #define _X265_H_
 
-/* Public C interface to x265 encoder */
+#include <stdint.h>
+
+/* Public C interface to x265 encoder (incomplete) */
 
 typedef struct
 {
@@ -36,4 +38,241 @@ typedef struct
 }
 x265_picture;
 
+
+///TODO: this list needs to be pruned substantially to just the settings we want
+//       end users to have control over.
+typedef struct
+{
+    // source specification
+    int       m_iFrameRate;                       ///< source frame-rates (Hz)
+    uint32_t  m_FrameSkip;                        ///< number of skipped frames from the beginning
+    int       m_iSourceWidth;                     ///< source width in pixel
+    int       m_iSourceHeight;                    ///< source height in pixel
+    int       m_framesToBeEncoded;                ///< number of encoded frames
+
+#if 0 // These Enums must be made public and C style
+    // profile/level
+    Profile::Name m_profile;
+    Level::Tier   m_levelTier;
+    Level::Name   m_level;
+#endif
+
+    int       m_progressiveSourceFlag;
+    int       m_interlacedSourceFlag;
+    int       m_nonPackedConstraintFlag;
+    int       m_frameOnlyConstraintFlag;
+
+    // coding structure
+    int       m_iIntraPeriod;                     ///< period of I-slice (random access period)
+    int       m_iDecodingRefreshType;             ///< random access type
+    int       m_iGOPSize;                         ///< GOP size of hierarchical structure
+    int       m_extraRPSs;                        ///< extra RPSs added to handle CRA
+
+#if 0 // MAX_GOP and MAX_TLAYER must be made public, or remove these
+    GOPEntry  m_GOPList[MAX_GOP];                 ///< the coding structure entries from the config file
+    Int       m_numReorderPics[MAX_TLAYER];       ///< total number of reorder pictures
+    Int       m_maxDecPicBuffering[MAX_TLAYER];   ///< total number of pictures in the decoded picture buffer
+#endif
+
+    int       m_useTransformSkip;                 ///< flag for enabling intra transform skipping
+    int       m_useTransformSkipFast;             ///< flag for enabling fast intra transform skipping
+    int       m_enableAMP;
+
+    // coding quality
+    int       m_iQP;                              ///< QP value of key-picture (integer)
+    int       m_iMaxDeltaQP;                      ///< max. |delta QP|
+    uint32_t  m_uiDeltaQpRD;                      ///< dQP range for multi-pass slice QP optimization
+    int       m_iMaxCuDQPDepth;                   ///< Max. depth for a minimum CuDQPSize (0:default)
+
+    int       m_cbQpOffset;                       ///< Chroma Cb QP Offset (0:default)
+    int       m_crQpOffset;                       ///< Chroma Cr QP Offset (0:default)
+
+    int       m_bUseAdaptQpSelect;
+
+    int       m_bUseAdaptiveQP;                   ///< Flag for enabling QP adaptation based on a psycho-visual model
+    int       m_iQPAdaptationRange;               ///< dQP range by QP adaptation
+
+    int       m_maxTempLayer;                     ///< Max temporal layer
+
+    // coding unit (CU) definition
+    uint32_t  m_uiMaxCUWidth;                     ///< max. CU width in pixel
+    uint32_t  m_uiMaxCUHeight;                    ///< max. CU height in pixel
+    uint32_t  m_uiMaxCUDepth;                     ///< max. CU depth
+
+    // transform unit (TU) definition
+    uint32_t  m_uiQuadtreeTULog2MaxSize;
+    uint32_t  m_uiQuadtreeTULog2MinSize;
+
+    uint32_t  m_uiQuadtreeTUMaxDepthInter;
+    uint32_t  m_uiQuadtreeTUMaxDepthIntra;
+
+    // coding tools (PCM bit-depth)
+    int       m_bPCMInputBitDepthFlag;            ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
+
+    // coding tool (lossless)
+    int       m_useLossless;                      ///< flag for using lossless coding
+    int       m_bUseSAO;
+    int       m_maxNumOffsetsPerPic;              ///< SAO maximun number of offset per picture
+    int       m_saoLcuBoundary;                   ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
+    int       m_saoLcuBasedOptimization;          ///< SAO LCU-based optimization
+
+    // coding tools (loop filter)
+    int       m_bLoopFilterDisable;               ///< flag for using deblocking filter
+    int       m_loopFilterOffsetInPPS;            ///< offset for deblocking filter in 0 = slice header, 1 = PPS
+    int       m_loopFilterBetaOffsetDiv2;         ///< beta offset for deblocking filter
+    int       m_loopFilterTcOffsetDiv2;           ///< tc offset for deblocking filter
+    int       m_DeblockingFilterControlPresent;   ///< deblocking filter control present flag in PPS
+    int       m_DeblockingFilterMetric;           ///< blockiness metric in encoder
+
+    // coding tools (PCM)
+    int       m_usePCM;                           ///< flag for using IPCM
+    uint32_t  m_pcmLog2MaxSize;                   ///< log2 of maximum PCM block size
+    uint32_t  m_uiPCMLog2MinSize;                 ///< log2 of minimum PCM block size
+    int       m_bPCMFilterDisableFlag;            ///< PCM filter disable flag
+
+    // coding tools
+    int       m_bUseSBACRD;                       ///< flag for using RD optimization based on SBAC
+    int       m_bUseASR;                          ///< flag for using adaptive motion search range
+    int       m_bUseHADME;                        ///< flag for using HAD in sub-pel ME
+    int       m_useRDOQ;                          ///< flag for using RD optimized quantization
+    int       m_useRDOQTS;                        ///< flag for using RD optimized quantization for transform skip
+    int       m_rdPenalty;                        ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
+    int       m_iFastSearch;                      ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
+    int       m_iSearchRange;                     ///< ME search range
+    int       m_bipredSearchRange;                ///< ME search range for bipred refinement
+    int       m_bUseFastEnc;                      ///< flag for using fast encoder setting
+    int       m_bUseEarlyCU;                      ///< flag for using Early CU setting
+    int       m_useFastDecisionForMerge;          ///< flag for using Fast Decision Merge RD-Cost
+    int       m_bUseCbfFastMode;                  ///< flag for using Cbf Fast PU Mode Decision
+    int       m_useEarlySkipDetection;            ///< flag for using Early SKIP Detection
+
+    int       m_sliceMode;                        ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
+                                                  ///< 3: max number of tiles per slice
+    int       m_sliceArgument;                    ///< argument according to selected slice mode
+    int       m_sliceSegmentMode;                 ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
+                                                  ///< 3: max number of tiles per slice segment
+    int       m_sliceSegmentArgument;             ///< argument according to selected slice segment mode
+
+    int       m_bLFCrossSliceBoundaryFlag;        ///< 1: filter across slice boundaries 0: do not filter across slice boundaries
+    int       m_bLFCrossTileBoundaryFlag;         ///< 1: filter across tile boundaries  0: do not filter across tile boundaries
+    int       m_iUniformSpacingIdr;
+    int       m_iNumColumnsMinus1;
+    int       m_iNumRowsMinus1;
+    int       m_iWaveFrontSynchro;                ///< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
+    int       m_iWaveFrontSubstreams;             ///< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
+
+    int       m_bUseConstrainedIntraPred;         ///< flag for using constrained intra prediction
+
+    int       m_decodedPictureHashSEIEnabled;     ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
+    int       m_recoveryPointSEIEnabled;
+    int       m_bufferingPeriodSEIEnabled;
+    int       m_pictureTimingSEIEnabled;
+
+    // Tone Mapping SEI
+    int       m_toneMappingInfoSEIEnabled;
+    int       m_toneMapId;
+    int       m_toneMapCancelFlag;
+    int       m_toneMapPersistenceFlag;
+    int       m_toneMapCodedDataBitDepth;
+    int       m_toneMapTargetBitDepth;
+    int       m_toneMapModelId;
+    int       m_toneMapMinValue;
+    int       m_toneMapMaxValue;
+    int       m_sigmoidMidpoint;
+    int       m_sigmoidWidth;
+    int       m_numPivots;
+    int       m_cameraIsoSpeedIdc;
+    int       m_cameraIsoSpeedValue;
+    int       m_exposureCompensationValueSignFlag;
+    int       m_exposureCompensationValueNumerator;
+    int       m_exposureCompensationValueDenomIdc;
+    int       m_refScreenLuminanceWhite;
+    int       m_extendedRangeWhiteLevel;
+    int       m_nominalBlackLevelLumaCodeValue;
+    int       m_nominalWhiteLevelLumaCodeValue;
+    int       m_extendedWhiteLevelLumaCodeValue;
+
+    int       m_framePackingSEIEnabled;
+    int       m_framePackingSEIType;
+    int       m_framePackingSEIId;
+    int       m_framePackingSEIQuincunx;
+    int       m_framePackingSEIInterpretation;
+    int       m_displayOrientationSEIAngle;
+    int       m_temporalLevel0IndexSEIEnabled;
+    int       m_gradualDecodingRefreshInfoEnabled;
+    int       m_decodingUnitInfoSEIEnabled;
+    int       m_SOPDescriptionSEIEnabled;
+    int       m_scalableNestingSEIEnabled;
+
+    // weighted prediction
+    int       m_useWeightedPred;                  ///< Use of weighted prediction in P slices
+    int       m_useWeightedBiPred;                ///< Use of bi-directional weighted prediction in B slices
+
+    uint32_t  m_log2ParallelMergeLevel;           ///< Parallel merge estimation region
+    uint32_t  m_maxNumMergeCand;                  ///< Max number of merge candidates
+
+    int       m_TMVPModeId;
+    int       m_signHideFlag;
+    int       m_RCEnableRateControl;              ///< enable rate control or not
+    int       m_RCTargetBitrate;                  ///< target bitrate when rate control is enabled
+    int       m_RCKeepHierarchicalBit;            ///< whether keeping hierarchical bit allocation structure or not
+    int       m_RCLCULevelRC;                     ///< true: LCU level rate control; false: picture level rate control
+    int       m_RCUseLCUSeparateModel;            ///< use separate R-lambda model at LCU level
+    int       m_RCInitialQP;                      ///< inital QP for rate control
+    int       m_RCForceIntraQP;                   ///< force all intra picture to use initial QP or not
+
+    int       m_TransquantBypassEnableFlag;       ///< transquant_bypass_enable_flag setting in PPS.
+    int       m_CUTransquantBypassFlagValue;      ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag.
+
+    int       m_recalculateQPAccordingToLambda;   ///< recalculate QP value according to the lambda value
+    int       m_useStrongIntraSmoothing;          ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat
+    int       m_activeParameterSetsSEIEnabled;
+
+    int       m_vuiParametersPresentFlag;         ///< enable generation of VUI parameters
+    int       m_aspectRatioInfoPresentFlag;       ///< Signals whether aspect_ratio_idc is present
+    int       m_aspectRatioIdc;                   ///< aspect_ratio_idc
+    int       m_sarWidth;                         ///< horizontal size of the sample aspect ratio
+    int       m_sarHeight;                        ///< vertical size of the sample aspect ratio
+    int       m_overscanInfoPresentFlag;          ///< Signals whether overscan_appropriate_flag is present
+    int       m_overscanAppropriateFlag;          ///< Indicates whether conformant decoded pictures are suitable for display using overscan
+    int       m_videoSignalTypePresentFlag;       ///< Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present
+    int       m_videoFormat;                      ///< Indicates representation of pictures
+    int       m_videoFullRangeFlag;               ///< Indicates the black level and range of luma and chroma signals
+    int       m_colourDescriptionPresentFlag;     ///< Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present
+    int       m_colourPrimaries;                  ///< Indicates chromaticity coordinates of the source primaries
+    int       m_transferCharacteristics;          ///< Indicates the opto-electronic transfer characteristics of the source
+    int       m_matrixCoefficients;               ///< Describes the matrix coefficients used in deriving luma and chroma from RGB primaries
+    int       m_chromaLocInfoPresentFlag;         ///< Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present
+    int       m_chromaSampleLocTypeTopField;      ///< Specifies the location of chroma samples for top field
+    int       m_chromaSampleLocTypeBottomField;   ///< Specifies the location of chroma samples for bottom field
+    int       m_neutralChromaIndicationFlag;      ///< Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)
+    int       m_defaultDisplayWindowFlag;         ///< Indicates the presence of the default window parameters
+    int       m_defDispWinLeftOffset;             ///< Specifies the left offset from the conformance window of the default window
+    int       m_defDispWinRightOffset;            ///< Specifies the right offset from the conformance window of the default window
+    int       m_defDispWinTopOffset;              ///< Specifies the top offset from the conformance window of the default window
+    int       m_defDispWinBottomOffset;           ///< Specifies the bottom offset from the conformance window of the default window
+    int       m_frameFieldInfoPresentFlag;        ///< Indicates that pic_struct values are present in picture timing SEI messages
+    int       m_pocProportionalToTimingFlag;      ///< Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS
+    int       m_numTicksPocDiffOneMinus1;         ///< Number of ticks minus 1 that for a POC difference of one
+    int       m_bitstreamRestrictionFlag;         ///< Signals whether bitstream restriction parameters are present
+    int       m_tilesFixedStructureFlag;          ///< Indicates that each active picture parameter set has the same values of the syntax elements related to tiles
+    int       m_motionVectorsOverPicBoundariesFlag;///< Indicates that no samples outside the picture boundaries are used for inter prediction
+    int       m_minSpatialSegmentationIdc;        ///< Indicates the maximum size of the spatial segments in the pictures in the coded video sequence
+    int       m_maxBytesPerPicDenom;              ///< Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture
+    int       m_maxBitsPerMinCuDenom;             ///< Indicates an upper bound for the number of bits of coding_unit() data
+    int       m_log2MaxMvLengthHorizontal;        ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
+    int       m_log2MaxMvLengthVertical;          ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
+
+#if HIGH_BIT_DEPTH
+    // coding tools (bit-depth)
+    int       m_inputBitDepth;                    ///< bit-depth of input file (luma component)
+    int       m_outputBitDepth;                   ///< bit-depth of output file (luma component)
+    int       m_internalBitDepth;                 ///< bit-depth codec operates at in luma (input/output files will be converted)
+#endif
+}
+x265_params;
+
+// TODO: Needs methods to initialize this structure to sane defaults, apply
+// reasonable presets, and create an encoder with the given settings.
+
 #endif // _X265_H_
--- a/source/x265cfg.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/x265cfg.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -314,10 +314,10 @@ Bool TAppEncCfg::parseCfg(Int argc, Char
         ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
 
 #if L0046_CONSTRAINT_FLAGS
-        ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
-        ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
-        ("NonPackedSource",   m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
-        ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
+        ("ProgressiveSource", m_progressiveSourceFlag,   0, "Indicate that source is progressive")
+        ("InterlacedSource",  m_interlacedSourceFlag,    0, "Indicate that source is interlaced")
+        ("NonPackedSource",   m_nonPackedConstraintFlag, 0, "Indicate that source does not contain frame packing")
+        ("FrameOnly",         m_frameOnlyConstraintFlag, 0, "Indicate that the bitstream contains only frames")
 #endif
 
         // Unit definition parameters
@@ -345,8 +345,8 @@ Bool TAppEncCfg::parseCfg(Int argc, Char
         ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
         ("SearchRange,-sr",         m_iSearchRange,              96, "Motion search range")
         ("BipredSearchRange",       m_bipredSearchRange,          4, "Motion search range for bipred refinement")
-        ("HadamardME",              m_bUseHADME,               true, "Hadamard ME for fractional-pel")
-        ("ASR",                     m_bUseASR,                false, "Adaptive motion search range")
+        ("HadamardME",              m_bUseHADME,                  1, "Hadamard ME for fractional-pel")
+        ("ASR",                     m_bUseASR,                    0, "Adaptive motion search range")
 
         // Mode decision parameters
         ("LambdaModifier0,-LM0", m_adLambdaModifier[0], (Double)1.0, "Lambda modifier for temporal layer 0")
@@ -368,40 +368,40 @@ Bool TAppEncCfg::parseCfg(Int argc, Char
         ("CrQpOffset,-crqpofs",  m_crQpOffset,        0, "Chroma Cr QP Offset")
 
 #if ADAPTIVE_QP_SELECTION
-        ("AdaptiveQpSelection,-aqps",   m_bUseAdaptQpSelect,           false, "AdaptiveQpSelection")
+        ("AdaptiveQpSelection,-aqps",   m_bUseAdaptQpSelect,           0, "AdaptiveQpSelection")
 #endif
 
-        ("AdaptiveQP,-aq",                m_bUseAdaptiveQP,           false, "QP adaptation based on a psycho-visual model")
-        ("MaxQPAdaptationRange,-aqr",     m_iQPAdaptationRange,           6, "QP adaptation range")
-        ("dQPFile,m",                     cfg_dQPFile,           string(""), "dQP file name")
-        ("RDOQ",                          m_useRDOQ,                  true)
-        ("RDOQTS",                        m_useRDOQTS,                true)
+        ("AdaptiveQP,-aq",                m_bUseAdaptiveQP,           0, "QP adaptation based on a psycho-visual model")
+        ("MaxQPAdaptationRange,-aqr",     m_iQPAdaptationRange,       6, "QP adaptation range")
+        ("dQPFile,m",                     cfg_dQPFile,       string(""), "dQP file name")
+        ("RDOQ",                          m_useRDOQ,                  1)
+        ("RDOQTS",                        m_useRDOQTS,                1)
 #if L0232_RD_PENALTY
         ("RDpenalty",                     m_rdPenalty,                0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled  1:RD-penalty  2:maximum RD-penalty")
 #endif
         // Entropy coding parameters
-        ("SBACRD",                         m_bUseSBACRD,                      true, "SBAC based RD estimation")
+        ("SBACRD",                         m_bUseSBACRD,                     1, "SBAC based RD estimation")
 
         // Deblocking filter parameters
-        ("LoopFilterDisable",              m_bLoopFilterDisable,             false)
-        ("LoopFilterOffsetInPPS",          m_loopFilterOffsetInPPS,          false)
-        ("LoopFilterBetaOffset_div2",      m_loopFilterBetaOffsetDiv2,           0)
-        ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0)
-        ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false)
+        ("LoopFilterDisable",              m_bLoopFilterDisable,             0)
+        ("LoopFilterOffsetInPPS",          m_loopFilterOffsetInPPS,          0)
+        ("LoopFilterBetaOffset_div2",      m_loopFilterBetaOffsetDiv2,       0)
+        ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,         0)
+        ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, 0)
 #if L0386_DB_METRIC
-        ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false)
+        ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         0)
 #endif
 
         // Coding tools
-        ("AMP",                      m_enableAMP,                 true,  "Enable asymmetric motion partitions")
-        ("TransformSkip",            m_useTransformSkip,          false, "Intra transform skipping")
-        ("TransformSkipFast",        m_useTransformSkipFast,      false, "Fast intra transform skipping")
-        ("SAO",                      m_bUseSAO,                   true,  "Enable Sample Adaptive Offset")
-        ("MaxNumOffsetsPerPic",      m_maxNumOffsetsPerPic,       2048,  "Max number of SAO offset per picture (Default: 2048)")
-        ("SAOLcuBoundary",           m_saoLcuBoundary,            false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
-        ("SAOLcuBasedOptimization",  m_saoLcuBasedOptimization,   true,  "0: SAO picture-based optimization, 1: SAO LCU-based optimization ")
-        ("SliceMode",                m_sliceMode,                0,     "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
-        ("SliceArgument",            m_sliceArgument,            0,     "Depending on SliceMode being:"
+        ("AMP",                      m_enableAMP,                 1,  "Enable asymmetric motion partitions")
+        ("TransformSkip",            m_useTransformSkip,          0,  "Intra transform skipping")
+        ("TransformSkipFast",        m_useTransformSkipFast,      0,  "Fast intra transform skipping")
+        ("SAO",                      m_bUseSAO,                   1,  "Enable Sample Adaptive Offset")
+        ("MaxNumOffsetsPerPic",      m_maxNumOffsetsPerPic,    2048,  "Max number of SAO offset per picture (Default: 2048)")
+        ("SAOLcuBoundary",           m_saoLcuBoundary,            0,  "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
+        ("SAOLcuBasedOptimization",  m_saoLcuBasedOptimization,   1,  "0: SAO picture-based optimization, 1: SAO LCU-based optimization ")
+        ("SliceMode",                m_sliceMode,                 0,  "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
+        ("SliceArgument",            m_sliceArgument,             0,  "Depending on SliceMode being:"
         "\t1: max number of CTUs per slice"
         "\t2: max number of bytes per slice"
         "\t3: max number of tiles per slice")
@@ -410,27 +410,27 @@ Bool TAppEncCfg::parseCfg(Int argc, Char
         "\t1: max number of CTUs per slice segment"
         "\t2: max number of bytes per slice segment"
         "\t3: max number of tiles per slice segment")
-        ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true)
+        ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, 1)
 
-        ("ConstrainedIntraPred",     m_bUseConstrainedIntraPred,  false, "Constrained Intra Prediction")
+        ("ConstrainedIntraPred",     m_bUseConstrainedIntraPred,  0, "Constrained Intra Prediction")
 
-        ("PCMEnabledFlag",           m_usePCM,                    false)
+        ("PCMEnabledFlag",           m_usePCM,                    0)
         ("PCMLog2MaxSize",           m_pcmLog2MaxSize,            5u)
         ("PCMLog2MinSize",           m_uiPCMLog2MinSize,          3u)
-        ("PCMInputBitDepthFlag",     m_bPCMInputBitDepthFlag,     true)
-        ("PCMFilterDisableFlag",     m_bPCMFilterDisableFlag,     false)
+        ("PCMInputBitDepthFlag",     m_bPCMInputBitDepthFlag,     1)
+        ("PCMFilterDisableFlag",     m_bPCMFilterDisableFlag,     0)
 
-        ("LosslessCuEnabled",        m_useLossless, false)
+        ("LosslessCuEnabled",        m_useLossless,               0)
 
-        ("WeightedPredP,-wpP",          m_useWeightedPred,               false,      "Use weighted prediction in P slices")
-        ("WeightedPredB,-wpB",          m_useWeightedBiPred,             false,      "Use weighted (bidirectional) prediction in B slices")
+        ("WeightedPredP,-wpP",          m_useWeightedPred,               0,          "Use weighted prediction in P slices")
+        ("WeightedPredB,-wpB",          m_useWeightedBiPred,             0,          "Use weighted (bidirectional) prediction in B slices")
         ("Log2ParallelMergeLevel",      m_log2ParallelMergeLevel,       2u,          "Parallel merge estimation region")
         ("UniformSpacingIdc",           m_iUniformSpacingIdr,            0,          "Indicates if the column and row boundaries are distributed uniformly")
         ("NumTileColumnsMinus1",        m_iNumColumnsMinus1,             0,          "Number of columns in a picture minus 1")
         ("ColumnWidthArray",            cfg_ColumnWidth,                 string(""), "Array containing ColumnWidth values in units of LCU")
         ("NumTileRowsMinus1",           m_iNumRowsMinus1,                0,          "Number of rows in a picture minus 1")
         ("RowHeightArray",              cfg_RowHeight,                   string(""), "Array containing RowHeight values in units of LCU")
-        ("LFCrossTileBoundaryFlag",     m_bLFCrossTileBoundaryFlag,   true,          "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
+        ("LFCrossTileBoundaryFlag",     m_bLFCrossTileBoundaryFlag,      1,          "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
         ("WaveFrontSynchro",            m_iWaveFrontSynchro,             0,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
         ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
         ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
@@ -445,71 +445,71 @@ Bool TAppEncCfg::parseCfg(Int argc, Char
         "\t0: disable")
         ("SEIpictureDigest",            m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash")
         ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only")
-        ("FEN", m_bUseFastEnc, false, "fast encoder setting")
-        ("ECU", m_bUseEarlyCU, false, "Early CU setting")
-        ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
-        ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
-        ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
+        ("FEN", m_bUseFastEnc, 0, "fast encoder setting")
+        ("ECU", m_bUseEarlyCU, 0, "Early CU setting")
+        ("FDM", m_useFastDecisionForMerge, 1, "Fast decision for Merge RD Cost")
+        ("CFM", m_bUseCbfFastMode, 0, "Cbf fast mode setting")
+        ("ESD", m_useEarlySkipDetection, 0, "Early SKIP detection setting")
 #if RATE_CONTROL_LAMBDA_DOMAIN
-        ("RateControl",         m_RCEnableRateControl,   false, "Rate control: enable rate control")
+        ("RateControl",         m_RCEnableRateControl,       0, "Rate control: enable rate control")
         ("TargetBitrate",       m_RCTargetBitrate,           0, "Rate control: target bitrate")
-        ("KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm")
-        ("LCULevelRateControl", m_RCLCULevelRC,           true, "Rate control: true: LCU level RC; false: picture level RC")
-        ("RCLCUSeparateModel",  m_RCUseLCUSeparateModel,  true, "Rate control: use LCU level separate R-lambda model")
+        ("KeepHierarchicalBit", m_RCKeepHierarchicalBit,     0, "Rate control: keep hierarchical bit allocation in rate control algorithm")
+        ("LCULevelRateControl", m_RCLCULevelRC,              1, "Rate control: true: LCU level RC; false: picture level RC")
+        ("RCLCUSeparateModel",  m_RCUseLCUSeparateModel,     1, "Rate control: use LCU level separate R-lambda model")
         ("InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP")
-        ("RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP")
+        ("RCForceIntraQP",      m_RCForceIntraQP,            0, "Rate control: force intra QP to be equal to initial QP")
 #else
-        ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off")
+        ("RateCtrl,-rc", m_enableRateCtrl, 0, "Rate control on/off")
         ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate")
         ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit")
 #endif // if RATE_CONTROL_LAMBDA_DOMAIN
 
-        ("TransquantBypassEnableFlag",     m_TransquantBypassEnableFlag,         false, "transquant_bypass_enable_flag indicator in PPS")
-        ("CUTransquantBypassFlagValue",    m_CUTransquantBypassFlagValue,        false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled")
-        ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda,     false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
-        ("StrongIntraSmoothing,-sis",      m_useStrongIntraSmoothing,             true, "Enable strong intra smoothing for 32x32 blocks")
-        ("SEIActiveParameterSets",         m_activeParameterSetsSEIEnabled,          0, "Enable generation of active parameter sets SEI messages")
-        ("VuiParametersPresent,-vui",      m_vuiParametersPresentFlag,           false, "Enable generation of vui_parameters()")
-        ("AspectRatioInfoPresent",         m_aspectRatioInfoPresentFlag,         false, "Signals whether aspect_ratio_idc is present")
-        ("AspectRatioIdc",                 m_aspectRatioIdc,                         0, "aspect_ratio_idc")
-        ("SarWidth",                       m_sarWidth,                               0, "horizontal size of the sample aspect ratio")
-        ("SarHeight",                      m_sarHeight,                              0, "vertical size of the sample aspect ratio")
-        ("OverscanInfoPresent",            m_overscanInfoPresentFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
-        ("OverscanAppropriate",            m_overscanAppropriateFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
-        ("VideoSignalTypePresent",         m_videoSignalTypePresentFlag,         false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
-        ("VideoFormat",                    m_videoFormat,                            5, "Indicates representation of pictures")
-        ("VideoFullRange",                 m_videoFullRangeFlag,                 false, "Indicates the black level and range of luma and chroma signals")
-        ("ColourDescriptionPresent",       m_colourDescriptionPresentFlag,       false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
-        ("ColourPrimaries",                m_colourPrimaries,                        2, "Indicates chromaticity coordinates of the source primaries")
-        ("TransferCharateristics",         m_transferCharacteristics,                2, "Indicates the opto-electronic transfer characteristics of the source")
-        ("MatrixCoefficients",             m_matrixCoefficients,                     2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
-        ("ChromaLocInfoPresent",           m_chromaLocInfoPresentFlag,           false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
-        ("ChromaSampleLocTypeTopField",    m_chromaSampleLocTypeTopField,            0, "Specifies the location of chroma samples for top field")
-        ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField,         0, "Specifies the location of chroma samples for bottom field")
-        ("NeutralChromaIndication",        m_neutralChromaIndicationFlag,        false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
-        ("DefaultDisplayWindowFlag",       m_defaultDisplayWindowFlag,           false, "Indicates the presence of the Default Window parameters")
-        ("DefDispWinLeftOffset",           m_defDispWinLeftOffset,                   0, "Specifies the left offset of the default display window from the conformance window")
-        ("DefDispWinRightOffset",          m_defDispWinRightOffset,                  0, "Specifies the right offset of the default display window from the conformance window")
-        ("DefDispWinTopOffset",            m_defDispWinTopOffset,                    0, "Specifies the top offset of the default display window from the conformance window")
-        ("DefDispWinBottomOffset",         m_defDispWinBottomOffset,                 0, "Specifies the bottom offset of the default display window from the conformance window")
-        ("FrameFieldInfoPresentFlag",      m_frameFieldInfoPresentFlag,          false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
-        ("PocProportionalToTimingFlag",    m_pocProportionalToTimingFlag,        false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
-        ("NumTicksPocDiffOneMinus1",       m_numTicksPocDiffOneMinus1,               0, "Number of ticks minus 1 that for a POC difference of one")
-        ("BitstreamRestriction",           m_bitstreamRestrictionFlag,           false, "Signals whether bitstream restriction parameters are present")
-        ("TilesFixedStructure",            m_tilesFixedStructureFlag,            false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
-        ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
-        ("MaxBytesPerPicDenom",            m_maxBytesPerPicDenom,                    2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture")
-        ("MaxBitsPerMinCuDenom",           m_maxBitsPerMinCuDenom,                   1, "Indicates an upper bound for the number of bits of coding_unit() data")
-        ("Log2MaxMvLengthHorizontal",      m_log2MaxMvLengthHorizontal,             15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
-        ("Log2MaxMvLengthVertical",        m_log2MaxMvLengthVertical,               15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
-        ("SEIRecoveryPoint",               m_recoveryPointSEIEnabled,                0, "Control generation of recovery point SEI messages")
-        ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
-        ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
+        ("TransquantBypassEnableFlag",     m_TransquantBypassEnableFlag,         0, "transquant_bypass_enable_flag indicator in PPS")
+        ("CUTransquantBypassFlagValue",    m_CUTransquantBypassFlagValue,        0, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled")
+        ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda,     0, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
+        ("StrongIntraSmoothing,-sis",      m_useStrongIntraSmoothing,            1, "Enable strong intra smoothing for 32x32 blocks")
+        ("SEIActiveParameterSets",         m_activeParameterSetsSEIEnabled,      0, "Enable generation of active parameter sets SEI messages")
+        ("VuiParametersPresent,-vui",      m_vuiParametersPresentFlag,           0, "Enable generation of vui_parameters()")
+        ("AspectRatioInfoPresent",         m_aspectRatioInfoPresentFlag,         0, "Signals whether aspect_ratio_idc is present")
+        ("AspectRatioIdc",                 m_aspectRatioIdc,                     0, "aspect_ratio_idc")
+        ("SarWidth",                       m_sarWidth,                           0, "horizontal size of the sample aspect ratio")
+        ("SarHeight",                      m_sarHeight,                          0, "vertical size of the sample aspect ratio")
+        ("OverscanInfoPresent",            m_overscanInfoPresentFlag,            0, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
+        ("OverscanAppropriate",            m_overscanAppropriateFlag,            0, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
+        ("VideoSignalTypePresent",         m_videoSignalTypePresentFlag,         0, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
+        ("VideoFormat",                    m_videoFormat,                        5, "Indicates representation of pictures")
+        ("VideoFullRange",                 m_videoFullRangeFlag,                 0, "Indicates the black level and range of luma and chroma signals")
+        ("ColourDescriptionPresent",       m_colourDescriptionPresentFlag,       0, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
+        ("ColourPrimaries",                m_colourPrimaries,                    2, "Indicates chromaticity coordinates of the source primaries")
+        ("TransferCharateristics",         m_transferCharacteristics,            2, "Indicates the opto-electronic transfer characteristics of the source")
+        ("MatrixCoefficients",             m_matrixCoefficients,                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
+        ("ChromaLocInfoPresent",           m_chromaLocInfoPresentFlag,           0, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
+        ("ChromaSampleLocTypeTopField",    m_chromaSampleLocTypeTopField,        0, "Specifies the location of chroma samples for top field")
+        ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField,     0, "Specifies the location of chroma samples for bottom field")
+        ("NeutralChromaIndication",        m_neutralChromaIndicationFlag,        0, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
+        ("DefaultDisplayWindowFlag",       m_defaultDisplayWindowFlag,           0, "Indicates the presence of the Default Window parameters")
+        ("DefDispWinLeftOffset",           m_defDispWinLeftOffset,               0, "Specifies the left offset of the default display window from the conformance window")
+        ("DefDispWinRightOffset",          m_defDispWinRightOffset,              0, "Specifies the right offset of the default display window from the conformance window")
+        ("DefDispWinTopOffset",            m_defDispWinTopOffset,                0, "Specifies the top offset of the default display window from the conformance window")
+        ("DefDispWinBottomOffset",         m_defDispWinBottomOffset,             0, "Specifies the bottom offset of the default display window from the conformance window")
+        ("FrameFieldInfoPresentFlag",      m_frameFieldInfoPresentFlag,          0, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
+        ("PocProportionalToTimingFlag",    m_pocProportionalToTimingFlag,        0, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
+        ("NumTicksPocDiffOneMinus1",       m_numTicksPocDiffOneMinus1,           0, "Number of ticks minus 1 that for a POC difference of one")
+        ("BitstreamRestriction",           m_bitstreamRestrictionFlag,           0, "Signals whether bitstream restriction parameters are present")
+        ("TilesFixedStructure",            m_tilesFixedStructureFlag,            0, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
+        ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, 0, "Indicates that no samples outside the picture boundaries are used for inter prediction")
+        ("MaxBytesPerPicDenom",            m_maxBytesPerPicDenom,                2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture")
+        ("MaxBitsPerMinCuDenom",           m_maxBitsPerMinCuDenom,               1, "Indicates an upper bound for the number of bits of coding_unit() data")
+        ("Log2MaxMvLengthHorizontal",      m_log2MaxMvLengthHorizontal,         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
+        ("Log2MaxMvLengthVertical",        m_log2MaxMvLengthVertical,           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
+        ("SEIRecoveryPoint",               m_recoveryPointSEIEnabled,            0, "Control generation of recovery point SEI messages")
+        ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,          0, "Control generation of buffering period SEI messages")
+        ("SEIPictureTiming",               m_pictureTimingSEIEnabled,            0, "Control generation of picture timing SEI messages")
 #if J0149_TONE_MAPPING_SEI
-        ("SEIToneMappingInfo",             m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
+        ("SEIToneMappingInfo",             m_toneMappingInfoSEIEnabled,        0, "Control generation of Tone Mapping SEI messages")
         ("SEIToneMapId",                   m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
-        ("SEIToneMapCancelFlag",           m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
-        ("SEIToneMapPersistenceFlag",      m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
+        ("SEIToneMapCancelFlag",           m_toneMapCancelFlag,                0, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
+        ("SEIToneMapPersistenceFlag",      m_toneMapPersistenceFlag,           1, "Specifies the persistence of the Tone Mapping SEI message")
         ("SEIToneMapCodedDataBitDepth",    m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
         ("SEIToneMapTargetBitDepth",       m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
         ("SEIToneMapModelId",              m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
@@ -1000,8 +1000,8 @@ Void TAppEncCfg::xCheckParameter()
     xConfirmPara(m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
 
 #if ADAPTIVE_QP_SELECTION
-    xConfirmPara(m_bUseAdaptQpSelect == true && m_iQP < 0,                                "AdaptiveQpSelection must be disabled when QP < 0.");
-    xConfirmPara(m_bUseAdaptQpSelect == true && (m_cbQpOffset != 0 || m_crQpOffset != 0), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0.");
+    xConfirmPara(m_bUseAdaptQpSelect && m_iQP < 0,                                "AdaptiveQpSelection must be disabled when QP < 0.");
+    xConfirmPara(m_bUseAdaptQpSelect && (m_cbQpOffset != 0 || m_crQpOffset != 0), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0.");
 #endif
 
     if (m_usePCM)
@@ -1572,7 +1572,6 @@ Void TAppEncCfg::xSetGlobal()
 
 Void TAppEncCfg::xPrintParameter()
 {
-    printf("\n");
     printf("Bitstream      File          : %s\n", m_pchBitstreamFile);
     printf("Format                       : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate);
     printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip + m_framesToBeEncoded - 1, m_framesToBeEncoded);
--- a/source/x265cfg.h	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/x265cfg.h	Fri Apr 26 10:47:57 2013 +0530
@@ -41,6 +41,7 @@
 #include "TLibCommon/CommonDef.h"
 #include "input/input.h"
 #include "output/output.h"
+#include "x265.h"
 #include <sstream>
 
 //! \ingroup TAppEncoder
@@ -51,283 +52,47 @@
 // ====================================================================================================================
 
 /// encoder configuration class
-class TAppEncCfg
+class TAppEncCfg : public x265_params
 {
 protected:
     x265::Input*  m_input;
     x265::Output* m_recon;
 
     // file I/O
-    Char*     m_pchBitstreamFile;                             ///< output bitstream file
-    Double    m_adLambdaModifier[MAX_TLAYER];                 ///< Lambda modifier array for each temporal layer
-
-    // source specification
-    Int       m_iFrameRate;                                   ///< source frame-rates (Hz)
-    UInt      m_FrameSkip;                                    ///< number of skipped frames from the beginning
-    Int       m_iSourceWidth;                                 ///< source width in pixel
-    Int       m_iSourceHeight;                                ///< source height in pixel
-    Int       m_framesToBeEncoded;                            ///< number of encoded frames
+    Char*     m_pchBitstreamFile;               ///< output bitstream file
+    Double    m_adLambdaModifier[MAX_TLAYER];   ///< Lambda modifier array for each temporal layer
 
     // profile/level
     Profile::Name m_profile;
     Level::Tier   m_levelTier;
     Level::Name   m_level;
 
-#if L0046_CONSTRAINT_FLAGS
-    Bool m_progressiveSourceFlag;
-    Bool m_interlacedSourceFlag;
-    Bool m_nonPackedConstraintFlag;
-    Bool m_frameOnlyConstraintFlag;
-#endif
-
     // coding structure
-    Int       m_iIntraPeriod;                                 ///< period of I-slice (random access period)
-    Int       m_iDecodingRefreshType;                         ///< random access type
-    Int       m_iGOPSize;                                     ///< GOP size of hierarchical structure
-    Int       m_extraRPSs;                                    ///< extra RPSs added to handle CRA
-    GOPEntry  m_GOPList[MAX_GOP];                             ///< the coding structure entries from the config file
-    Int       m_numReorderPics[MAX_TLAYER];                   ///< total number of reorder pictures
-#if L0323_DPB
-    Int       m_maxDecPicBuffering[MAX_TLAYER];               ///< total number of pictures in the decoded picture buffer
-#else
-    Int       m_maxDecPicBuffering[MAX_TLAYER];               ///< total number of reference pictures needed for decoding
-#endif
-#if !L0034_COMBINED_LIST_CLEANUP
-    Bool      m_bUseLComb;                                    ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
-#endif
-    Bool      m_useTransformSkip;                             ///< flag for enabling intra transform skipping
-    Bool      m_useTransformSkipFast;                         ///< flag for enabling fast intra transform skipping
-    Bool      m_enableAMP;
+    GOPEntry  m_GOPList[MAX_GOP];               ///< the coding structure entries from the config file
+    Int       m_numReorderPics[MAX_TLAYER];     ///< total number of reorder pictures
+    Int       m_maxDecPicBuffering[MAX_TLAYER]; ///< total number of pictures in the decoded picture buffer
     // coding quality
-    Double    m_fQP;                                          ///< QP value of key-picture (floating point)
-    Int       m_iQP;                                          ///< QP value of key-picture (integer)
-    Char*     m_pchdQPFile;                                   ///< QP offset for each slice (initialized from external file)
-    Int*      m_aidQP;                                        ///< array of slice QP values
-    Int       m_iMaxDeltaQP;                                  ///< max. |delta QP|
-    UInt      m_uiDeltaQpRD;                                  ///< dQP range for multi-pass slice QP optimization
-    Int       m_iMaxCuDQPDepth;                               ///< Max. depth for a minimum CuDQPSize (0:default)
-
-    Int       m_cbQpOffset;                                   ///< Chroma Cb QP Offset (0:default)
-    Int       m_crQpOffset;                                   ///< Chroma Cr QP Offset (0:default)
-
-#if ADAPTIVE_QP_SELECTION
-    Bool      m_bUseAdaptQpSelect;
-#endif
-
-    Bool      m_bUseAdaptiveQP;                               ///< Flag for enabling QP adaptation based on a psycho-visual model
-    Int       m_iQPAdaptationRange;                           ///< dQP range by QP adaptation
-
-    Int       m_maxTempLayer;                                 ///< Max temporal layer
-
-    // coding unit (CU) definition
-    UInt      m_uiMaxCUWidth;                                 ///< max. CU width in pixel
-    UInt      m_uiMaxCUHeight;                                ///< max. CU height in pixel
-    UInt      m_uiMaxCUDepth;                                 ///< max. CU depth
-
-    // transfom unit (TU) definition
-    UInt      m_uiQuadtreeTULog2MaxSize;
-    UInt      m_uiQuadtreeTULog2MinSize;
-
-    UInt      m_uiQuadtreeTUMaxDepthInter;
-    UInt      m_uiQuadtreeTUMaxDepthIntra;
+    Double    m_fQP;                            ///< QP value of key-picture (floating point)
+    Char*     m_pchdQPFile;                     ///< QP offset for each slice (initialized from external file)
+    Int*      m_aidQP;                          ///< array of slice QP values
 
-#if HIGH_BIT_DEPTH
-    // coding tools (bit-depth)
-    Int       m_inputBitDepth;                               ///< bit-depth of input file (luma component)
-    Int       m_outputBitDepth;                              ///< bit-depth of output file (luma component)
-    Int       m_internalBitDepth;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
-#endif
-
-    // coding tools (PCM bit-depth)
-    Bool      m_bPCMInputBitDepthFlag;                        ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
-
-    // coding tool (lossless)
-    Bool      m_useLossless;                                  ///< flag for using lossless coding
-    Bool      m_bUseSAO;
-    Int       m_maxNumOffsetsPerPic;                          ///< SAO maximun number of offset per picture
-    Bool      m_saoLcuBoundary;                               ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
-    Bool      m_saoLcuBasedOptimization;                      ///< SAO LCU-based optimization
-    // coding tools (loop filter)
-    Bool      m_bLoopFilterDisable;                           ///< flag for using deblocking filter
-    Bool      m_loopFilterOffsetInPPS;                        ///< offset for deblocking filter in 0 = slice header, 1 = PPS
-    Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
-    Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
-    Bool      m_DeblockingFilterControlPresent;               ///< deblocking filter control present flag in PPS
-#if L0386_DB_METRIC
-    Bool      m_DeblockingFilterMetric;                       ///< blockiness metric in encoder
-#endif
-
-    // coding tools (PCM)
-    Bool      m_usePCM;                                       ///< flag for using IPCM
-    UInt      m_pcmLog2MaxSize;                               ///< log2 of maximum PCM block size
-    UInt      m_uiPCMLog2MinSize;                             ///< log2 of minimum PCM block size
-    Bool      m_bPCMFilterDisableFlag;                        ///< PCM filter disable flag
-
-    // coding tools (encoder-only parameters)
-    Bool      m_bUseSBACRD;                                   ///< flag for using RD optimization based on SBAC
-    Bool      m_bUseASR;                                      ///< flag for using adaptive motion search range
-    Bool      m_bUseHADME;                                    ///< flag for using HAD in sub-pel ME
-    Bool      m_useRDOQ;                                     ///< flag for using RD optimized quantization
-    Bool      m_useRDOQTS;                                   ///< flag for using RD optimized quantization for transform skip
-#if L0232_RD_PENALTY
-    Int      m_rdPenalty;                                    ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
-#endif
-    Int       m_iFastSearch;                                  ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
-    Int       m_iSearchRange;                                 ///< ME search range
-    Int       m_bipredSearchRange;                            ///< ME search range for bipred refinement
-    Bool      m_bUseFastEnc;                                  ///< flag for using fast encoder setting
-    Bool      m_bUseEarlyCU;                                  ///< flag for using Early CU setting
-    Bool      m_useFastDecisionForMerge;                      ///< flag for using Fast Decision Merge RD-Cost
-    Bool      m_bUseCbfFastMode;                            ///< flag for using Cbf Fast PU Mode Decision
-    Bool      m_useEarlySkipDetection;                       ///< flag for using Early SKIP Detection
-    Int       m_sliceMode;                                   ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
-                                                             ///< 3: max number of tiles per slice
-    Int       m_sliceArgument;                               ///< argument according to selected slice mode
-    Int       m_sliceSegmentMode;                            ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
-                                                             ///< 3: max number of tiles per slice segment
-    Int       m_sliceSegmentArgument;                        ///< argument according to selected slice segment mode
-
-    Bool      m_bLFCrossSliceBoundaryFlag; ///< 1: filter across slice boundaries 0: do not filter across slice boundaries
-    Bool      m_bLFCrossTileBoundaryFlag; ///< 1: filter across tile boundaries  0: do not filter across tile boundaries
-    Int       m_iUniformSpacingIdr;
-    Int       m_iNumColumnsMinus1;
     Char*     m_pchColumnWidth;
-    Int       m_iNumRowsMinus1;
     Char*     m_pchRowHeight;
     UInt*     m_pColumnWidth;
     UInt*     m_pRowHeight;
-    Int       m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
-    Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
-
-    Bool      m_bUseConstrainedIntraPred;                     ///< flag for using constrained intra prediction
 
-    Int       m_decodedPictureHashSEIEnabled;                  ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
-    Int       m_recoveryPointSEIEnabled;
-    Int       m_bufferingPeriodSEIEnabled;
-    Int       m_pictureTimingSEIEnabled;
-#if J0149_TONE_MAPPING_SEI
-    Bool      m_toneMappingInfoSEIEnabled;
-    Int       m_toneMapId;
-    Bool      m_toneMapCancelFlag;
-    Bool      m_toneMapPersistenceFlag;
-    Int       m_toneMapCodedDataBitDepth;
-    Int       m_toneMapTargetBitDepth;
-    Int       m_toneMapModelId;
-    Int       m_toneMapMinValue;
-    Int       m_toneMapMaxValue;
-    Int       m_sigmoidMidpoint;
-    Int       m_sigmoidWidth;
-    Int       m_numPivots;
-    Int       m_cameraIsoSpeedIdc;
-    Int       m_cameraIsoSpeedValue;
-    Int       m_exposureCompensationValueSignFlag;
-    Int       m_exposureCompensationValueNumerator;
-    Int       m_exposureCompensationValueDenomIdc;
-    Int       m_refScreenLuminanceWhite;
-    Int       m_extendedRangeWhiteLevel;
-    Int       m_nominalBlackLevelLumaCodeValue;
-    Int       m_nominalWhiteLevelLumaCodeValue;
-    Int       m_extendedWhiteLevelLumaCodeValue;
     Int*      m_startOfCodedInterval;
     Int*      m_codedPivotValue;
     Int*      m_targetPivotValue;
-#endif // if J0149_TONE_MAPPING_SEI
-    Int       m_framePackingSEIEnabled;
-    Int       m_framePackingSEIType;
-    Int       m_framePackingSEIId;
-    Int       m_framePackingSEIQuincunx;
-    Int       m_framePackingSEIInterpretation;
-    Int       m_displayOrientationSEIAngle;
-    Int       m_temporalLevel0IndexSEIEnabled;
-    Int       m_gradualDecodingRefreshInfoEnabled;
-    Int       m_decodingUnitInfoSEIEnabled;
-#if L0208_SOP_DESCRIPTION_SEI
-    Int       m_SOPDescriptionSEIEnabled;
-#endif
-#if K0180_SCALABLE_NESTING_SEI
-    Int       m_scalableNestingSEIEnabled;
-#endif
-    // weighted prediction
-    Bool      m_useWeightedPred;                  ///< Use of weighted prediction in P slices
-    Bool      m_useWeightedBiPred;                ///< Use of bi-directional weighted prediction in B slices
-
-    UInt      m_log2ParallelMergeLevel;                       ///< Parallel merge estimation region
-    UInt      m_maxNumMergeCand;                              ///< Max number of merge candidates
-
-    Int       m_TMVPModeId;
-    Int       m_signHideFlag;
-#if RATE_CONTROL_LAMBDA_DOMAIN
-    Bool      m_RCEnableRateControl;              ///< enable rate control or not
-    Int       m_RCTargetBitrate;                  ///< target bitrate when rate control is enabled
-    Bool      m_RCKeepHierarchicalBit;            ///< whether keeping hierarchical bit allocation structure or not
-    Bool      m_RCLCULevelRC;                     ///< true: LCU level rate control; false: picture level rate control
-    Bool      m_RCUseLCUSeparateModel;            ///< use separate R-lambda model at LCU level
-    Int       m_RCInitialQP;                      ///< inital QP for rate control
-    Bool      m_RCForceIntraQP;                   ///< force all intra picture to use initial QP or not
-#else
-    Bool      m_enableRateCtrl;                                 ///< Flag for using rate control algorithm
-    Int       m_targetBitrate;                               ///< target bitrate
-    Int       m_numLCUInUnit;                                ///< Total number of LCUs in a frame should be completely divided by the NumLCUInUnit
-#endif // if RATE_CONTROL_LAMBDA_DOMAIN
-    Int       m_useScalingListId;                             ///< using quantization matrix
-    Char*     m_scalingListFile;                              ///< quantization matrix file name
 
-    Bool      m_TransquantBypassEnableFlag;                   ///< transquant_bypass_enable_flag setting in PPS.
-    Bool      m_CUTransquantBypassFlagValue;                  ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag.
-
-    Bool      m_recalculateQPAccordingToLambda;               ///< recalculate QP value according to the lambda value
-    Bool      m_useStrongIntraSmoothing;                      ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat
-    Int       m_activeParameterSetsSEIEnabled;
-
-    Bool      m_vuiParametersPresentFlag;                     ///< enable generation of VUI parameters
-    Bool      m_aspectRatioInfoPresentFlag;                   ///< Signals whether aspect_ratio_idc is present
-    Int       m_aspectRatioIdc;                               ///< aspect_ratio_idc
-    Int       m_sarWidth;                                     ///< horizontal size of the sample aspect ratio
-    Int       m_sarHeight;                                    ///< vertical size of the sample aspect ratio
-    Bool      m_overscanInfoPresentFlag;                      ///< Signals whether overscan_appropriate_flag is present
-    Bool      m_overscanAppropriateFlag;                      ///< Indicates whether conformant decoded pictures are suitable for display using overscan
-    Bool      m_videoSignalTypePresentFlag;                   ///< Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present
-    Int       m_videoFormat;                                  ///< Indicates representation of pictures
-    Bool      m_videoFullRangeFlag;                           ///< Indicates the black level and range of luma and chroma signals
-    Bool      m_colourDescriptionPresentFlag;                 ///< Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present
-    Int       m_colourPrimaries;                              ///< Indicates chromaticity coordinates of the source primaries
-    Int       m_transferCharacteristics;                      ///< Indicates the opto-electronic transfer characteristics of the source
-    Int       m_matrixCoefficients;                           ///< Describes the matrix coefficients used in deriving luma and chroma from RGB primaries
-    Bool      m_chromaLocInfoPresentFlag;                     ///< Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present
-    Int       m_chromaSampleLocTypeTopField;                  ///< Specifies the location of chroma samples for top field
-    Int       m_chromaSampleLocTypeBottomField;               ///< Specifies the location of chroma samples for bottom field
-    Bool      m_neutralChromaIndicationFlag;                  ///< Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)
-    Bool      m_defaultDisplayWindowFlag;                     ///< Indicates the presence of the default window parameters
-    Int       m_defDispWinLeftOffset;                         ///< Specifies the left offset from the conformance window of the default window
-    Int       m_defDispWinRightOffset;                        ///< Specifies the right offset from the conformance window of the default window
-    Int       m_defDispWinTopOffset;                          ///< Specifies the top offset from the conformance window of the default window
-    Int       m_defDispWinBottomOffset;                       ///< Specifies the bottom offset from the conformance window of the default window
-    Bool      m_frameFieldInfoPresentFlag;                    ///< Indicates that pic_struct values are present in picture timing SEI messages
-    Bool      m_pocProportionalToTimingFlag;                  ///< Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS
-    Int       m_numTicksPocDiffOneMinus1;                     ///< Number of ticks minus 1 that for a POC difference of one
-    Bool      m_bitstreamRestrictionFlag;                     ///< Signals whether bitstream restriction parameters are present
-    Bool      m_tilesFixedStructureFlag;                      ///< Indicates that each active picture parameter set has the same values of the syntax elements related to tiles
-    Bool      m_motionVectorsOverPicBoundariesFlag;           ///< Indicates that no samples outside the picture boundaries are used for inter prediction
-    Int       m_minSpatialSegmentationIdc;                    ///< Indicates the maximum size of the spatial segments in the pictures in the coded video sequence
-    Int       m_maxBytesPerPicDenom;                          ///< Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture
-    Int       m_maxBitsPerMinCuDenom;                         ///< Indicates an upper bound for the number of bits of coding_unit() data
-    Int       m_log2MaxMvLengthHorizontal;                    ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
-    Int       m_log2MaxMvLengthVertical;                      ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
+    Int       m_useScalingListId;
+    Char*     m_scalingListFile;                ///< quantization matrix file name
 
     // internal member functions
-    Void      xSetGlobal();                                   ///< set global variables
-    Void      xCheckParameter();                              ///< check validity of configuration values
-    Void      xPrintParameter();                              ///< print configuration values
-    Void      xPrintUsage();                                  ///< print usage
-#if SIGNAL_BITRATE_PICRATE_IN_VPS
-    Int       m_bitRatePicRateMaxTLayers;                     ///< Indicates max. number of sub-layers for which bit rate is signalled.
-    Bool*     m_bitRateInfoPresentFlag;                       ///< Indicates whether bit rate information is signalled
-    Bool*     m_picRateInfoPresentFlag;                       ///< Indicates whether pic rate information is signalled
-    Int*      m_avgBitRate;                                   ///< Indicates avg. bit rate information for various sub-layers
-    Int*      m_maxBitRate;                                   ///< Indicates max. bit rate information for various sub-layers
-    Int*      m_avgPicRate;                                   ///< Indicates avg. picture rate information for various sub-layers
-    Int*      m_constantPicRateIdc;                           ///< Indicates constant picture rate idc for various sub-layers
-#endif
+    Void      xSetGlobal();                     ///< set global variables
+    Void      xCheckParameter();                ///< check validity of configuration values
+    Void      xPrintParameter();                ///< print configuration values
+    Void      xPrintUsage();                    ///< print usage
 
 public:
 
@@ -336,9 +101,9 @@ public:
 
 public:
 
-    Void  create();                                       ///< create option handling class
-    Void  destroy();                                      ///< destroy option handling class
-    Bool  parseCfg(Int argc, Char* argv[]);               ///< parse configuration file to fill member variables
+    Void  create();                             ///< create option handling class
+    Void  destroy();                            ///< destroy option handling class
+    Bool  parseCfg(Int argc, Char* argv[]);     ///< parse configuration file to fill member variables
 }; // END CLASS DEFINITION TAppEncCfg
 
 //! \}
--- a/source/x265enc.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/x265enc.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -155,9 +155,9 @@ Void TAppEncTop::xInitLibCfg()
     Int lowestQP;
     lowestQP =  -6 * (g_bitDepthY - 8); // XXX: check
 
-    if ((m_iMaxDeltaQP == 0) && (m_iQP == lowestQP) && (m_useLossless == true))
+    if ((m_iMaxDeltaQP == 0) && (m_iQP == lowestQP) && m_useLossless)
     {
-        m_bUseAdaptiveQP = false;
+        m_bUseAdaptiveQP = 0;
     }
 
     m_cTEncTop.setUseAdaptiveQP(m_bUseAdaptiveQP);
--- a/source/x265main.cpp	Thu Apr 25 17:54:12 2013 +0530
+++ b/source/x265main.cpp	Fri Apr 26 10:47:57 2013 +0530
@@ -37,15 +37,15 @@ int main(int argc, char *argv[])
 
     PPA_INIT();
 
-    fprintf(stdout, "x265 HEVC encoder version %s\n", XSTR(X265_VERSION));
+    fprintf(stdout, "x265: HEVC encoder version %s\n", XSTR(X265_VERSION));
     fprintf(stdout, "x265: build info ");
     fprintf(stdout, NVM_ONOS);
     fprintf(stdout, NVM_COMPILEDBY);
     fprintf(stdout, NVM_BITS);
 #if HIGH_BIT_DEPTH
-    fprintf(stdout, " 16bpp");
+    fprintf(stdout, "16bpp");
 #else
-    fprintf(stdout, " 8bpp");
+    fprintf(stdout, "8bpp");
 #endif
     fprintf(stdout, "\n");