[x265] [PATCH] rc: adapt qpfile feature from x264

2014-03-06 Thread sagar
# HG changeset patch
# User Sagar Kotecha sa...@multicorewareinc.com
# Date 1394092937 -19800
#  Thu Mar 06 13:32:17 2014 +0530
# Node ID 7d5f475351e2ed728e5c814a0edd61e5d91a2a28
# Parent  ba92d06951162b20af133384f87234f7c6fd67ea
rc: adapt qpfile feature from x264

the qpfile will provide the slice type and base QP for each frame, overriding
lookahead and rate control.

diff -r ba92d0695116 -r 7d5f475351e2 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Wed Mar 05 21:32:47 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.cpp Thu Mar 06 13:32:17 2014 +0530
@@ -81,6 +81,7 @@
 m_avgQpRc = 0;
 m_avgQpAq = 0;
 m_bChromaPlanesExtended = false;
+m_qpforce = X265_QP_AUTO;
 }
 
 TComPic::~TComPic()
diff -r ba92d0695116 -r 7d5f475351e2 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h   Wed Mar 05 21:32:47 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.h   Thu Mar 06 13:32:17 2014 +0530
@@ -114,6 +114,7 @@
 double*   m_qpaRc;
 doublem_avgQpRc; //avg QP as decided by ratecontrol
 doublem_avgQpAq; //avg QP as decided by AQ in addition to 
ratecontrol
+int   m_qpforce; // Force to use the qp specified in qp 
file
 
 TComPic();
 virtual ~TComPic();
diff -r ba92d0695116 -r 7d5f475351e2 source/common/common.cpp
--- a/source/common/common.cpp  Wed Mar 05 21:32:47 2014 -0600
+++ b/source/common/common.cpp  Thu Mar 06 13:32:17 2014 +0530
@@ -147,3 +147,36 @@
 
 return -10.0 * log10(inv_ssim);
 }
+
+int parseQPFile(FILE *qpfile, int qpForce, int frameNum, int sliceType)
+{
+int num = -1, qp, ret;
+char type;
+uint32_t filePos;
+while (num  frameNum)
+{
+filePos = ftell(qpfile);
+qp = -1;
+ret = fscanf(qpfile, %d %c%*[ \t]%d\n, num, type, qp);
+
+qpForce = X265_QP_AUTO;
+if (num  frameNum || ret == EOF)
+{
+fseek(qpfile, filePos, SEEK_SET);
+break;
+}
+if (num  frameNum  ret = 2)
+continue;
+if (ret == 3  qp = 0)
+qpForce = qp + 1;
+if (type == 'I') sliceType = X265_TYPE_IDR;
+else if (type == 'i') sliceType = X265_TYPE_I;
+else if (type == 'P') sliceType = X265_TYPE_P;
+else if (type == 'B') sliceType = X265_TYPE_BREF;
+else if (type == 'b') sliceType = X265_TYPE_B;
+else ret = 0;
+if (ret  2 || qp  -1 || qp  MAX_QP)
+return 0;
+}
+return 1;
+}
diff -r ba92d0695116 -r 7d5f475351e2 source/common/common.h
--- a/source/common/common.hWed Mar 05 21:32:47 2014 -0600
+++ b/source/common/common.hThu Mar 06 13:32:17 2014 +0530
@@ -24,6 +24,7 @@
 #ifndef X265_COMMON_H
 #define X265_COMMON_H
 
+#include cstdio
 #include cstdlib
 #include cstring
 #include x265.h
@@ -116,4 +117,6 @@
 
 double x265_ssim2dB(double ssim);
 
+int parseQPFile(FILE *qpfile, int qpForce, int frameNum, int sliceType);
+
 #endif // ifndef X265_COMMON_H
diff -r ba92d0695116 -r 7d5f475351e2 source/common/param.cpp
--- a/source/common/param.cpp   Wed Mar 05 21:32:47 2014 -0600
+++ b/source/common/param.cpp   Thu Mar 06 13:32:17 2014 +0530
@@ -748,6 +748,7 @@
 p-vui.bEnableNalHrdParametersPresentFlag = 1;
 p-vui.bEnableSubPicHrdParamsPresentFlag = atobool(value);
 }
+OPT(qpfile) p-qpfilen = value;
 else
 return X265_PARAM_BAD_NAME;
 #undef OPT
diff -r ba92d0695116 -r 7d5f475351e2 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cppWed Mar 05 21:32:47 2014 -0600
+++ b/source/encoder/encoder.cppThu Mar 06 13:32:17 2014 +0530
@@ -73,6 +73,7 @@
 m_packetData = NULL;
 m_outputCount = 0;
 m_csvfpt = NULL;
+m_qpfile = NULL;
 
 #if ENC_DEC_TRACE
 g_hTrace = fopen(TraceEnc.txt, wb);
@@ -133,6 +134,15 @@
 }
 }
 }
+if (param-qpfilen)
+{
+m_qpfile = fopen(param-qpfilen, rb);
+if (!m_qpfile)
+{
+x265_log(param, X265_LOG_ERROR, %s qpfile not found\n, 
param-qpfilen);
+m_aborted = true;
+}
+}
 }
 
 void Encoder::destroy()
@@ -173,6 +183,8 @@
 X265_FREE(m_packetData);
 if (m_csvfpt)
 fclose(m_csvfpt);
+if (m_qpfile)
+fclose(m_qpfile);
 }
 
 void Encoder::init()
@@ -333,7 +345,19 @@
 ATOMIC_INC(pic-m_countRefEncoders);
 if (param-rc.aqMode || param-bEnableWeightedPred)
 m_rateControl-calcAdaptiveQuantFrame(pic);
-m_lookahead-addPicture(pic, pic_in-sliceType);
+int sliceType = pic_in-sliceType;
+int qpForce = 0;
+if (m_qpfile)
+{
+if (!parseQPFile(m_qpfile, qpForce, pic_in-poc, sliceType))
+{
+x265_log(NULL, X265_LOG_ERROR, can't parse qpfile for frame 
%d\n, pic_in-poc);
+fclose(m_qpfile);
+m_qpfile = NULL;
+}
+pic-m_qpforce = qpForce;
+}
+  

[x265] share m_mvpIdx[0] as m_mergeIdx

2014-03-06 Thread Satoshi Nakagawa
# HG changeset patch
# User Satoshi Nakagawa nakagawa...@oki.com
# Date 1394094546 -32400
#  Thu Mar 06 17:29:06 2014 +0900
# Node ID 2b16b4f07ad924accc6ef070696ddc8d931ef285
# Parent  889edfd2c4c33df368481bb161076da1dcdd8295
share m_mvpIdx[0] as m_mergeIdx

diff -r 889edfd2c4c3 -r 2b16b4f07ad9 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp  Thu Mar 06 00:00:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp  Thu Mar 06 17:29:06 2014 +0900
@@ -71,7 +71,6 @@
 m_height = NULL;
 m_qp = NULL;
 m_bMergeFlags = NULL;
-m_mergeIndex = NULL;
 m_lumaIntraDir = NULL;
 m_chromaIntraDir = NULL;
 m_interDir = NULL;
@@ -135,7 +134,6 @@
 CHECKED_MALLOC(m_cuTransquantBypass, bool, numPartition);
 
 CHECKED_MALLOC(m_bMergeFlags, bool,  numPartition);
