[x265-commits] [x265] search: fix GCC warning about set but unused variable
Steve Borho
steve at borho.org
Wed Jan 14 09:34:35 CET 2015
details: http://hg.videolan.org/x265/rev/82cff5b768d6
branches:
changeset: 9151:82cff5b768d6
user: Steve Borho <steve at borho.org>
date: Tue Jan 13 20:43:20 2015 +0530
description:
search: fix GCC warning about set but unused variable
Subject: [x265] search: cleanup comments and streamline logic
details: http://hg.videolan.org/x265/rev/ec8fbc0f71d7
branches:
changeset: 9152:ec8fbc0f71d7
user: Steve Borho <steve at borho.org>
date: Tue Jan 13 21:09:10 2015 +0530
description:
search: cleanup comments and streamline logic
Subject: [x265] slicetype: simplify lowres intra logic
details: http://hg.videolan.org/x265/rev/52509cdef38a
branches:
changeset: 9153:52509cdef38a
user: Steve Borho <steve at borho.org>
date: Tue Jan 13 21:17:56 2015 +0530
description:
slicetype: simplify lowres intra logic
do not bother with allangs, just use the per-mode primitives
Subject: [x265] intrapred: nit
details: http://hg.videolan.org/x265/rev/5f3f8455d647
branches:
changeset: 9154:5f3f8455d647
user: Steve Borho <steve at borho.org>
date: Tue Jan 13 21:21:48 2015 +0530
description:
intrapred: nit
Subject: [x265] predict: minor cleanups
details: http://hg.videolan.org/x265/rev/8c66a97cd442
branches:
changeset: 9155:8c66a97cd442
user: Steve Borho <steve at borho.org>
date: Tue Jan 13 21:34:38 2015 +0530
description:
predict: minor cleanups
Subject: [x265] doc: add more details to strict-cbr
details: http://hg.videolan.org/x265/rev/d39cc8c1d87d
branches:
changeset: 9156:d39cc8c1d87d
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Wed Jan 14 11:01:49 2015 +0530
description:
doc: add more details to strict-cbr
Subject: [x265] framefilter: fix PSNR calculations
details: http://hg.videolan.org/x265/rev/2b9097e1065c
branches:
changeset: 9157:2b9097e1065c
user: Steve Borho <steve at borho.org>
date: Wed Jan 14 12:19:11 2015 +0530
description:
framefilter: fix PSNR calculations
Subject: [x265] intrapred: nits
details: http://hg.videolan.org/x265/rev/8582ce7c2bfa
branches:
changeset: 9158:8582ce7c2bfa
user: Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
date: Tue Jan 13 18:15:40 2015 +0530
description:
intrapred: nits
Subject: [x265] intrapred: constant input for intra_pred
details: http://hg.videolan.org/x265/rev/7ad510c96fea
branches:
changeset: 9159:7ad510c96fea
user: Min Chen
date: Wed Jan 14 12:06:54 2015 +0530
description:
intrapred: constant input for intra_pred
Updated by Dnyaneshwar
diffstat:
doc/reST/cli.rst | 15 ++-
source/common/intrapred.cpp | 25 ++++---
source/common/predict.cpp | 18 ++--
source/common/primitives.h | 2 +-
source/common/x86/intrapred.h | 18 ++--
source/encoder/framefilter.cpp | 31 ++++----
source/encoder/search.cpp | 40 +++-------
source/encoder/slicetype.cpp | 133 ++++++++++----------------------------
source/encoder/slicetype.h | 7 --
source/test/intrapredharness.cpp | 2 +-
10 files changed, 107 insertions(+), 184 deletions(-)
diffs (truncated from 628 to 300 lines):
diff -r 74bdb220e441 -r 7ad510c96fea doc/reST/cli.rst
--- a/doc/reST/cli.rst Tue Jan 13 17:42:00 2015 +0530
+++ b/doc/reST/cli.rst Wed Jan 14 12:06:54 2015 +0530
@@ -998,6 +998,15 @@ Quality, rate control and rate distortio
target bitrate in CBR mode. Bitrate adherence is prioritised
over quality. Rate tolerance is reduced to 50%. Default disabled.
+ This option is for use-cases which require the final average bitrate
+ to be within very strict limits of the target - preventing overshoots
+ completely, and achieve bitrates within 5% of target bitrate,
+ especially in short segment encodes. Typically, the encoder stays
+ conservative, waiting until there is enough feedback in terms of
+ encoded frames to control QP. strict-cbr allows the encoder to be
+ more aggressive in hitting the target bitrate even for short segment
+ videos. Experimental.
+
.. option:: --cbqpoffs <integer>
Offset of Cb chroma QP from the luma QP selected by rate control.
@@ -1038,12 +1047,6 @@ Quality, rate control and rate distortio
The maximum single adjustment in QP allowed to rate control. Default
4
-.. option:: --ratetol <float>
-
- The degree of rate fluctuation that x265 tolerates. Rate tolerance
- is used along with overflow (difference between actual and target
- bitrate), to adjust qp. Default is 1.0
-
.. option:: --qblur <float>
Temporally blur quants. Default 0.5
diff -r 74bdb220e441 -r 7ad510c96fea source/common/intrapred.cpp
--- a/source/common/intrapred.cpp Tue Jan 13 17:42:00 2015 +0530
+++ b/source/common/intrapred.cpp Wed Jan 14 12:06:54 2015 +0530
@@ -27,7 +27,7 @@
using namespace x265;
namespace {
-void dcPredFilter(pixel* above, pixel* left, pixel* dst, intptr_t dststride, int size)
+void dcPredFilter(const pixel* above, const pixel* left, pixel* dst, intptr_t dststride, int size)
{
// boundary pixels processing
dst[0] = (pixel)((above[0] + left[0] + 2 * dst[0] + 2) >> 2);
@@ -44,7 +44,7 @@ void dcPredFilter(pixel* above, pixel* l
}
template<int width>
-void intra_pred_dc_c(pixel* dst, intptr_t dstStride, pixel* srcPix, int /*dirMode*/, int bFilter)
+void intra_pred_dc_c(pixel* dst, intptr_t dstStride, const pixel* srcPix, int /*dirMode*/, int bFilter)
{
int k, l;
@@ -59,16 +59,15 @@ void intra_pred_dc_c(pixel* dst, intptr_
if (bFilter)
dcPredFilter(srcPix + 1, srcPix + (2 * width + 1), dst, dstStride, width);
-
}
template<int log2Size>
-void planar_pred_c(pixel* dst, intptr_t dstStride, pixel* srcPix, int /*dirMode*/, int /*bFilter*/)
+void planar_pred_c(pixel* dst, intptr_t dstStride, const pixel* srcPix, int /*dirMode*/, int /*bFilter*/)
{
const int blkSize = 1 << log2Size;
- pixel* above = srcPix + 1;
- pixel* left = srcPix + (2 * blkSize + 1);
+ const pixel* above = srcPix + 1;
+ const pixel* left = srcPix + (2 * blkSize + 1);
pixel topRight = above[blkSize];
pixel bottomLeft = left[blkSize];
@@ -76,13 +75,15 @@ void planar_pred_c(pixel* dst, intptr_t
for (int x = 0; x < blkSize; x++)
dst[y * dstStride + x] = (pixel) (((blkSize - 1 - x) * left[y] + (blkSize - 1 -y) * above[x] + (x + 1) * topRight + (y + 1) * bottomLeft + blkSize) >> (log2Size + 1));
}
+
template<int width>
-void intra_pred_ang_c(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter)
+void intra_pred_ang_c(pixel* dst, intptr_t dstStride, const pixel *srcPix0, int dirMode, int bFilter)
{
int width2 = width << 1;
// Flip the neighbours in the horizontal case.
int horMode = dirMode < 18;
pixel neighbourBuf[129];
+ const pixel *srcPix = srcPix0;
if (horMode)
{
@@ -120,14 +121,15 @@ void intra_pred_ang_c(pixel* dst, intptr
else // Angular prediction.
{
// Get the reference pixels. The reference base is the first pixel to the top (neighbourBuf[1]).
- pixel refBuf[64], *ref;
+ pixel refBuf[64];
+ const pixel *ref;
// Use the projected left neighbours and the top neighbours.
if (angle < 0)
{
// Number of neighbours projected.
int nbProjected = -((width * angle) >> 5) - 1;
- ref = refBuf + nbProjected + 1;
+ pixel *ref_pix = refBuf + nbProjected + 1;
// Project the neighbours.
int invAngle = invAngleTable[- angleOffset - 1];
@@ -135,12 +137,13 @@ void intra_pred_ang_c(pixel* dst, intptr
for (int i = 0; i < nbProjected; i++)
{
invAngleSum += invAngle;
- ref[- 2 - i] = srcPix[width2 + (invAngleSum >> 8)];
+ ref_pix[- 2 - i] = srcPix[width2 + (invAngleSum >> 8)];
}
// Copy the top-left and top pixels.
for (int i = 0; i < width + 1; i++)
- ref[-1 + i] = srcPix[i];
+ ref_pix[-1 + i] = srcPix[i];
+ ref = ref_pix;
}
else // Use the top and top-right neighbours.
ref = srcPix + 1;
diff -r 74bdb220e441 -r 7ad510c96fea source/common/predict.cpp
--- a/source/common/predict.cpp Tue Jan 13 17:42:00 2015 +0530
+++ b/source/common/predict.cpp Wed Jan 14 12:06:54 2015 +0530
@@ -65,14 +65,13 @@ fail:
void Predict::predIntraLumaAng(uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSize)
{
+ int sizeIdx = log2TrSize - 2;
int tuSize = 1 << log2TrSize;
- pixel* srcPix = (!(g_intraFilterFlags[dirMode] & tuSize)) ? intraNeighbourBuf[0] : intraNeighbourBuf[1];
+ int filter = !!(g_intraFilterFlags[dirMode] & tuSize);
+ X265_CHECK(sizeIdx >= 0 && sizeIdx < 4, "intra block size is out of range\n");
bool bFilter = log2TrSize <= 4;
- int sizeIdx = log2TrSize - 2;
- X265_CHECK(sizeIdx >= 0 && sizeIdx < 4, "intra block size is out of range\n");
-// primitives.intra_pred[dirMode][sizeIdx](dst, stride, refLft, refAbv, dirMode, bFilter);
- primitives.intra_pred[dirMode][sizeIdx](dst, stride, srcPix, dirMode, bFilter);
+ primitives.intra_pred[dirMode][sizeIdx](dst, stride, intraNeighbourBuf[filter], dirMode, bFilter);
}
void Predict::predIntraChromaAng(uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSizeC, int chFmt)
@@ -106,7 +105,6 @@ void Predict::predIntraChromaAng(uint32_
int sizeIdx = log2TrSizeC - 2;
X265_CHECK(sizeIdx >= 0 && sizeIdx < 4, "intra block size is out of range\n");
-// primitives.intra_pred[dirMode][sizeIdx](dst, stride, left, above, dirMode, 0);
primitives.intra_pred[dirMode][sizeIdx](dst, stride, srcBuf, dirMode, 0);
}
@@ -651,14 +649,14 @@ void Predict::initAdiPattern(const CUDat
int init = (topLeft << shift) + tuSize;
int deltaL, deltaR;
- //TODO: Performance Primitive???
+ // TODO: Performance Primitive???
deltaL = leftLast - topLeft; deltaR = topLast - topLeft;
fltBuf[0] = topLeft;
for (int i = 1; i < trSize2; i++)
{
- fltBuf[i + tuSize2] = (pixel)((init + deltaL * i) >> shift); //Left Filtering
- fltBuf[i] = (pixel)((init + deltaR * i) >> shift); //Above Filtering
+ fltBuf[i + tuSize2] = (pixel)((init + deltaL * i) >> shift); // Left Filtering
+ fltBuf[i] = (pixel)((init + deltaR * i) >> shift); // Above Filtering
}
fltBuf[trSize2] = topLast;
fltBuf[tuSize2 + trSize2] = leftLast;
@@ -675,7 +673,7 @@ void Predict::initAdiPattern(const CUDat
// filtering top-left
fltBuf[0] = ((topLeft << 1) + refBuf[1] + refBuf[tuSize2 + 1] + 2) >> 2;
- //filtering left
+ // filtering left
fltBuf[tuSize2 + 1] = ((refBuf[tuSize2 + 1] << 1) + topLeft + refBuf[tuSize2 + 2] + 2) >> 2;
for (int i = tuSize2 + 2; i < tuSize2 + tuSize2; i++)
fltBuf[i] = ((refBuf[i] << 1) + refBuf[i - 1] + refBuf[i + 1] + 2) >> 2;
diff -r 74bdb220e441 -r 7ad510c96fea source/common/primitives.h
--- a/source/common/primitives.h Tue Jan 13 17:42:00 2015 +0530
+++ b/source/common/primitives.h Wed Jan 14 12:06:54 2015 +0530
@@ -135,7 +135,7 @@ typedef void (*pixelcmp_x4_t)(const pixe
typedef void (*pixelcmp_x3_t)(const pixel* fenc, const pixel* fref0, const pixel* fref1, const pixel* fref2, intptr_t frefstride, int32_t* res);
typedef void (*blockfill_s_t)(int16_t* dst, intptr_t dstride, int16_t val);
-typedef void (*intra_pred_t)(pixel* dst, intptr_t dstStride, pixel *srcPix, int dirMode, int bFilter);
+typedef void (*intra_pred_t)(pixel* dst, intptr_t dstStride, const pixel *srcPix, int dirMode, int bFilter);
typedef void (*intra_allangs_t)(pixel *dst, pixel *refPix, pixel *filtPix, int bLuma);
typedef void (*cpy2Dto1D_shl_t)(int16_t* dst, const int16_t* src, intptr_t srcStride, int shift);
diff -r 74bdb220e441 -r 7ad510c96fea source/common/x86/intrapred.h
--- a/source/common/x86/intrapred.h Tue Jan 13 17:42:00 2015 +0530
+++ b/source/common/x86/intrapred.h Wed Jan 14 12:06:54 2015 +0530
@@ -26,18 +26,18 @@
#ifndef X265_INTRAPRED_H
#define X265_INTRAPRED_H
-void x265_intra_pred_dc4_sse4 (pixel* dst, intptr_t dstStride, pixel*srcPix, int, int filter);
-void x265_intra_pred_dc8_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
-void x265_intra_pred_dc16_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
-void x265_intra_pred_dc32_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int filter);
+void x265_intra_pred_dc4_sse4 (pixel* dst, intptr_t dstStride, const pixel*srcPix, int, int filter);
+void x265_intra_pred_dc8_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
+void x265_intra_pred_dc16_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
+void x265_intra_pred_dc32_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int filter);
-void x265_intra_pred_planar4_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar8_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar16_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
-void x265_intra_pred_planar32_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
+void x265_intra_pred_planar4_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar8_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar16_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
+void x265_intra_pred_planar32_sse4(pixel* dst, intptr_t dstStride, const pixel* srcPix, int, int);
#define DECL_ANG(bsize, mode, cpu) \
- void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel* dst, intptr_t dstStride, pixel* above, int dirMode, int bFilter);
+ void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel* dst, intptr_t dstStride, const pixel* srcPix, int dirMode, int bFilter);
DECL_ANG(4, 2, ssse3);
DECL_ANG(4, 3, sse4);
diff -r 74bdb220e441 -r 7ad510c96fea source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp Tue Jan 13 17:42:00 2015 +0530
+++ b/source/encoder/framefilter.cpp Wed Jan 14 12:06:54 2015 +0530
@@ -322,45 +322,44 @@ static uint64_t computeSSD(pixel *fenc,
return ssd;
}
- uint32_t y = 0;
- int rowHeight = 64;
+ intptr_t y = 0;
/* Consume rows in ever narrower chunks of height */
- for (int size = BLOCK_64x64; size >= BLOCK_4x4; size--)
+ for (int size = BLOCK_64x64; size >= BLOCK_4x4 && y < height; size--)
{
+ int rowHeight = 1 << (size + 2);
+
for (; y + rowHeight <= height; y += rowHeight)
{
- uint32_t x = 0;
+ intptr_t x = 0;
/* Consume each row using the largest square blocks possible */
- if (size == BLOCK_64x64)
+ if (size == BLOCK_64x64 && !(stride & 31))
for (; x + 64 <= width; x += 64)
ssd += primitives.cu[BLOCK_64x64].sse_pp(fenc + x, stride, rec + x, stride);
- if (size >= BLOCK_32x32)
+ if (size >= BLOCK_32x32 && !(stride & 15))
for (; x + 32 <= width; x += 32)
- for (int y1 = 0; y1 < rowHeight; y1 += 32)
- ssd += primitives.cu[BLOCK_32x32].sse_pp(fenc + stride * y1 * 32 + x, stride, rec + stride * y1 * 32 + x, stride);
+ for (int y1 = 0; y1 + 32 <= rowHeight; y1 += 32)
+ ssd += primitives.cu[BLOCK_32x32].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
if (size >= BLOCK_16x16)
for (; x + 16 <= width; x += 16)
- for (int y1 = 0; y1 < rowHeight; y1 += 16)
- ssd += primitives.cu[BLOCK_16x16].sse_pp(fenc + stride * y1 * 16 + x, stride, rec + stride * y1 * 16 + x, stride);
+ for (int y1 = 0; y1 + 16 <= rowHeight; y1 += 16)
+ ssd += primitives.cu[BLOCK_16x16].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
if (size >= BLOCK_8x8)
for (; x + 8 <= width; x += 8)
- for (int y1 = 0; y1 < rowHeight; y1 += 8)
- ssd += primitives.cu[BLOCK_8x8].sse_pp(fenc + stride * y1 * 8 + x, stride, rec + stride * y1 * 8 + x, stride);
+ for (int y1 = 0; y1 + 8 <= rowHeight; y1 += 8)
+ ssd += primitives.cu[BLOCK_8x8].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
for (; x + 4 <= width; x += 4)
- for (int y1 = 0; y1 < rowHeight; y1 += 4)
- ssd += primitives.cu[BLOCK_4x4].sse_pp(fenc + stride * y1 * 4 + x, stride, rec + stride * y1 * 4 + x, stride);
+ for (int y1 = 0; y1 + 4 <= rowHeight; y1 += 4)
+ ssd += primitives.cu[BLOCK_4x4].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
fenc += stride * rowHeight;
rec += stride * rowHeight;
}
-
- rowHeight >>= 1;
}
return ssd;
diff -r 74bdb220e441 -r 7ad510c96fea source/encoder/search.cpp
--- a/source/encoder/search.cpp Tue Jan 13 17:42:00 2015 +0530
+++ b/source/encoder/search.cpp Wed Jan 14 12:06:54 2015 +0530
@@ -1246,15 +1246,14 @@ void Search::checkIntraInInter(Mode& int
m_entropyCoder.loadIntraDirModeLuma(m_rqt[depth].cur);
/* there are three cost tiers for intra modes:
- * pred[0] - mode probable, least cost
- * pred[1], pred[2] - less probable, slightly more cost
- * non-mpm modes - all cost the same (rbits) */
+ * pred[0] - mode probable, least cost
+ * pred[1], pred[2] - less probable, slightly more cost
More information about the x265-commits
mailing list