Changes of Revision 35
x265.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Sun Dec 1 10:44:50 UTC 2019 - Luigi Baldoni <aloisio@gmx.com>
4
+
5
+- Update to version 3.2.1
6
+ * Fix output change in analysis load
7
+ * Fix encoder crash with zones and add test for zones
8
+ * Fix: Performance drop in aq-mode 4 This patch moves the
9
+ memory handling part of the edge information required for
10
+ aq-mode 4 to the Frame class-level in that way it can be
11
+ reused by the threads.
12
+ * Fix: Performance drop in aq-mode 4 This patch moves the
13
+ memory handling part of the edge information required for
14
+ aq-mode 4 to the Frame class-level in that way it can be
15
+ reused by the threads.
16
+ * Fix output change observed during analysis-load for
17
+ inter-refine levels 2 and 3.
18
+ * Adaptive Frame duplication This patch does the following. 1.
19
+ Replaces 2-3 near-identical frames with one frame and sets
20
+ pic_struct based on frame doubling / tripling. 2. Add option
21
+ "--frame-dup" and "--dup-threshold' to enable frame
22
+ duplication and to set threshold for frame similarity
23
+ (optional).
24
+ * Fix: AQ mode 4 commit (21db162) introduces slowdown even is
25
+ not used AQ mode 4.
26
+
27
+-------------------------------------------------------------------
28
Tue Oct 01 12:21:19 UTC 2019 - enzokiel@kabelmail.de
29
30
- Update to version 3.2
31
x265.spec
Changed
10
1
2
%define libname lib%{name}
3
%define libsoname %{libname}-%{soname}
4
Name: x265
5
-Version: 3.2
6
+Version: 3.2.1
7
Release: 0
8
Summary: A free h265/HEVC encoder - encoder binary
9
License: GPL-2.0-or-later
10
x265_3.2.tar.gz/.hg_archival.txt -> x265_3.2.1.tar.gz/.hg_archival.txt
Changed
9
1
2
repo: 09fe40627f03a0f9c3e6ac78b22ac93da23f9fdf
3
-node: 353572437201d551381002aebf20d244bd49ef17
4
+node: b5c86a64bbbede216b25092def72272ecde5523a
5
branch: Release_3.2
6
-tag: 3.2
7
+latesttag: 3.2.1
8
+latesttagdistance: 1
9
x265_3.2.tar.gz/.hgtags -> x265_3.2.1.tar.gz/.hgtags
Changed
7
1
2
113518629fa54ffb491dd479e15c1f00dd39d376 3.1_RC1
3
b4e38ce16d7c4b37a6482dc7ae61fd31071b6ff1 3.1_RC2
4
20c9994e8bfbeb9443851b2b3a050cd98c8b147b 3.2_RC1
5
+353572437201d551381002aebf20d244bd49ef17 3.2
6
+7fa570ead8d361bf6055cd2a881a8e15f12110ae 3.2.1
7
x265_3.2.tar.gz/source/common/frame.cpp -> x265_3.2.1.tar.gz/source/common/frame.cpp
Changed
44
1
2
m_addOnPrevChange = NULL;
3
m_classifyFrame = false;
4
m_fieldNum = 0;
5
+ m_edgePic = NULL;
6
+ m_gaussianPic = NULL;
7
+ m_thetaPic = NULL;
8
}
9
10
bool Frame::create(x265_param *param, float* quantOffsets)
11
12
CHECKED_MALLOC_ZERO(m_classifyCount, uint32_t, size);
13
}
14
15
+ if (param->rc.aqMode == X265_AQ_EDGE || (param->rc.zonefileCount && param->rc.aqMode != 0))
16
+ {
17
+ uint32_t numCuInWidth = (param->sourceWidth + param->maxCUSize - 1) / param->maxCUSize;
18
+ uint32_t numCuInHeight = (param->sourceHeight + param->maxCUSize - 1) / param->maxCUSize;
19
+ uint32_t m_lumaMarginX = param->maxCUSize + 32; // search margin and 8-tap filter half-length, padded for 32-byte alignment
20
+ uint32_t m_lumaMarginY = param->maxCUSize + 16; // margin for 8-tap filter and infinite padding
21
+ intptr_t m_stride = (numCuInWidth * param->maxCUSize) + (m_lumaMarginX << 1);
22
+ int maxHeight = numCuInHeight * param->maxCUSize;
23
+
24
+ m_edgePic = X265_MALLOC(pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
25
+ m_gaussianPic = X265_MALLOC(pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
26
+ m_thetaPic = X265_MALLOC(pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
27
+ }
28
+
29
if (m_fencPic->create(param, !!m_param->bCopyPicToFrame) && m_lowres.create(param, m_fencPic, param->rc.qgSize))
30
{
31
X265_CHECK((m_reconColCount == NULL), "m_reconColCount was initialized");
32
33
X265_FREE_ZERO(m_classifyVariance);
34
X265_FREE_ZERO(m_classifyCount);
35
}
36
+
37
+ if (m_param->rc.aqMode == X265_AQ_EDGE || (m_param->rc.zonefileCount && m_param->rc.aqMode != 0))
38
+ {
39
+ X265_FREE(m_edgePic);
40
+ X265_FREE(m_gaussianPic);
41
+ X265_FREE(m_thetaPic);
42
+ }
43
}
44
x265_3.2.tar.gz/source/common/frame.h -> x265_3.2.1.tar.gz/source/common/frame.h
Changed
13
1
2
bool m_classifyFrame;
3
int m_fieldNum;
4
5
+ /* aq-mode 4 : Gaussian, edge and theta frames for edge information */
6
+ pixel* m_edgePic;
7
+ pixel* m_gaussianPic;
8
+ pixel* m_thetaPic;
9
+
10
Frame();
11
12
bool create(x265_param *param, float* quantOffsets);
13
x265_3.2.tar.gz/source/encoder/analysis.cpp -> x265_3.2.1.tar.gz/source/encoder/analysis.cpp
Changed
19
1
2
}
3
if (!mode.cu.m_mergeFlag[pu.puAbsPartIdx])
4
{
5
- if (m_param->mvRefine || m_param->interRefine == 1)
6
+ if (m_param->interRefine == 1)
7
m_me.setSourcePU(*mode.fencYuv, pu.ctuAddr, pu.cuAbsPartIdx, pu.puAbsPartIdx, pu.width, pu.height, m_param->searchMethod, m_param->subpelRefine, false);
8
//AMVP
9
MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 2];
10
11
12
int numMvc = mode.cu.getPMV(mode.interNeighbours, list, ref, mode.amvpCand[list][ref], mvc);
13
mvp = mode.amvpCand[list][ref][mode.cu.m_mvpIdx[list][pu.puAbsPartIdx]];
14
- if (m_param->mvRefine || m_param->interRefine == 1)
15
+ if (m_param->interRefine == 1)
16
{
17
MV outmv, mvpSelect[3];
18
mvpSelect[0] = interDataCTU->mv[list][cuIdx + part].word;
19
x265_3.2.tar.gz/source/encoder/api.cpp -> x265_3.2.1.tar.gz/source/encoder/api.cpp
Changed
9
1
2
int zoneCount = p->rc.zonefileCount ? p->rc.zonefileCount : p->rc.zoneCount;
3
param->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
4
latestParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
5
+ zoneParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
6
}
7
8
x265_copy_params(param, p);
9
x265_3.2.tar.gz/source/encoder/search.cpp -> x265_3.2.1.tar.gz/source/encoder/search.cpp
Changed
94
1
2
{
3
CUData& cu = interMode.cu;
4
MV mv, mvmin, mvmax;
5
- cu.clipMv(mv);
6
int cand = 0, bestcost = INT_MAX;
7
- do
8
+ while (cand < m_param->mvRefine)
9
{
10
- if (cand && (mvp[cand] == mvp[cand - 1] || (cand == 2 && mvp[cand] == mvp[cand - 2])))
11
+ if ((cand && mvp[cand] == mvp[cand - 1]) || (cand == 2 && (mvp[cand] == mvp[cand - 2] || mvp[cand] == mvp[cand - 1])))
12
+ {
13
+ cand++;
14
continue;
15
+ }
16
MV bestMV;
17
- mv = mvp[cand];
18
+ mv = mvp[cand++];
19
+ cu.clipMv(mv);
20
setSearchRange(cu, mv, m_param->searchRange, mvmin, mvmax);
21
int cost = m_me.motionEstimate(&m_slice->m_mref[list][ref], mvmin, mvmax, mv, numMvc, mvc, m_param->searchRange, bestMV, m_param->maxSlices,
22
m_param->bSourceReferenceEstimation ? m_slice->m_refFrameList[list][ref]->m_fencPic->getLumaAddr(0) : 0);
23
24
bestcost = cost;
25
outmv = bestMV;
26
}
27
- }while (++cand < m_param->mvRefine);
28
+ }
29
}
30
/* find the best inter prediction for each PU of specified mode */
31
void Search::predInterSearch(Mode& interMode, const CUGeom& cuGeom, bool bChromaMC, uint32_t refMasks[2])
32
33
const MV* amvp = interMode.amvpCand[list][ref];
34
int mvpIdx = selectMVP(cu, pu, amvp, list, ref);
35
MV mvmin, mvmax, outmv, mvp;
36
- mvp = amvp[mvpIdx];
37
+ if (useAsMVP)
38
+ {
39
+ mvp = interDataCTU->mv[list][cuIdx + puIdx].word;
40
+ mvpIdx = interDataCTU->mvpIdx[list][cuIdx + puIdx];
41
+ }
42
+ else
43
+ mvp = amvp[mvpIdx];
44
if (m_param->searchMethod == X265_SEA)
45
{
46
int puX = puIdx & 1;
47
48
int satdCost;
49
if (m_param->analysisMultiPassRefine && m_param->rc.bStatRead && mvpIdx == bestME[list].mvpIdx)
50
mvpIn = bestME[list].mv;
51
- if (useAsMVP)
52
+ if (useAsMVP && m_param->mvRefine > 1)
53
{
54
MV bestmv, mvpSel[3];
55
int mvpIdxSel[3];
56
satdCost = m_me.COST_MAX;
57
- mvpSel[0] = interDataCTU->mv[list][cuIdx + puIdx].word;
58
- mvpIdxSel[0] = interDataCTU->mvpIdx[list][cuIdx + puIdx];
59
- if (m_param->mvRefine > 1)
60
+ mvpSel[0] = mvp;
61
+ mvpIdxSel[0] = mvpIdx;
62
+ mvpIdx = selectMVP(cu, pu, amvp, list, ref);
63
+ mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];
64
+ mvpIdxSel[1] = mvpIdx;
65
+ if (m_param->mvRefine > 2)
66
{
67
- mvpSel[1] = interMode.amvpCand[list][ref][mvpIdx];
68
- mvpIdxSel[1] = mvpIdx;
69
- if (m_param->mvRefine > 2)
70
- {
71
- mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];
72
- mvpIdxSel[2] = !mvpIdx;
73
- }
74
+ mvpSel[2] = interMode.amvpCand[list][ref][!mvpIdx];
75
+ mvpIdxSel[2] = !mvpIdx;
76
}
77
for (int cand = 0; cand < m_param->mvRefine; cand++)
78
{
79
if (cand && (mvpSel[cand] == mvpSel[cand - 1] || (cand == 2 && mvpSel[cand] == mvpSel[cand - 2])))
80
continue;
81
- setSearchRange(cu, mvp, m_param->searchRange, mvmin, mvmax);
82
+ setSearchRange(cu, mvpSel[cand], m_param->searchRange, mvmin, mvmax);
83
int bcost = m_me.motionEstimate(&m_slice->m_mref[list][ref], mvmin, mvmax, mvpSel[cand], numMvc, mvc, m_param->searchRange, bestmv, m_param->maxSlices,
84
m_param->bSourceReferenceEstimation ? m_slice->m_refFrameList[list][ref]->m_fencPic->getLumaAddr(0) : 0);
85
if (satdCost > bcost)
86
87
mvpIdx = mvpIdxSel[cand];
88
}
89
}
90
+ mvpIn = mvp;
91
}
92
else
93
{
94
x265_3.2.tar.gz/source/encoder/slicetype.cpp -> x265_3.2.1.tar.gz/source/encoder/slicetype.cpp
Changed
108
1
2
3
} // end anonymous namespace
4
5
-void edgeFilter(Frame *curFrame, pixel *pic1, pixel *pic2, pixel *pic3, intptr_t stride, int height, int width)
6
+void edgeFilter(Frame *curFrame, x265_param* param)
7
{
8
+ int height = curFrame->m_fencPic->m_picHeight;
9
+ int width = curFrame->m_fencPic->m_picWidth;
10
+ intptr_t stride = curFrame->m_fencPic->m_stride;
11
+ uint32_t numCuInHeight = (height + param->maxCUSize - 1) / param->maxCUSize;
12
+ int maxHeight = numCuInHeight * param->maxCUSize;
13
+
14
+ memset(curFrame->m_edgePic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
15
+ memset(curFrame->m_gaussianPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
16
+ memset(curFrame->m_thetaPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
17
+
18
pixel *src = (pixel*)curFrame->m_fencPic->m_picOrg[0];
19
- pixel *edgePic = pic1 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
20
- pixel *refPic = pic2 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
21
- pixel *edgeTheta = pic3 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
22
+ pixel *edgePic = curFrame->m_edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
23
+ pixel *refPic = curFrame->m_gaussianPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
24
+ pixel *edgeTheta = curFrame->m_thetaPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
25
26
for (int i = 0; i < height; i++)
27
{
28
29
30
//Applying Gaussian filter on the picture
31
src = (pixel*)curFrame->m_fencPic->m_picOrg[0];
32
- refPic = pic2 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
33
+ refPic = curFrame->m_gaussianPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
34
pixel pixelValue = 0;
35
36
for (int rowNum = 0; rowNum < height; rowNum++)
37
38
float gradientH = 0, gradientV = 0, radians = 0, theta = 0;
39
float gradientMagnitude = 0;
40
pixel blackPixel = 0;
41
- edgePic = pic1 + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
42
+ edgePic = curFrame->m_edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
43
//Applying Sobel filter on the gaussian filtered picture
44
for (int rowNum = 0; rowNum < height; rowNum++)
45
{
46
47
angle = sum / (size*size);
48
}
49
50
-uint32_t LookaheadTLD::edgeDensityCu(Frame* curFrame,pixel *edgeImage, pixel *edgeTheta, uint32_t &avgAngle, uint32_t blockX, uint32_t blockY, uint32_t qgSize)
51
+uint32_t LookaheadTLD::edgeDensityCu(Frame* curFrame, uint32_t &avgAngle, uint32_t blockX, uint32_t blockY, uint32_t qgSize)
52
{
53
+ pixel *edgeImage = curFrame->m_edgePic + curFrame->m_fencPic->m_lumaMarginY * curFrame->m_fencPic->m_stride + curFrame->m_fencPic->m_lumaMarginX;
54
+ pixel *edgeTheta = curFrame->m_thetaPic + curFrame->m_fencPic->m_lumaMarginY * curFrame->m_fencPic->m_stride + curFrame->m_fencPic->m_lumaMarginX;
55
intptr_t srcStride = curFrame->m_fencPic->m_stride;
56
intptr_t blockOffsetLuma = blockX + (blockY * srcStride);
57
int plane = 0; // Sobel filter is applied only on Y component
58
59
}
60
else
61
{
62
-#define AQ_EDGE_BIAS 0.5
63
-#define EDGE_INCLINATION 45
64
- uint32_t numCuInHeight = (maxRow + param->maxCUSize - 1) / param->maxCUSize;
65
- int maxHeight = numCuInHeight * param->maxCUSize;
66
- intptr_t stride = curFrame->m_fencPic->m_stride;
67
- pixel *edgePic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));
68
- pixel *gaussianPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));
69
- pixel *thetaPic = X265_MALLOC(pixel, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)));
70
- memset(edgePic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
71
- memset(gaussianPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
72
- memset(thetaPic, 0, stride * (maxHeight + (curFrame->m_fencPic->m_lumaMarginY * 2)) * sizeof(pixel));
73
- if (param->rc.aqMode == X265_AQ_EDGE)
74
- edgeFilter(curFrame, edgePic, gaussianPic, thetaPic, stride, maxRow, maxCol);
75
-
76
int blockXY = 0, inclinedEdge = 0;
77
double avg_adj_pow2 = 0, avg_adj = 0, qp_adj = 0;
78
double bias_strength = 0.f;
79
double strength = 0.f;
80
+
81
+ if (param->rc.aqMode == X265_AQ_EDGE)
82
+ edgeFilter(curFrame, param);
83
+
84
if (param->rc.aqMode == X265_AQ_AUTO_VARIANCE || param->rc.aqMode == X265_AQ_AUTO_VARIANCE_BIASED || param->rc.aqMode == X265_AQ_EDGE)
85
{
86
double bit_depth_correction = 1.f / (1 << (2 * (X265_DEPTH - 8)));
87
88
energy = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);
89
if (param->rc.aqMode == X265_AQ_EDGE)
90
{
91
- pixel *edgeImage = edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
92
- pixel *edgeTheta = thetaPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
93
- edgeDensity = edgeDensityCu(curFrame, edgeImage, edgeTheta, avgAngle, blockX, blockY, param->rc.qgSize);
94
+ edgeDensity = edgeDensityCu(curFrame, avgAngle, blockX, blockY, param->rc.qgSize);
95
if (edgeDensity)
96
{
97
qp_adj = pow(edgeDensity * bit_depth_correction + 1, 0.1);
98
99
else
100
strength = param->rc.aqStrength * 1.0397f;
101
102
- X265_FREE(edgePic);
103
- X265_FREE(gaussianPic);
104
- X265_FREE(thetaPic);
105
blockXY = 0;
106
for (int blockY = 0; blockY < maxRow; blockY += loopIncr)
107
{
108
x265_3.2.tar.gz/source/encoder/slicetype.h -> x265_3.2.1.tar.gz/source/encoder/slicetype.h
Changed
19
1
2
3
#define LOWRES_COST_MASK ((1 << 14) - 1)
4
#define LOWRES_COST_SHIFT 14
5
+#define AQ_EDGE_BIAS 0.5
6
+#define EDGE_INCLINATION 45
7
8
/* Thread local data for lookahead tasks */
9
struct LookaheadTLD
10
11
protected:
12
13
uint32_t acEnergyCu(Frame* curFrame, uint32_t blockX, uint32_t blockY, int csp, uint32_t qgSize);
14
- uint32_t edgeDensityCu(Frame*curFrame, pixel *edgeImage, pixel *edgeTheta, uint32_t &avgAngle, uint32_t blockX, uint32_t blockY, uint32_t qgSize);
15
+ uint32_t edgeDensityCu(Frame*curFrame, uint32_t &avgAngle, uint32_t blockX, uint32_t blockY, uint32_t qgSize);
16
uint32_t lumaSumCu(Frame* curFrame, uint32_t blockX, uint32_t blockY, uint32_t qgSize);
17
uint32_t weightCostLuma(Lowres& fenc, Lowres& ref, WeightParam& wp);
18
bool allocWeightedRef(Lowres& fenc);
19
x265_3.2.tar.gz/source/test/regression-tests.txt -> x265_3.2.1.tar.gz/source/test/regression-tests.txt
Changed
12
1
2
BasketballDrive_1920x1080_50.y4m, --preset medium --no-open-gop --keyint 50 --min-keyint 50 --radl 2 --vbv-maxrate 5000 --vbv-bufsize 5000
3
big_buck_bunny_360p24.y4m, --bitrate 500 --fades
4
720p50_parkrun_ter.y4m,--preset medium --bitrate 400 --hme
5
-ducks_take_off_420_1_720p50.y4m,--preset medium --aq-mode 4 --crf 22 --no-cutree
6
+ducks_take_off_420_720p50.y4m,--preset medium --aq-mode 4 --crf 22 --no-cutree
7
ducks_take_off_420_1_720p50.y4m,--preset medium --selective-sao 4 --sao --crf 20
8
+Kimono1_1920x1080_24_400.yuv,--preset superfast --qp 28 --zones 0,139,q=32
9
10
# Main12 intraCost overflow bug test
11
720p50_parkrun_ter.y4m,--preset medium
12