-CHECKED_MALLOC(m_mergeIndex, UChar, numPartition);
 CHECKED_MALLOC(m_lumaIntraDir, UChar, numPartition);
 CHECKED_MALLOC(m_chromaIntraDir, UChar, numPartition);
 CHECKED_MALLOC(m_interDir, UChar, numPartition);
@@ -149,8 +147,8 @@
 CHECKED_MALLOC(m_cbf[1], UChar, numPartition);
 CHECKED_MALLOC(m_cbf[2], UChar, numPartition);
 
-CHECKED_MALLOC(m_mvpIdx[0], char, numPartition);
-CHECKED_MALLOC(m_mvpIdx[1], char, numPartition);
+CHECKED_MALLOC(m_mvpIdx[0], uint8_t, numPartition * 2);
+m_mvpIdx[1] = m_mvpIdx[0] + numPartition;
 
 CHECKED_MALLOC(m_trCoeffY, TCoeff, width * height);
 CHECKED_MALLOC(m_trCoeffCb, TCoeff, (width  m_hChromaShift) * (height  
m_vChromaShift));
@@ -181,7 +179,6 @@
 X265_FREE(m_cbf[2]);
 X265_FREE(m_interDir);
 X265_FREE(m_bMergeFlags);
-X265_FREE(m_mergeIndex);
 X265_FREE(m_lumaIntraDir);
 X265_FREE(m_chromaIntraDir);
 X265_FREE(m_trIdx);
@@ -196,7 +193,6 @@
 X265_FREE(m_iPCMSampleCb);
 X265_FREE(m_iPCMSampleCr);
 X265_FREE(m_mvpIdx[0]);
-X265_FREE(m_mvpIdx[1]);
 X265_FREE(m_cuTransquantBypass);
 X265_FREE(m_skipFlag);
 X265_FREE(m_partSizes);
@@ -260,7 +256,6 @@
 memset(m_height, g_maxCUHeight, numElements * 
sizeof(*m_height));
 memset(m_qp, qp,numElements * 
sizeof(*m_qp));
 memset(m_bMergeFlags,false, numElements * 
sizeof(*m_bMergeFlags));
-memset(m_mergeIndex, 0, numElements * 
sizeof(*m_mergeIndex));
 memset(m_lumaIntraDir,   DC_IDX,numElements * 
sizeof(*m_lumaIntraDir));
 memset(m_chromaIntraDir, 0, numElements * 
sizeof(*m_chromaIntraDir));
 memset(m_interDir,   0, numElements * 
sizeof(*m_interDir));
@@ -506,7 +501,6 @@
 memcpy(m_predModes + offset, cu-getPredictionMode(), sizeof(*m_predModes) 
* numPartition);
 memcpy(m_cuTransquantBypass + offset, cu-getCUTransquantBypass(), 
sizeof(*m_cuTransquantBypass) * numPartition);
 memcpy(m_bMergeFlags  + offset, cu-getMergeFlag(), 
iSizeInBool);
-memcpy(m_mergeIndex   + offset, cu-getMergeIndex(),
iSizeInUchar);
 memcpy(m_lumaIntraDir + offset, cu-getLumaIntraDir(),  
iSizeInUchar);
 memcpy(m_chromaIntraDir   + offset, cu-getChromaIntraDir(),
iSizeInUchar);
 memcpy(m_interDir + offset, cu-getInterDir(),  
iSizeInUchar);
@@ -575,7 +569,6 @@
 memcpy(rpcCU-getPredictionMode() + m_absIdxInLCU, m_predModes, 
sizeof(*m_predModes) * m_numPartitions);
 memcpy(rpcCU-getCUTransquantBypass() + m_absIdxInLCU, 
m_cuTransquantBypass, sizeof(*m_cuTransquantBypass) * m_numPartitions);
 memcpy(rpcCU-getMergeFlag() + m_absIdxInLCU, m_bMergeFlags,   
  iSizeInBool);
-memcpy(rpcCU-getMergeIndex()+ m_absIdxInLCU, m_mergeIndex,   
iSizeInUchar);
 memcpy(rpcCU-getLumaIntraDir()  + m_absIdxInLCU, m_lumaIntraDir, 
iSizeInUchar);
 memcpy(rpcCU-getChromaIntraDir()+ m_absIdxInLCU, m_chromaIntraDir,   
iSizeInUchar);
 memcpy(rpcCU-getInterDir()  + m_absIdxInLCU, m_interDir, 
iSizeInUchar);
@@ -663,7 +656,6 @@
 memcpy(cu-getPredictionMode() + partOffset, m_predModes, 
sizeof(*m_predModes) * qNumPart);
 memcpy(cu-getCUTransquantBypass() + partOffset, m_cuTransquantBypass, 
sizeof(*m_cuTransquantBypass) * qNumPart);
 memcpy(cu-getMergeFlag() + partOffset, m_bMergeFlags,  
sizeInBool);
-memcpy(cu-getMergeIndex()+ partOffset, m_mergeIndex,   
sizeInUchar);
 memcpy(cu-getLumaIntraDir()  + partOffset, m_lumaIntraDir, 
sizeInUchar);
 memcpy(cu-getChromaIntraDir()+ partOffset, m_chromaIntraDir,   
sizeInUchar);
 memcpy(cu-getInterDir()  + partOffset, m_interDir, 
sizeInUchar);
diff -r 889edfd2c4c3 -r 2b16b4f07ad9 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.hThu Mar 06 00:00:42 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.hThu Mar 06 17:29:06 2014 +0900
@@ -144,11 +144,10 @@
 // 

[x265] [PATCH] cleanup the labels in assembly code with trailing colon

2014-03-06 Thread yuvaraj
# HG changeset patch
# User Yuvaraj Venkatesh yuva...@multicorewareinc.com
# Date 1394102558 -19800
#  Thu Mar 06 16:12:38 2014 +0530
# Node ID 317a94a3995b0312b00051f39b6d58dc738f9697
# Parent  889edfd2c4c33df368481bb161076da1dcdd8295
cleanup the labels in assembly code with trailing colon

diff -r 889edfd2c4c3 -r 317a94a3995b source/common/x86/intrapred16.asm
--- a/source/common/x86/intrapred16.asm Thu Mar 06 00:00:42 2014 -0600
+++ b/source/common/x86/intrapred16.asm Thu Mar 06 16:12:38 2014 +0530
@@ -218,7 +218,7 @@
 pextrw  [r6 + r1], m0, 5
 pextrw  [r6 + r1 * 2], m0, 6
 
-.end
+.end:
 RET
 
 
@@ -355,7 +355,7 @@
 lea r6,  [r6 + r1 * 2]
 pextrw  [r6],m3, 6
 
-.end
+.end:
 RET
 
 
@@ -1226,7 +1226,7 @@
 cmp r4m, byte 23
 jnz.load
 xchgr2, r3
-.load
+.load:
 movum5, [r2 - 2]; [x x 4 3 2 1 0 x]
 palignr m2, m5, 2   ; [x x x 4 3 2 1 0]
 palignr m0, m5, 4   ; [x x x x 4 3 2 1]
@@ -1247,7 +1247,7 @@
 cmp r4m, byte 22
 jnz.load
 xchgr2, r3
-.load
+.load:
 movum5, [r2 - 2]; [x x 4 3 2 1 0 x]
 palignr m2, m5, 2   ; [x x x 4 3 2 1 0]
 palignr m0, m5, 4   ; [x x x x 4 3 2 1]
@@ -1269,7 +1269,7 @@
 cmp r4m, byte 21
 jnz.load
 xchgr2, r3
-.load
+.load:
 movum3, [r2 - 2]; [x x 4 3 2 1 0 x]
 palignr m2, m3, 2   ; [x x x 4 3 2 1 0]
 palignr m0, m3, 4   ; [x x x x 4 3 2 1]
@@ -1293,7 +1293,7 @@
 cmp r4m, byte 20
 jnz.load
 xchgr2, r3
-.load
+.load:
 movum3, [r2 - 2]; [x x 4 3 2 1 0 x]
 palignr m2, m3, 2   ; [x x x 4 3 2 1 0]
 palignr m0, m3, 4   ; [x x x x 4 3 2 1]
@@ -1316,7 +1316,7 @@
 cmp r4m, byte 19
 jnz.load
 xchgr2, r3
-.load
+.load:
 movum6, [r2 - 2]; [- - 4 3 2 1 0 x]
 palignr m2, m6, 2   ; [- - - 4 3 2 1 0]
 palignr m1, m6, 4   ; [- - - - 4 3 2 1]
diff -r 889edfd2c4c3 -r 317a94a3995b source/common/x86/intrapred8.asm
--- a/source/common/x86/intrapred8.asm  Thu Mar 06 00:00:42 2014 -0600
+++ b/source/common/x86/intrapred8.asm  Thu Mar 06 16:12:38 2014 +0530
@@ -214,7 +214,7 @@
 lea r1,[r1 * 3]
 pextrb  [r6 + r1], m2, 5
 
-.end
+.end:
 RET
 
 
;---
@@ -329,7 +329,7 @@
 pextrb  [r6 + r1], m3, 5
 pextrb  [r6 + r1 * 2], m3, 6
 
-.end
+.end:
 RET
 
 
;---
@@ -704,7 +704,7 @@
 %endmacro
 
 mov r3, 32
-.loop
+.loop:
 COMP_PRED_PLANAR_ROW 0
 COMP_PRED_PLANAR_ROW 16
 inc r2
@@ -992,7 +992,7 @@
 cmp r4m, byte 23
 jnz.load
 xchgr2, r3
-.load
+.load:
 movhm1, [r2 - 1]; [x x 4 3 2 1 0 x]
 palignr m0, m1, 1   ; [x x x 4 3 2 1 0]
 palignr m2, m1, 2   ; [x x x x 4 3 2 1]
@@ -1014,7 +1014,7 @@
 cmp r4m, byte 22
 jnz.load
 xchgr2, r3
-.load
+.load:
 movhm2, [r2 - 1]; [x x 4 3 2 1 0 x]
 palignr m0, m2, 1   ; [x x x 4 3 2 1 0]
 palignr m1, m2, 2   ; [x x x x 4 3 2 1]
@@ -1036,7 +1036,7 @@
 cmp r4m, byte 21
 jnz.load
 xchgr2, r3
-.load
+.load:
 movhm2, [r2 - 1]; [x x 4 3 2 1 0 x]
 palignr m0, m2, 1   ; [x x x 4 3 2 1 0]
 palignr m1, m2, 2   ; [x x x x 4 3 2 1]
@@ -1061,7 +1061,7 @@
 cmp r4m, byte 20
 jnz.load
 xchgr2, r3
-.load
+.load:
 movhm2, [r2 - 1]; [x x 4 3 2 1 0 x]
 palignr m0, m2, 1   ; [x x x 4 3 2 1 0]
 palignr m1, m2, 2   ; [x x x x 4 3 2 1]
@@ -1086,7 +1086,7 @@
 cmp r4m, byte 19
 jnz.load
 xchgr2, r3
-.load
+.load:
 movhm3, [r2 - 1]; [- - 4 3 2 1 0 x]
 palignr m0, m3, 1   ; [- - - 4 3 2 1 0]
 palignr m1, m3, 2   ; [- - - - 4 3 2 1]
diff -r 889edfd2c4c3 -r 317a94a3995b source/common/x86/ipfilter16.asm
--- a/source/common/x86/ipfilter16.asm  Thu Mar 06 00:00:42 2014 -0600
+++ b/source/common/x86/ipfilter16.asm  Thu Mar 06 16:12:38 2014 +0530
@@ -135,7 +135,7 @@
 add r4d, 7
 %endif
 
-.loopH
+.loopH:
 movum2, [r0] ; m2 = src[0-7]
 movum3, [r0 + 16]; m3 = src[8-15]
 
@@ -221,7 +221,7 @@
 add r4d, 7
 %endif
 
-.loopH
+.loopH:
 movum2, [r0] ; m2 = src[0-7]
 movum3, [r0 + 16]; m3 = src[8-15]
 
@@ -322,7 +322,7 @@
 add r4d, 7
 %endif
 

[x265] [PATCH] C primitive for blockcopy_ss

2014-03-06 Thread murugan
# HG changeset patch
# User Murugan Vairavel muru...@multicorewareinc.com
# Date 1394103789 -19800
#  Thu Mar 06 16:33:09 2014 +0530
# Node ID f2fe08b5472fb3b1b47beac2e04e68c783d98836
# Parent  ba92d06951162b20af133384f87234f7c6fd67ea
C primitive for blockcopy_ss

diff -r ba92d0695116 -r f2fe08b5472f source/common/pixel.cpp
--- a/source/common/pixel.cpp   Wed Mar 05 21:32:47 2014 -0600
+++ b/source/common/pixel.cpp   Thu Mar 06 16:33:09 2014 +0530
@@ -741,6 +741,21 @@
 }
 
 templateint bx, int by
+void blockcopy_ss_c(int16_t *a, intptr_t stridea, int16_t *b, intptr_t strideb)
+{
+for (int y = 0; y  by; y++)
+{
+for (int x = 0; x  bx; x++)
+{
+a[x] = b[x];
+}
+
+a += stridea;
+b += strideb;
+}
+}
+
+templateint bx, int by
 void blockcopy_sp_c(pixel *a, intptr_t stridea, int16_t *b, intptr_t strideb)
 {
 for (int y = 0; y  by; y++)
@@ -892,6 +907,7 @@
 p.chroma[X265_CSP_I420].copy_pp[CHROMA_ ## W ## x ## H] = 
blockcopy_pp_cW, H; \
 p.chroma[X265_CSP_I420].copy_sp[CHROMA_ ## W ## x ## H] = 
blockcopy_sp_cW, H; \
 p.chroma[X265_CSP_I420].copy_ps[CHROMA_ ## W ## x ## H] = 
blockcopy_ps_cW, H; \
+p.chroma[X265_CSP_I420].copy_ss[CHROMA_ ## W ## x ## H] = 
blockcopy_ss_cW, H; \
 p.chroma[X265_CSP_I420].sub_ps[CHROMA_ ## W ## x ## H] = pixel_sub_ps_cW, 
H; \
 p.chroma[X265_CSP_I420].add_ps[CHROMA_ ## W ## x ## H] = pixel_add_ps_cW, 
H;
 
@@ -900,6 +916,7 @@
 p.chroma[X265_CSP_I444].copy_pp[LUMA_ ## W ## x ## H] = blockcopy_pp_cW, 
H; \
 p.chroma[X265_CSP_I444].copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_cW, 
H; \
 p.chroma[X265_CSP_I444].copy_ps[LUMA_ ## W ## x ## H] = blockcopy_ps_cW, 
H; \
+p.chroma[X265_CSP_I444].copy_ss[LUMA_ ## W ## x ## H] = blockcopy_ss_cW, 
H; \
 p.chroma[X265_CSP_I444].sub_ps[LUMA_ ## W ## x ## H] = pixel_sub_ps_cW, 
H; \
 p.chroma[X265_CSP_I444].add_ps[LUMA_ ## W ## x ## H] = pixel_add_ps_cW, 
H;
 
@@ -908,6 +925,7 @@
 p.luma_copy_pp[LUMA_ ## W ## x ## H] = blockcopy_pp_cW, H; \
 p.luma_copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_cW, H; \
 p.luma_copy_ps[LUMA_ ## W ## x ## H] = blockcopy_ps_cW, H; \
+p.luma_copy_ss[LUMA_ ## W ## x ## H] = blockcopy_ss_cW, H; \
 p.luma_sub_ps[LUMA_ ## W ## x ## H] = pixel_sub_ps_cW, H; \
 p.luma_add_ps[LUMA_ ## W ## x ## H] = pixel_add_ps_cW, H;
 
diff -r ba92d0695116 -r f2fe08b5472f source/common/primitives.h
--- a/source/common/primitives.hWed Mar 05 21:32:47 2014 -0600
+++ b/source/common/primitives.hThu Mar 06 16:33:09 2014 +0530
@@ -182,6 +182,7 @@
 typedef void (*copy_pp_t)(pixel *dst, intptr_t dstride, pixel *src, intptr_t 
sstride); // dst is aligned
 typedef void (*copy_sp_t)(pixel *dst, intptr_t dstStride, int16_t *src, 
intptr_t srcStride);
 typedef void (*copy_ps_t)(int16_t *dst, intptr_t dstStride, pixel *src, 
intptr_t srcStride);
+typedef void (*copy_ss_t)(int16_t *dst, intptr_t dstStride, int16_t *src, 
intptr_t srcStride);
 
 typedef void (*pixel_sub_ps_t)(int16_t *dst, intptr_t dstride, pixel *src0, 
pixel *src1, intptr_t sstride0, intptr_t sstride1);
 typedef void (*pixel_add_ps_t)(pixel *a, intptr_t dstride, pixel *b0, int16_t 
*b1, intptr_t sstride0, intptr_t sstride1);
@@ -213,6 +214,7 @@
 copy_pp_t   luma_copy_pp[NUM_LUMA_PARTITIONS];
 copy_sp_t   luma_copy_sp[NUM_LUMA_PARTITIONS];
 copy_ps_t   luma_copy_ps[NUM_LUMA_PARTITIONS];
+copy_ss_t   luma_copy_ss[NUM_LUMA_PARTITIONS];
 pixel_sub_ps_t  luma_sub_ps[NUM_LUMA_PARTITIONS];
 pixel_add_ps_t  luma_add_ps[NUM_LUMA_PARTITIONS];
 
@@ -269,6 +271,7 @@
 copy_pp_t   copy_pp[NUM_LUMA_PARTITIONS];
 copy_sp_t   copy_sp[NUM_LUMA_PARTITIONS];
 copy_ps_t   copy_ps[NUM_LUMA_PARTITIONS];
+copy_ss_t   copy_ss[NUM_LUMA_PARTITIONS];
 pixel_sub_ps_t  sub_ps[NUM_LUMA_PARTITIONS];
 pixel_add_ps_t  add_ps[NUM_LUMA_PARTITIONS];
 addAvg_taddAvg[NUM_LUMA_PARTITIONS];
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Testbench code for blockcopy_ss

2014-03-06 Thread murugan
# HG changeset patch
# User Murugan Vairavel muru...@multicorewareinc.com
# Date 1394104114 -19800
#  Thu Mar 06 16:38:34 2014 +0530
# Node ID 20374496757b5c64b798833c2d48b8b585ca4b2e
# Parent  5cd0151094ba957f83e00d4a319c9e615f6c8587
Testbench code for blockcopy_ss

diff -r 5cd0151094ba -r 20374496757b source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp  Thu Mar 06 16:37:41 2014 +0530
+++ b/source/test/pixelharness.cpp  Thu Mar 06 16:38:34 2014 +0530
@@ -645,6 +645,32 @@
 return true;
 }
 
+bool PixelHarness::check_copy_ss(copy_ss_t ref, copy_ss_t opt)
+{
+ALIGN_VAR_16(int16_t, ref_dest[64 * 64]);
+ALIGN_VAR_16(int16_t, opt_dest[64 * 64]);
+
+// we don't know the partition size so we are checking the entire output 
buffer so
+// we must initialize the buffers
+memset(ref_dest, 0xCD, sizeof(ref_dest));
+memset(opt_dest, 0xCD, sizeof(opt_dest));
+
+int j = 0;
+for (int i = 0; i  ITERS; i++)
+{
+int index = i % TEST_CASES;
+opt(opt_dest, STRIDE, short_test_buff1[index] + j, STRIDE);
+ref(ref_dest, STRIDE, short_test_buff1[index] + j, STRIDE);
+
+if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
+return false;
+
+j += INCR;
+}
+
+return true;
+}
+
 bool PixelHarness::check_blockfill_s(blockfill_s_t ref, blockfill_s_t opt)
 {
 ALIGN_VAR_16(int16_t, ref_dest[64 * 64]);
@@ -1004,6 +1030,15 @@
 }
 }
 
+if (opt.luma_copy_ss[part])
+{
+if (!check_copy_ss(ref.luma_copy_ss[part], opt.luma_copy_ss[part]))
+{
+printf(luma_copy_ss[%s] failed\n, lumaPartStr[part]);
+return false;
+}
+}
+
 if (opt.luma_sub_ps[part])
 {
 if (!check_pixel_sub_ps(ref.luma_sub_ps[part], opt.luma_sub_ps[part]))
@@ -1057,6 +1092,14 @@
 return false;
 }
 }
+if (opt.chroma[i].copy_ss[part])
+{
+if (!check_copy_ss(ref.chroma[i].copy_ss[part], 
opt.chroma[i].copy_ss[part]))
+{
+printf(chroma_copy_ss[%s][%s] failed\n, 
x265_source_csp_names[i], chromaPartStr[part]);
+return false;
+}
+}
 if (opt.chroma[i].sub_ps[part])
 {
 if (!check_pixel_sub_ps(ref.chroma[i].sub_ps[part], 
opt.chroma[i].sub_ps[part]))
@@ -1367,6 +1410,11 @@
 HEADER(luma_copy_ps[%s], lumaPartStr[part]);
 REPORT_SPEEDUP(opt.luma_copy_ps[part], ref.luma_copy_ps[part], sbuf1, 
64, pbuf1, 128);
 }
+if (opt.luma_copy_ss[part])
+{
+HEADER(luma_copy_ss[%s], lumaPartStr[part]);
+REPORT_SPEEDUP(opt.luma_copy_ss[part], ref.luma_copy_ss[part], sbuf1, 
64, sbuf2, 128);
+}
 if (opt.luma_sub_ps[part])
 {
 HEADER(luma_sub_ps[%s], lumaPartStr[part]);
@@ -1402,6 +1450,11 @@
 HEADER([%s] copy_ps[%s], x265_source_csp_names[i], 
chromaPartStr[part]);
 REPORT_SPEEDUP(opt.chroma[i].copy_ps[part], 
ref.chroma[i].copy_ps[part], sbuf1, 64, pbuf1, 128);
 }
+if (opt.chroma[i].copy_ss[part])
+{
+HEADER([%s] copy_ss[%s], x265_source_csp_names[i], 
chromaPartStr[part]);
+REPORT_SPEEDUP(opt.chroma[i].copy_ss[part], 
ref.chroma[i].copy_ss[part], sbuf1, 64, sbuf2, 128);
+}
 if (opt.chroma[i].sub_ps[part])
 {
 HEADER([%s]  sub_ps[%s], x265_source_csp_names[i], 
chromaPartStr[part]);
diff -r 5cd0151094ba -r 20374496757b source/test/pixelharness.h
--- a/source/test/pixelharness.hThu Mar 06 16:37:41 2014 +0530
+++ b/source/test/pixelharness.hThu Mar 06 16:38:34 2014 +0530
@@ -45,6 +45,7 @@
 bool check_copy_pp(copy_pp_t ref, copy_pp_t opt);
 bool check_copy_sp(copy_sp_t ref, copy_sp_t opt);
 bool check_copy_ps(copy_ps_t ref, copy_ps_t opt);
+bool check_copy_ss(copy_ss_t ref, copy_ss_t opt);
 bool check_pixelavg_pp(pixelavg_pp_t ref, pixelavg_pp_t opt);
 bool check_pixel_sub_ps(pixel_sub_ps_t ref, pixel_sub_ps_t opt);
 bool check_pixel_add_ps(pixel_add_ps_t ref, pixel_add_ps_t opt);
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 2/2] Fix x86_64 build

2014-03-06 Thread Rafaël Carré
On 03/05/14 18:08, Steve Borho wrote:
 On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré fun...@videolan.org wrote:
 ---
  source/CMakeLists.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
 index 2febfaa..d2fea1a 100644
 --- a/source/CMakeLists.txt
 +++ b/source/CMakeLists.txt
 @@ -21,7 +21,7 @@ configure_file(${PROJECT_SOURCE_DIR}/x265_config.h.in

  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

 -if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL i386 OR ${CMAKE_SYSTEM_PROCESSOR} 
 STREQUAL x86)
 +if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL i386 OR ${CMAKE_SYSTEM_PROCESSOR} 
 STREQUAL x86 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
  set(X86 1)
  add_definitions(-DX265_ARCH_X86=1)
  if(${CMAKE_SIZEOF_VOID_P} MATCHES 8)
 
 
 I suspect there is something wrong with your git clone.  This line now
 looks like:
 
 string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSPROC)
 if(${SYSPROC} STREQUAL i386   OR ${SYSPROC} STREQUAL amd64 OR
${SYSPROC} STREQUAL x86_64 OR ${SYSPROC} STREQUAL x86   OR
${SYSPROC} STREQUAL )
 message(STATUS Detected x86 system processor)
 
 The line you have is over a month old.

Hum right, it stops after 31 january.

I'll look it up
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 1/2] weight prediction: use sqrtf

2014-03-06 Thread Rafaël Carré
On 03/05/14 18:06, Steve Borho wrote:
 On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré fun...@videolan.org wrote:
 ---
  source/encoder/weightPrediction.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/source/encoder/weightPrediction.cpp 
 b/source/encoder/weightPrediction.cpp
 index c04361a..c0710fd 100644
 --- a/source/encoder/weightPrediction.cpp
 +++ b/source/encoder/weightPrediction.cpp
 @@ -203,7 +203,7 @@ bool WeightPrediction::checkDenom(int denom)
  uint64_t fencVar = fenc-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  uint64_t refVar  = ref-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  if (fencVar  refVar)
 -guessScale[yuv] = Clip3(-2.f, 1.8f, 
 std::sqrt((float)fencVar / refVar));
 +guessScale[yuv] = Clip3(-2.f, 1.8f, 
 sqrtf((float)fencVar / refVar));
 
 Is something wrong with std::sqrt?

I got:
x265/source/encoder/weightPrediction.cpp:206:57: error: 'sqrt' is not a
member of 'std'

With g++ 4.8.2

Full command line is :

cd /home/fun/x265/source/encoder  /usr/bin/c++   -DHAVE_INT_TYPES_H=1
-DHIGH_BIT_DEPTH=0 -DLOG_CU_STATISTICS=0 -DX265_ARCH_X86=1 -DX86_64=1
-O2 -g -DNDEBUG -I/home/fun/x265/source/. -I/home/fun/x265/source/Lib
-I/home/fun/x265/source/common -I/home/fun/x265/source/encoder
-I/home/fun/x265/source-Wall -Wextra -Wshadow -ffast-math
-mstackrealign -fPIC -o CMakeFiles/encoder.dir/weightPrediction.cpp.o -c
/home/fun/x265/source/encoder/weightPrediction.cpp

Perhaps I am missing a -stdc++=something that was added later?

 This line recently caught my attention; I could not figure out why the
 output of sqrt() was being clipped to a negative base number, or why
 it was clipped on top either, for that matter.
 
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 1/2] weight prediction: use sqrtf

2014-03-06 Thread Steve Borho
On Thu, Mar 6, 2014 at 11:44 AM, Rafaël Carré fun...@videolan.org wrote:
 On 03/05/14 18:06, Steve Borho wrote:
 On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré fun...@videolan.org wrote:
 ---
  source/encoder/weightPrediction.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/source/encoder/weightPrediction.cpp 
 b/source/encoder/weightPrediction.cpp
 index c04361a..c0710fd 100644
 --- a/source/encoder/weightPrediction.cpp
 +++ b/source/encoder/weightPrediction.cpp
 @@ -203,7 +203,7 @@ bool WeightPrediction::checkDenom(int denom)
  uint64_t fencVar = fenc-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  uint64_t refVar  = ref-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  if (fencVar  refVar)
 -guessScale[yuv] = Clip3(-2.f, 1.8f, 
 std::sqrt((float)fencVar / refVar));
 +guessScale[yuv] = Clip3(-2.f, 1.8f, 
 sqrtf((float)fencVar / refVar));

 Is something wrong with std::sqrt?

 I got:
 x265/source/encoder/weightPrediction.cpp:206:57: error: 'sqrt' is not a
 member of 'std'

 With g++ 4.8.2

 Full command line is :

 cd /home/fun/x265/source/encoder  /usr/bin/c++   -DHAVE_INT_TYPES_H=1
 -DHIGH_BIT_DEPTH=0 -DLOG_CU_STATISTICS=0 -DX265_ARCH_X86=1 -DX86_64=1
 -O2 -g -DNDEBUG -I/home/fun/x265/source/. -I/home/fun/x265/source/Lib
 -I/home/fun/x265/source/common -I/home/fun/x265/source/encoder
 -I/home/fun/x265/source-Wall -Wextra -Wshadow -ffast-math
 -mstackrealign -fPIC -o CMakeFiles/encoder.dir/weightPrediction.cpp.o -c
 /home/fun/x265/source/encoder/weightPrediction.cpp

 Perhaps I am missing a -stdc++=something that was added later?

No, I don't believe so.  I build this regularly with gcc 4.8.1 on both
Linux and MinGW.

http://en.cppreference.com/w/cpp/numeric/math/sqrt

Does adding #include cmath to the file help?

-- 
Steve Borho
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] Unfixed typo in patch 6408 (889edfd2c4c3): VBV occupancy

2014-03-06 Thread Steve Borho
On Thu, Mar 6, 2014 at 1:29 AM, Mario *LigH* Rohkrämer cont...@ligh.de wrote:
 Just caught this while reading over latest changes: Missing u was not
 recognized during clarify attempt in source/common/param.cpp

Danke

-- 
Steve Borho
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 1/2] weight prediction: use sqrtf

2014-03-06 Thread Rafaël Carré
On 03/06/14 18:56, Steve Borho wrote:
 On Thu, Mar 6, 2014 at 11:44 AM, Rafaël Carré fun...@videolan.org wrote:
 On 03/05/14 18:06, Steve Borho wrote:
 On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré fun...@videolan.org wrote:
 ---
  source/encoder/weightPrediction.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/source/encoder/weightPrediction.cpp 
 b/source/encoder/weightPrediction.cpp
 index c04361a..c0710fd 100644
 --- a/source/encoder/weightPrediction.cpp
 +++ b/source/encoder/weightPrediction.cpp
 @@ -203,7 +203,7 @@ bool WeightPrediction::checkDenom(int denom)
  uint64_t fencVar = fenc-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  uint64_t refVar  = ref-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  if (fencVar  refVar)
 -guessScale[yuv] = Clip3(-2.f, 1.8f, 
 std::sqrt((float)fencVar / refVar));
 +guessScale[yuv] = Clip3(-2.f, 1.8f, 
 sqrtf((float)fencVar / refVar));

 Is something wrong with std::sqrt?

 I got:
 x265/source/encoder/weightPrediction.cpp:206:57: error: 'sqrt' is not a
 member of 'std'

 With g++ 4.8.2

 Full command line is :

 cd /home/fun/x265/source/encoder  /usr/bin/c++   -DHAVE_INT_TYPES_H=1
 -DHIGH_BIT_DEPTH=0 -DLOG_CU_STATISTICS=0 -DX265_ARCH_X86=1 -DX86_64=1
 -O2 -g -DNDEBUG -I/home/fun/x265/source/. -I/home/fun/x265/source/Lib
 -I/home/fun/x265/source/common -I/home/fun/x265/source/encoder
 -I/home/fun/x265/source-Wall -Wextra -Wshadow -ffast-math
 -mstackrealign -fPIC -o CMakeFiles/encoder.dir/weightPrediction.cpp.o -c
 /home/fun/x265/source/encoder/weightPrediction.cpp

 Perhaps I am missing a -stdc++=something that was added later?
 
 No, I don't believe so.  I build this regularly with gcc 4.8.1 on both
 Linux and MinGW.
 
 http://en.cppreference.com/w/cpp/numeric/math/sqrt
 
 Does adding #include cmath to the file help?

Yes, no problem if cmath is included.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH 1/2] weight prediction: use sqrtf

2014-03-06 Thread Steve Borho
On Thu, Mar 6, 2014 at 1:04 PM, Rafaël Carré fun...@videolan.org wrote:
 On 03/06/14 18:56, Steve Borho wrote:
 On Thu, Mar 6, 2014 at 11:44 AM, Rafaël Carré fun...@videolan.org wrote:
 On 03/05/14 18:06, Steve Borho wrote:
 On Wed, Mar 5, 2014 at 4:38 AM, Rafaël Carré fun...@videolan.org wrote:
 ---
  source/encoder/weightPrediction.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/source/encoder/weightPrediction.cpp 
 b/source/encoder/weightPrediction.cpp
 index c04361a..c0710fd 100644
 --- a/source/encoder/weightPrediction.cpp
 +++ b/source/encoder/weightPrediction.cpp
 @@ -203,7 +203,7 @@ bool WeightPrediction::checkDenom(int denom)
  uint64_t fencVar = fenc-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  uint64_t refVar  = ref-wp_ssd[yuv] + !ref-wp_ssd[yuv];
  if (fencVar  refVar)
 -guessScale[yuv] = Clip3(-2.f, 1.8f, 
 std::sqrt((float)fencVar / refVar));
 +guessScale[yuv] = Clip3(-2.f, 1.8f, 
 sqrtf((float)fencVar / refVar));

 Is something wrong with std::sqrt?

 I got:
 x265/source/encoder/weightPrediction.cpp:206:57: error: 'sqrt' is not a
 member of 'std'

 With g++ 4.8.2

 Full command line is :

 cd /home/fun/x265/source/encoder  /usr/bin/c++   -DHAVE_INT_TYPES_H=1
 -DHIGH_BIT_DEPTH=0 -DLOG_CU_STATISTICS=0 -DX265_ARCH_X86=1 -DX86_64=1
 -O2 -g -DNDEBUG -I/home/fun/x265/source/. -I/home/fun/x265/source/Lib
 -I/home/fun/x265/source/common -I/home/fun/x265/source/encoder
 -I/home/fun/x265/source-Wall -Wextra -Wshadow -ffast-math
 -mstackrealign -fPIC -o CMakeFiles/encoder.dir/weightPrediction.cpp.o -c
 /home/fun/x265/source/encoder/weightPrediction.cpp

 Perhaps I am missing a -stdc++=something that was added later?

 No, I don't believe so.  I build this regularly with gcc 4.8.1 on both
 Linux and MinGW.

 http://en.cppreference.com/w/cpp/numeric/math/sqrt

 Does adding #include cmath to the file help?

 Yes, no problem if cmath is included.

Thanks Rafaël,

I see that math.h is included in several cpp files and a couple of
headers.  I think I'll include cmath in common.h and remove all the
others.

-- 
Steve Borho
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] asm: added code for blockcopy_ss and cleaned up asm primitives of blockcopy

2014-03-06 Thread Steve Borho
On Thu, Mar 6, 2014 at 8:26 AM,  muru...@multicorewareinc.com wrote:
 # HG changeset patch
 # User Murugan Vairavel muru...@multicorewareinc.com
 # Date 1394104061 -19800
 #  Thu Mar 06 16:37:41 2014 +0530
 # Node ID 5cd0151094ba957f83e00d4a319c9e615f6c8587
 # Parent  f2fe08b5472fb3b1b47beac2e04e68c783d98836
 asm: added code for blockcopy_ss and cleaned up asm primitives of blockcopy

HIGH_BIT_DEPTH builds fail on gcc

/Users/steve/repos/x265/source/common/x86/asm-primitives.cpp:991:9:
error: pasting formed 'copy_ss[', an invalid preprocessing token

CHROMA_BLOCKCOPY(ss, _sse2);

^

/Users/steve/repos/x265/source/common/x86/asm-primitives.cpp:423:5:
note: expanded from macro 'CHROMA_BLOCKCOPY'

SETUP_CHROMA_BLOCKCOPY(type, 2,  4,  cpu); \

^

/Users/steve/repos/x265/source/common/x86/asm-primitives.cpp:420:43:
note: expanded from macro 'SETUP_CHROMA_BLOCKCOPY'

p.chroma[X265_CSP_I420].copy_ ## type ## [CHROMA_ ## W ## x ## H]
= x265_blockcopy_ ## type ##_ ## W ## x ## H ## cpu;

-- 
Steve Borho
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] cleanup m_sharedPredTransformSkip[]

2014-03-06 Thread chen
The pointer recon is unused, your patch is right

But you remove m_sharedPredTransformSkip, it is temporary buffer in tskip 
decide path, please verify more with --tskip

At 2014-03-04 18:40:23,Satoshi Nakagawa nakagawa...@oki.com wrote:
# HG changeset patch
# User Satoshi Nakagawa nakagawa...@oki.com
# Date 1393929339 -32400
#  Tue Mar 04 19:35:39 2014 +0900
# Node ID 7a61566806f691ddff84cbbc42801f6c2d46df88
# Parent  3cbde0b893e34e5770cc311d3f4b6fe064c27774
cleanup m_sharedPredTransformSkip[]

NEW_CALCRECON macro is TODO mark for asm experts, to optimize register 
assignment.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] cleanup m_sharedPredTransformSkip[]

2014-03-06 Thread chen
A little more, I know *pred is readonly, and default0Save1Load2 may 1 or 2 in 
same loop, so *pred can safe to reuse, it reduce one memory copy.

 

But they in different level of function area, so we have to add a comment on 
loop (xRecurIntraCodingQT), for warning everyone, when they modify algorithm, 
don't broken *pred memory.

 
of course, the default0Save1Load2 just to get *pred, so I like remove this 
parameret, we can get *pred outside of loop, then pass a pointer to readonly 
memory as parameter of xIntraCodingLumaBlk(). 


At 2014-03-07 06:36:20,chen chenm...@163.com wrote:


The pointer recon is unused, your patch is right

But you remove m_sharedPredTransformSkip, it is temporary buffer in tskip 
decide path, please verify more with --tskip

At 2014-03-04 18:40:23,Satoshi Nakagawa nakagawa...@oki.com wrote:
# HG changeset patch
# User Satoshi Nakagawa nakagawa...@oki.com
# Date 1393929339 -32400
#  Tue Mar 04 19:35:39 2014 +0900
# Node ID 7a61566806f691ddff84cbbc42801f6c2d46df88
# Parent  3cbde0b893e34e5770cc311d3f4b6fe064c27774
cleanup m_sharedPredTransformSkip[]

NEW_CALCRECON macro is TODO mark for asm experts, to optimize register 
assignment.
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


[x265] [PATCH] Removed Encoder* as member of DPB and replaced it with x265_param* passed to its methods

2014-03-06 Thread dtyx265
# HG changeset patch
# User David T Yuen dtyx...@gmail.com
# Date 1394152864 28800
# Node ID b95dc6fea48c58c9330481a7f3de7b48a0a35a0a
# Parent  7209562f4cc8ac53ad075e4f68a635cd739ff8f8
Removed Encoder* as member of DPB and replaced it with x265_param* passed to 
its methods
Also added int bframes to Lowres since only param-bframes is passed to its 
methods thus eliminating one of DPB's uses of Encoder*

diff -r 7209562f4cc8 -r b95dc6fea48c source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Thu Mar 06 15:29:23 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.cpp Thu Mar 06 16:41:04 2014 -0800
@@ -154,7 +154,7 @@
 memset(m_qpaAq, 0,  m_picSym-getFrameHeightInCU() * sizeof(double));
 }
 
-void TComPic::destroy(int bframes)
+void TComPic::destroy()
 {
 if (m_picSym)
 {
@@ -176,7 +176,7 @@
 delete m_reconPicYuv;
 m_reconPicYuv = NULL;
 }
-m_lowres.destroy(bframes);
+m_lowres.destroy();
 
 X265_FREE(m_rowDiagQp);
 X265_FREE(m_rowDiagQScale);
diff -r 7209562f4cc8 -r b95dc6fea48c source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h   Thu Mar 06 15:29:23 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.h   Thu Mar 06 16:41:04 2014 -0800
@@ -119,7 +119,7 @@
 virtual ~TComPic();
 
 bool  create(Encoder* cfg);
-virtual void  destroy(int bframes);
+virtual void  destroy();
 void  reInit(Encoder* cfg);
 
 bool  getUsedByCurr()   { return m_bUsedByCurr; }
diff -r 7209562f4cc8 -r b95dc6fea48c source/common/lowres.cpp
--- a/source/common/lowres.cpp  Thu Mar 06 15:29:23 2014 -0600
+++ b/source/common/lowres.cpp  Thu Mar 06 16:41:04 2014 -0800
@@ -27,9 +27,10 @@
 
 using namespace x265;
 
-bool Lowres::create(TComPicYuv *orig, int bframes, bool bAQEnabled)
+bool Lowres::create(TComPicYuv *orig, int _bframes, bool bAQEnabled)
 {
 isLowres = true;
+bframes = _bframes;
 width = orig-getWidth() / 2;
 lines = orig-getHeight() / 2;
 lumaStride = width + 2 * orig-getLumaMarginX();
@@ -92,7 +93,7 @@
 return false;
 }
 
-void Lowres::destroy(int bframes)
+void Lowres::destroy()
 {
 for (int i = 0; i  4; i++)
 {
@@ -125,7 +126,7 @@
 }
 
 // (re) initialize lowres state
-void Lowres::init(TComPicYuv *orig, int poc, int type, int bframes)
+void Lowres::init(TComPicYuv *orig, int poc, int type)
 {
 bIntraCalculated = false;
 bLastMiniGopBFrame = false;
diff -r 7209562f4cc8 -r b95dc6fea48c source/common/lowres.h
--- a/source/common/lowres.hThu Mar 06 15:29:23 2014 -0600
+++ b/source/common/lowres.hThu Mar 06 16:41:04 2014 -0800
@@ -123,6 +123,7 @@
 MV*   lowresMvs[2][X265_BFRAME_MAX + 1];
 int   plannedType[X265_LOOKAHEAD_MAX + 1];
 int64_t   plannedSatd[X265_LOOKAHEAD_MAX + 1];
+int   bframes;
 
 /* rate control / adaptive quant data */
 double*   qpAqOffset;  // qp Aq offset values for each Cu
@@ -134,9 +135,9 @@
 uint16_t* propagateCost;
 doubleweightedCostDelta[X265_BFRAME_MAX + 2];
 
-bool create(TComPicYuv *orig, int bframes, bool bAqEnabled);
-void destroy(int bframes);
-void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
+bool create(TComPicYuv *orig, int _bframes, bool bAqEnabled);
+void destroy();
+void init(TComPicYuv *orig, int poc, int sliceType);
 };
 }
 
diff -r 7209562f4cc8 -r b95dc6fea48c source/encoder/dpb.cpp
--- a/source/encoder/dpb.cppThu Mar 06 15:29:23 2014 -0600
+++ b/source/encoder/dpb.cppThu Mar 06 16:41:04 2014 -0800
@@ -36,7 +36,7 @@
 while (!m_picList.empty())
 {
 TComPic* pic = m_picList.popFront();
-pic-destroy(m_cfg-param-bframes);
+pic-destroy();
 delete pic;
 }
 }
@@ -64,7 +64,7 @@
 }
 }
 
-void DPB::prepareEncode(TComPic *pic)
+void DPB::prepareEncode(TComPic *pic, x265_param* param)
 {
 PPAScopeEvent(DPB_prepareEncode);
 
@@ -73,8 +73,8 @@
 m_picList.pushFront(*pic);
 
 TComSlice* slice = pic-getSlice();
-if (getNalUnitType(pocCurr, m_lastIDR, pic) == 
NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
-getNalUnitType(pocCurr, m_lastIDR, pic) == 
NAL_UNIT_CODED_SLICE_IDR_N_LP)
+if (getNalUnitType(pocCurr, m_lastIDR, pic, param) == 
NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
+getNalUnitType(pocCurr, m_lastIDR, pic, param) == 
NAL_UNIT_CODED_SLICE_IDR_N_LP)
 {
 m_lastIDR = pocCurr;
 }
@@ -92,7 +92,7 @@
 
 slice-setTemporalLayerNonReferenceFlag(!slice-isReferenced());
 // Set the nal unit type
-slice-setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic));
+slice-setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic, param));
 
 // If the slice is un-referenced, change from _R referenced to _N 
non-referenced NAL unit type
 if (slice-getTemporalLayerNonReferenceFlag())
@@ -365,7 +365,7 @@
  * \returns the nal unit type of the picture
  * This function checks the configuration and returns the appropriate 
nal_unit_type for 

Re: [x265] [PATCH] Merged TEncCfg into Encoder. A few VUI tweaks and fixes

2014-03-06 Thread dave

Steve, just looking for some clarification here...

diff -r 6662df480e39 -r 56fa912d6e7c source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h   Mon Mar 03 11:28:22 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.h   Mon Mar 03 14:24:34 2014 -0800
@@ -111,7 +111,7 @@
 TComYuv**m_bestMergeRecoYuv;
 TComYuv**m_origYuv; /// Original Yuv at each depth

-TEncCfg* m_cfg;
+Encoder* m_cfg;


It's a bit of a layering violation to have a top-level encoder pointer
way down here in the guts.  But this can be cleaned up later.

diff -r 6662df480e39 -r 56fa912d6e7c source/encoder/dpb.h
--- a/source/encoder/dpb.h  Mon Mar 03 11:28:22 2014 +0530
+++ b/source/encoder/dpb.h  Mon Mar 03 14:24:34 2014 -0800
@@ -32,7 +32,7 @@
  class FrameEncoder;
  class TComPic;
  class TComSlice;
-class TEncCfg;
+class Encoder;

  class DPB
  {
@@ -41,18 +41,18 @@
  intm_lastIDR;
  intm_pocCRA;
  bool   m_bRefreshPending;
-TEncCfg*   m_cfg;
+Encoder*   m_cfg;
Can we just pass a param to dpb?
I just sent a patch for this one.  After altering lowres, DPB only uses 
bOpenGOP so it could either be made a member of DPB or passed instead of 
x265_param*.  I thought in the future x265_param* would be more useful 
but developers more familiar with DPB and h265 know better them what's 
best.  I can submit a patch for whatever is best.

diff -r 6662df480e39 -r 56fa912d6e7c source/encoder/framefilter.h
--- a/source/encoder/framefilter.h  Mon Mar 03 11:28:22 2014 +0530
+++ b/source/encoder/framefilter.h  Mon Mar 03 14:24:34 2014 -0800
@@ -57,7 +57,7 @@
  protected:

  Encoder*m_top;
-TEncCfg*m_cfg;
+Encoder*m_cfg;
ditto here and in ratecontrol.cpp and slicetype.cpp.  it would be
greatly preferred to just pass param to these files instead of Encoder

From your layering violation comment, I guess you would like TEncCu 
added to this list.


Do you want Encoder* m_cfg/m_top replaced with x265_param* m_param as a 
member or would you prefer x265_param* passed as an argument to the 
methods of ratecontrol.cpp, slicetype.cpp, framefilter and TEncCu...?

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Merged TEncCfg into Encoder. A few VUI tweaks and fixes

2014-03-06 Thread Steve Borho
On Thu, Mar 6, 2014 at 7:09 PM, dave dtyx...@gmail.com wrote:
 Steve, just looking for some clarification here...


 diff -r 6662df480e39 -r 56fa912d6e7c source/Lib/TLibEncoder/TEncCu.h
 --- a/source/Lib/TLibEncoder/TEncCu.h   Mon Mar 03 11:28:22 2014 +0530
 +++ b/source/Lib/TLibEncoder/TEncCu.h   Mon Mar 03 14:24:34 2014 -0800
 @@ -111,7 +111,7 @@
  TComYuv**m_bestMergeRecoYuv;
  TComYuv**m_origYuv; /// Original Yuv at each depth

 -TEncCfg* m_cfg;
 +Encoder* m_cfg;

 It's a bit of a layering violation to have a top-level encoder pointer
 way down here in the guts.  But this can be cleaned up later.

 diff -r 6662df480e39 -r 56fa912d6e7c source/encoder/dpb.h
 --- a/source/encoder/dpb.h  Mon Mar 03 11:28:22 2014 +0530
 +++ b/source/encoder/dpb.h  Mon Mar 03 14:24:34 2014 -0800
 @@ -32,7 +32,7 @@
   class FrameEncoder;
   class TComPic;
   class TComSlice;
 -class TEncCfg;
 +class Encoder;

   class DPB
   {
 @@ -41,18 +41,18 @@
   intm_lastIDR;
   intm_pocCRA;
   bool   m_bRefreshPending;
 -TEncCfg*   m_cfg;
 +Encoder*   m_cfg;
 Can we just pass a param to dpb?

 I just sent a patch for this one.  After altering lowres, DPB only uses
 bOpenGOP so it could either be made a member of DPB or passed instead of
 x265_param*.  I thought in the future x265_param* would be more useful but
 developers more familiar with DPB and h265 know better them what's best.  I
 can submit a patch for whatever is best.

passing bOpenGOP to the constructor would be cleaner I suppose.

 diff -r 6662df480e39 -r 56fa912d6e7c source/encoder/framefilter.h
 --- a/source/encoder/framefilter.h  Mon Mar 03 11:28:22 2014 +0530
 +++ b/source/encoder/framefilter.h  Mon Mar 03 14:24:34 2014 -0800
 @@ -57,7 +57,7 @@
   protected:

   Encoder*m_top;

 -TEncCfg*m_cfg;
 +Encoder*m_cfg;
 ditto here and in ratecontrol.cpp and slicetype.cpp.  it would be
 greatly preferred to just pass param to these files instead of Encoder

 From your layering violation comment, I guess you would like TEncCu added
 to this list.

Yes

 Do you want Encoder* m_cfg/m_top replaced with x265_param* m_param as a
 member or would you prefer x265_param* passed as an argument to the methods
 of ratecontrol.cpp, slicetype.cpp, framefilter and TEncCu...?

Giving them all const x265_param * member variables is probably better
than adding function arguments.

-- 
Steve Borho
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel