Overview

Request 5053 (accepted)

- Update to version 3.3
New features:
* Adaptive frame duplication** to identify and skip encoding
of near-identical frames and signal the duplication info to the
decoder via pic_struct SEI. :option:`frame-dup` to enable frame
duplication and :option:`--dup-threshold` to set the threshold
for frame similarity (optional).
* Boundary aware quantization** to cut off bits from frames
following scene-cut. This leverages the inability of HVS to
perceive fine details during scene changes and saves bits.
:option:`--scenecut-aware-qp` , :option:`--scenecut-window` and
:option:`--max-qp-delta` to enable boundary aware frame
quantization, to set window size (optional) and to set QP offset
(optional).
* Improved scene-cut detection** using edge and chroma
histograms. :option:`--hist-scenecut` to enable the feature and
:option:`--hist-threshold` (optional) to provide threshold for
determining scene cuts.
Enhancements to existing features:
* :option:`--hme-range` to modify search range for HME levels
L0, L1, and L2.
* Improved performance of AQ mode 4 by reducing memory foot
print.
* Introduced :option:`--analysis-save-reuse-level` and
:option:`--analysis-load-reuse-level` to de-couple reuse levels
of :option:`--analysis-save` and :option:`--analysis-load`.
Turnaround time of ABR encoding can be reduced by properly
leveraging these options.
Encoder enhancements:
* Improved VBV lookahead to eliminate blocky artifacts in

Submit package Staging / x265 to package Essentials / x265

x265.changes Changed
x
 
1
@@ -1,4 +1,57 @@
2
 -------------------------------------------------------------------
3
+Sat Mar 28 14:28:56 UTC 2020 - Luigi Baldoni <aloisio@gmx.com>
4
+
5
+- Update to version 3.3
6
+  New features:
7
+  * Adaptive frame duplication** to identify and skip encoding
8
+    of near-identical frames and signal the duplication info to the
9
+    decoder via pic_struct SEI. :option:`frame-dup` to enable frame
10
+    duplication and :option:`--dup-threshold` to set the threshold
11
+    for frame similarity (optional).
12
+  * Boundary aware quantization** to cut off bits from frames
13
+    following scene-cut. This leverages the inability of HVS to
14
+    perceive fine details during scene changes and saves bits.
15
+    :option:`--scenecut-aware-qp` , :option:`--scenecut-window` and
16
+    :option:`--max-qp-delta` to enable boundary aware frame
17
+    quantization, to set window size (optional) and to set QP offset
18
+    (optional).
19
+  * Improved scene-cut detection** using edge and chroma
20
+    histograms. :option:`--hist-scenecut` to enable the feature and
21
+    :option:`--hist-threshold` (optional) to provide threshold for
22
+    determining scene cuts.
23
+  Enhancements to existing features:
24
+  * :option:`--hme-range` to modify search range for HME levels
25
+    L0, L1, and L2.
26
+  * Improved performance of AQ mode 4 by reducing memory foot
27
+    print.
28
+  * Introduced :option:`--analysis-save-reuse-level` and
29
+    :option:`--analysis-load-reuse-level` to de-couple reuse levels
30
+    of :option:`--analysis-save` and :option:`--analysis-load`.
31
+    Turnaround time of ABR encoding can be reduced by properly
32
+    leveraging these options.
33
+  Encoder enhancements:
34
+  * Improved VBV lookahead to eliminate blocky artifacts in
35
+    Intra frames coming towards end of the title.
36
+  API changes:
37
+  * New API function **x265_encoder_reconfig_zone()** to invoke
38
+    zone reconfiguration dynamically.  
39
+  * Renamed :option:`--hdr` to :option:`--hdr10`.
40
+    :option:`--hdr` will be deprecated in the upcoming major
41
+    release. 
42
+  * Renamed :option:`--hdr-opt` to :option:`--hdr10-opt`.
43
+    :option:`--hdr-opt` will be deprecated in the upcoming major
44
+    release.
45
+  * Additions to **x265_param** structure to support the newly
46
+    added features and encoder enhancements.
47
+  Bug fixes:
48
+  * Output change in :option:`--analysis-load` at inter-refine
49
+    levels 2 and 3.
50
+  * Encoder crash with zones.
51
+  * Integration issues with SVT v1.4.1.
52
+  * Fixed bug in :option:`--limit-tu` 3 and 4 while loading
53
+    co-located CU's TU depth.
54
+
55
+-------------------------------------------------------------------
56
 Sun Dec  1 10:44:50 UTC 2019 - Luigi Baldoni <aloisio@gmx.com>
57
 
58
 - Update to version 3.2.1
59
x265.spec Changed
24
 
1
@@ -1,7 +1,7 @@
2
 #
3
 # spec file for package x265
4
 #
5
-# Copyright (c) 2019 Packman Team <packman@links2linux.de>
6
+# Copyright (c) 2020 Packman Team <packman@links2linux.de>
7
 # Copyright (c) 2014 Torsten Gruner <t.gruner@katodev.de>
8
 #
9
 # All modifications and additions to the file contributed by third parties
10
@@ -17,11 +17,11 @@
11
 #
12
 
13
 
14
-%define sover  179
15
+%define sover  188
16
 %define libname lib%{name}
17
 %define libsoname %{libname}-%{sover}
18
 Name:           x265
19
-Version:        3.2.1
20
+Version:        3.3
21
 Release:        0
22
 Summary:        A free h265/HEVC encoder - encoder binary
23
 License:        GPL-2.0-or-later
24
x265_3.2.1.tar.gz/.hg_archival.txt -> x265_3.3.tar.gz/.hg_archival.txt Changed
10
 
1
@@ -1,5 +1,5 @@
2
 repo: 09fe40627f03a0f9c3e6ac78b22ac93da23f9fdf
3
-node: b5c86a64bbbede216b25092def72272ecde5523a
4
-branch: Release_3.2
5
-latesttag: 3.2.1
6
+node: f94b0d32737d40b2b9a9d74df57fee45e6be5cb0
7
+branch: Release_3.3
8
+latesttag: 3.3
9
 latesttagdistance: 1
10
x265_3.2.1.tar.gz/.hgtags -> x265_3.3.tar.gz/.hgtags Changed
9
 
1
@@ -37,4 +37,6 @@
2
 b4e38ce16d7c4b37a6482dc7ae61fd31071b6ff1 3.1_RC2
3
 20c9994e8bfbeb9443851b2b3a050cd98c8b147b 3.2_RC1
4
 353572437201d551381002aebf20d244bd49ef17 3.2
5
-7fa570ead8d361bf6055cd2a881a8e15f12110ae 3.2.1
6
+5ee3593ebd82b4d8957909bbc1b68b99b59ba773 3.3_RC1
7
+96a10df63c0b778b480330bdf3be8da7db8a5fb1 3.3_RC2
8
+057215961bc4b51b6260a584ff3d506e6d65cfd6 3.3
9
x265_3.2.1.tar.gz/doc/reST/api.rst -> x265_3.3.tar.gz/doc/reST/api.rst Changed
18
 
1
@@ -191,7 +191,15 @@
2
     *      switched out of; using reconfig to switch between ultrafast and other
3
     *      presets is not recommended without a more fine-grained breakdown of
4
     *      parameters to take this into account. */
5
-   int x265_encoder_reconfig(x265_encoder *, x265_param *);
6
+    int x265_encoder_reconfig(x265_encoder *, x265_param *);
7
+
8
+**x265_encoder_reconfig_zone()** Used to reconfigure rate-contol settings of zones mid-encode::
9
+
10
+    /* x265_encoder_reconfig_zone:
11
+     *      Properties of the zone will be copied to encoder's param and will be used only to
12
+     *      influence rate-control decisions of the zone.
13
+     *      returns 0 on successful copy and negative on failure.*/
14
+    int x265_encoder_reconfig(x265_encoder *, x265_param *);
15
 
16
 **x265_get_slicetype_poc_and_scenecut()** may be used to fetch slice type, poc and scene cut information mid-encode::
17
 
18
x265_3.2.1.tar.gz/doc/reST/cli.rst -> x265_3.3.tar.gz/doc/reST/cli.rst Changed
247
 
1
@@ -501,6 +501,17 @@
2
    second. The decoder must re-combine the fields in their correct
3
    orientation for display.
4
 
5
+.. option:: --frame-dup, --no-frame-dup
6
+
7
+   Enable Adaptive Frame duplication. Replaces 2-3 near-identical frames with one 
8
+   frame and sets pic_struct based on frame doubling / tripling. 
9
+   Default disabled.
10
+
11
+.. option:: --dup-threshold <integer>
12
+
13
+   Frame similarity threshold can vary between 1 and 99. This requires Adaptive
14
+   Frame Duplication to be enabled. Default 70.
15
+
16
 .. option:: --seek <integer>
17
 
18
    Number of frames to skip at start of input file. Default 0
19
@@ -894,25 +905,30 @@
20
    Encoder outputs analysis information of each frame. Analysis data from save mode is
21
    written to the file specified. Requires cutree, pmode to be off. Default disabled.
22
    
23
+   The amount of analysis data stored is determined by :option:`--analysis-save-reuse-level`.
24
+   
25
 .. option:: --analysis-load <filename>
26
 
27
    Encoder reuses analysis information from the file specified. By reading the analysis data writen by
28
    an earlier encode of the same sequence, substantial redundant work may be avoided. Requires cutree, pmode
29
    to be off. Default disabled.
30
 
31
-   The amount of analysis data stored/reused is determined by :option:`--analysis-reuse-level`.
32
+   The amount of analysis data reused is determined by :option:`--analysis-load-reuse-level`.
33
 
34
 .. option:: --analysis-reuse-file <filename>
35
 
36
-   Specify a filename for `multi-pass-opt-analysis` and `multi-pass-opt-distortion`.
37
+   Specify a filename for :option:`--multi-pass-opt-analysis` and option:`--multi-pass-opt-distortion`.
38
    If no filename is specified, x265_analysis.dat is used.
39
 
40
-.. option:: --analysis-reuse-level <1..10>
41
+.. option:: --analysis-save-reuse-level <1..10>, --analysis-load-reuse-level <1..10>
42
 
43
-   Amount of information stored/reused in :option:`--analysis-reuse-mode` is distributed across levels.
44
-   Higher the value, higher the information stored/reused, faster the encode. Default 5.
45
+   'analysis-save-reuse-level' denotes the amount of information stored during :option:`--analysis-save` and
46
+   'analysis-load-reuse-level' denotes the amount of information reused during :option:`--analysis-load`.
47
+   Higher the value, higher the information stored/reused, faster the encode. Default 0. If not set during analysis-save/load,
48
+   the encoder will internally configure them to 5.
49
 
50
-   Note that --analysis-reuse-level must be paired with analysis-reuse-mode.
51
+   Note that :option:`--analysis-save-reuse-level` and :option:`--analysis-load-reuse-level` must be paired
52
+   with :option:`--analysis-save` and :option:`--analysis-load` respectively.
53
 
54
    +--------------+------------------------------------------+
55
    | Level        | Description                              |
56
@@ -939,15 +955,15 @@
57
 
58
     Store/normalize ctu distortion in analysis-save/load.
59
     0 - Disabled.
60
-    1 - Save ctu distortion to the analysis file specified during analysis-save.
61
-        Load CTU distortion from the analysis file and normalize it across every frame during analysis-load.
62
+    1 - Save ctu distortion to the analysis file specified during :option:`--analysis-save`.
63
+        Load CTU distortion from the analysis file and normalize it across every frame during :option:`--analysis-load`.
64
     Default 0.
65
 
66
 .. option:: --scale-factor
67
 
68
    Factor by which input video is scaled down for analysis save mode.
69
-   This option should be coupled with analysis-reuse-mode option, 
70
-   --analysis-reuse-level 10. The ctu size of load can either be the 
71
+   This option should be coupled with :option:`--analysis-load`/:option:`--analysis-save` 
72
+   at reuse levels 1 to 6 and 10. The ctu size of load can either be the 
73
    same as that of save or double the size of save. Default 0.
74
 
75
 .. option:: --refine-intra <0..4>
76
@@ -1079,9 +1095,9 @@
77
    limiting depth for the other subTUs.
78
    
79
    Enabling levels 3 or 4 may cause a mismatch in the output bitstreams 
80
-   between option:`--analysis-save` and option:`--analysis-load`
81
+   between :option:`--analysis-save` and :option:`--analysis-load`
82
    as all neighbouring CUs TU depth may not be available in the 
83
-   option:`--analysis-load` run as only the best mode's information is 
84
+   :option:`--analysis-load` run as only the best mode's information is 
85
    available to it.
86
    
87
    Default: 0
88
@@ -1187,9 +1203,10 @@
89
    followed by an optional star-search refinement. Full is an
90
    exhaustive search; an order of magnitude slower than all other
91
    searches but not much better than umh or star. SEA is similar to
92
-   FULL search; a three step motion search adopted from x264: DC 
93
-   calculation followed by ADS calculation followed by SAD of the
94
-   passed motion vector candidates, hence faster than Full search. 
95
+   x264's ESA implementation and a speed optimization of full search.
96
+    It is a three step motion search where the DC calculation is
97
+    followed by ADS calculation followed by SAD of the passed motion
98
+    vector candidates.
99
 
100
    0. dia
101
    1. hex **(default)**
102
@@ -1279,6 +1296,12 @@
103
        which will apply to all levels. Default is hex,umh,umh for 
104
        levels 0,1,2 respectively.
105
 
106
+.. option:: --hme-range <integer>,<integer>,<integer>
107
+
108
+   Search range for HME level 0, 1 and 2.
109
+   The Search Range for each HME level must be between 0 and 32768(excluding).
110
+   Default search range is 16,32,48 for level 0,1,2 respectively.
111
+
112
 Spatial/intra options
113
 =====================
114
 
115
@@ -1415,7 +1438,20 @@
116
    This value represents the percentage difference between the inter cost and
117
    intra cost of a frame used in scenecut detection. For example, a value of 5 indicates,
118
    if the inter cost of a frame is greater than or equal to 95 percent of the intra cost of the frame,
119
-   then detect this frame as scenecut. Values between 5 and 15 are recommended. Default 5.
120
+   then detect this frame as scenecut. Values between 5 and 15 are recommended. Default 5. 
121
+
122
+.. option:: --hist-scenecut, --no-hist-scenecut
123
+
124
+   Indicates that scenecuts need to be detected using luma edge and chroma histograms.
125
+   :option: `--hist-scenecut` enables scenecut detection using the histograms and disables the default scene cut algorithm.
126
+   :option: `--no-hist-scenecut` disables histogram based scenecut algorithm.
127
+   
128
+.. option:: --hist-threshold <0.0..2.0>
129
+
130
+   This value represents the threshold for normalized SAD of edge histograms used in scenecut detection.
131
+   This requires :option: `--hist-scenecut` to be enabled. For example, a value of 0.2 indicates that a frame with normalized SAD value 
132
+   greater than 0.2 against the previous frame as scenecut. 
133
+   Default 0.01.
134
    
135
 .. option:: --radl <integer>
136
    
137
@@ -1761,8 +1797,8 @@
138
    and also redundant steps are skipped.
139
    In pass 1 analysis information like motion vector, depth, reference and prediction
140
    modes of the final best CTU partition is stored for each CTU.
141
-   Multipass analysis refinement cannot be enabled when 'analysis-save/analysis-load' option
142
-   is enabled and both will be disabled when enabled together. This feature requires 'pmode/pme'
143
+   Multipass analysis refinement cannot be enabled when :option:`--analysis-save`/:option:`analysis-load`
144
+   is enabled and both will be disabled when enabled together. This feature requires :option:`--pmode`/:option:`--pme`
145
    to be disabled and hence pmode/pme will be disabled when enabled at the same time.
146
 
147
    Default: disabled.
148
@@ -1773,9 +1809,9 @@
149
    ratecontrol. In pass 1 distortion of best CTU partition is stored. CTUs with high
150
    distortion get lower(negative)qp offsets and vice-versa for low distortion CTUs in pass 2.
151
    This helps to improve the subjective quality.
152
-   Multipass refinement of qp cannot be enabled when 'analysis-save/analysis-load' option
153
-   is enabled and both will be disabled when enabled together. 'multi-pass-opt-distortion' 
154
-   requires 'pmode/pme' to be disabled and hence pmode/pme will be disabled when enabled along with it.
155
+   Multipass refinement of qp cannot be enabled when :option:`--analysis-save`/:option:`--analysis-load`
156
+   is enabled and both will be disabled when enabled together. It requires :option:`--pmode`/:option:`--pme` to be
157
+   disabled and hence pmode/pme will be disabled when enabled along with it.
158
 
159
    Default: disabled.
160
 
161
@@ -1887,6 +1923,28 @@
162
    
163
    **CLI ONLY**
164
 
165
+.. option:: --scenecut-aware-qp, --no-scenecut-aware-qp
166
+   
167
+   Enables a ratecontrol algorithm for reducing the bits spent on the inter-frames
168
+   within the :option:`--scenecut-window` after a scenecut by increasing their QP
169
+   without any deterioration in visual quality. It also increases the quality of
170
+   scenecut I-Frames by reducing their QP. Default disabled.
171
+   
172
+.. option:: --scenecut-window <integer>
173
+
174
+   The duration(in milliseconds) for which there is a reduction in the bits spent
175
+   on the inter-frames after a scenecut by increasing their QP, when
176
+   :option:`--scenecut-aware-qp` is enabled. Default 500ms.
177
+   
178
+   **Range of values:** 0 to 1000
179
+   
180
+.. option:: --max-qp-delta <integer>
181
+
182
+   The offset by which QP is incremented for inter-frames
183
+   when :option:`--scenecut-aware-qp` is enabled. Default 5.
184
+   
185
+   **Range of values:**  0 to 10
186
+
187
 Quantization Options
188
 ====================
189
 
190
@@ -2198,18 +2256,20 @@
191
     is specified. When enabled, signals max-cll and max-fall as 0 if :option:`max-cll` is unspecified.
192
     Default enabled.
193
 
194
-.. option:: --hdr, --no-hdr
195
+.. option:: --hdr10, --no-hdr10
196
 
197
-   Force signalling of HDR parameters in SEI packets. Enabled
198
+   Force signaling of HDR10 parameters in SEI packets. Enabled
199
    automatically when :option:`--master-display` or :option:`--max-cll` is
200
    specified. Useful when there is a desire to signal 0 values for max-cll
201
    and max-fall. Default disabled.
202
 
203
-.. option:: --hdr-opt, --no-hdr-opt
204
+.. option:: --hdr10-opt, --no-hdr10-opt
205
 
206
-   Add luma and chroma offsets for HDR/WCG content.
207
-   Input video should be 10 bit 4:2:0. Applicable for HDR content. It is recommended
208
-   that AQ-mode be enabled along with this feature. Default disabled.
209
+   Enable block-level luma and chroma QP optimization for HDR10 content
210
+   as suggested in ITU-T H-series Recommendations – Supplement 15.
211
+   Source video should have HDR10 characteristics such as 10-bit depth 4:2:0
212
+   with Bt.2020 color primaries and SMPTE ST.2084 transfer characteristics.
213
+   It is recommended that AQ-mode be enabled along with this feature. Default disabled.
214
 
215
 .. option:: --dhdr10-info <filename>
216
 
217
@@ -2383,9 +2443,11 @@
218
    Only effective at RD levels 5 and 6
219
 
220
 .. option:: --idr-recovery-sei, --no-idr-recovery-sei
221
+
222
    Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default disabled.
223
 
224
 .. option:: --single-sei, --no-single-sei
225
+
226
    Emit SEI messages in a single NAL unit instead of multiple NALs. Default disabled.
227
    When HRD SEI is enabled the HM decoder will throw a warning.
228
 
229
@@ -2489,12 +2551,12 @@
230
 
231
 .. option:: --svt-preset-tuner <integer>
232
 
233
-    SVT-HEVC exposes 13 presets. Presets [3-12] of SVT-HEVC is mapped to x265's
234
-    presets [placebo-ultrafast]. Ultrafast is mapped to preset(12) of SVT-HEVC,
235
-    superfast to preset(11), placebo to preset(3) and so on. svt-preset-tuner works
236
-    only on top of placebo preset and maps to presets (0-2) of SVT-HEVC.
237
+    SVT-HEVC exposes 12 presets. Presets [2-11] of SVT-HEVC is mapped to x265's
238
+    presets [placebo-ultrafast]. Ultrafast is mapped to preset(11) of SVT-HEVC,
239
+    superfast to preset(10), placebo to preset(2) and so on. svt-preset-tuner works
240
+    only on top of placebo preset and maps to presets (0-1) of SVT-HEVC.
241
 
242
-    Values: [0-2]
243
+    Values: [0-1]
244
 
245
     **CLI_ONLY**
246
 
247
x265_3.2.1.tar.gz/doc/reST/presets.rst -> x265_3.3.tar.gz/doc/reST/presets.rst Changed
13
 
1
@@ -67,9 +67,9 @@
2
 +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+
3
 | max-merge       |  2  |  2  |  2  |   2 |   2 |   2 |   3  |   4  |   5  |  5   |
4
 +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+
5
-| early-skip      |  1  |  1  |  1  |   1 |   0 |   0 |   0  |   0  |   0  |  0   |
6
+| early-skip      |  1  |  1  |  1  |   1 |   0 |   1 |   0  |   0  |   0  |  0   |
7
 +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+
8
-| recursion-skip  |  1  |  1  |  1  |   1 |   1 |   1 |   1  |   0  |   0  |  0   |
9
+| recursion-skip  |  1  |  1  |  1  |   1 |   1 |   1 |   1  |   1  |   1  |  0   |
10
 +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+
11
 | fast-intra      |  1  |  1  |  1  |   1 |   1 |   0 |   0  |   0  |   0  |  0   |
12
 +-----------------+-----+-----+-----+-----+-----+-----+------+------+------+------+
13
x265_3.2.1.tar.gz/doc/reST/releasenotes.rst -> x265_3.3.tar.gz/doc/reST/releasenotes.rst Changed
43
 
1
@@ -2,6 +2,41 @@
2
 Release Notes
3
 *************
4
 
5
+Version 3.3
6
+===========
7
+
8
+Release date - 17th February, 2020.
9
+
10
+New features
11
+------------
12
+1. **Adaptive frame duplication** to identify and skip encoding of near-identical frames and signal the duplication info to the decoder via pic_struct SEI. :option:`frame-dup` to enable frame duplication and :option:`--dup-threshold` to set the threshold for frame similarity (optional).
13
+2. **Boundary aware quantization** to cut off bits from frames following scene-cut. This leverages the inability of HVS to perceive fine details during scene changes and saves bits. :option:`--scenecut-aware-qp` , :option:`--scenecut-window` and :option:`--max-qp-delta` to enable boundary aware frame quantization, to set window size (optional) and to set QP offset (optional).
14
+3. **Improved scene-cut detection** using edge and chroma histograms. :option:`--hist-scenecut` to enable the feature and :option:`--hist-threshold` (optional) to provide threshold for determining scene cuts.
15
+
16
+Enhancements to existing features
17
+---------------------------------
18
+1. :option:`--hme-range` to modify search range for HME levels L0, L1, and L2.
19
+2. Improved performance of AQ mode 4 by reducing memory foot print.
20
+3. Introduced :option:`--analysis-save-reuse-level` and :option:`--analysis-load-reuse-level` to de-couple reuse levels of :option:`--analysis-save` and :option:`--analysis-load`. Turnaround time of ABR encoding can be reduced by properly leveraging these options.
21
+  
22
+Encoder enhancements
23
+--------------------
24
+1. Improved VBV lookahead to eliminate blocky artifacts in Intra frames coming towards end of the title.
25
+
26
+API changes
27
+-----------
28
+1. New API function **x265_encoder_reconfig_zone()** to invoke zone reconfiguration dynamically.  
29
+2. Renamed :option:`--hdr` to :option:`--hdr10`. :option:`--hdr` will be deprecated in the upcoming major release. 
30
+3. Renamed :option:`--hdr-opt` to :option:`--hdr10-opt`. :option:`--hdr-opt` will be deprecated in the upcoming major release.
31
+4. Additions to **x265_param** structure to support the newly added features and encoder enhancements.
32
+
33
+Bug fixes
34
+---------
35
+1. Output change in :option:`--analysis-load` at inter-refine levels 2 and 3.
36
+2. Encoder crash with zones.
37
+3. Integration issues with SVT v1.4.1.
38
+4. Fixed bug in :option:`--limit-tu` 3 and 4 while loading co-located CU's TU depth.
39
+
40
 Version 3.2
41
 ===========
42
 
43
x265_3.2.1.tar.gz/doc/reST/svthevc.rst -> x265_3.3.tar.gz/doc/reST/svthevc.rst Changed
107
 
1
@@ -12,6 +12,10 @@
2
 wont't be mapped to SVT-HEVC. This document describes the steps needed to compile x265 
3
 with SVT-HEVC and CLI options mapping between x265 and SVT-HEVC.
4
 
5
+Supported Version
6
+=================
7
+Version - 1.4.1
8
+
9
 Build Steps
10
 ===========
11
 This section describes the build steps to be followed to link SVT-HEVC with x265.
12
@@ -109,7 +113,15 @@
13
 +-------------------------------------------+------------------------------+------------------------------+
14
 | :option:`--nalu-file`                     | NaluFile                     | Any String                   |
15
 +-------------------------------------------+------------------------------+------------------------------+
16
-| :option:`--tune` zerolatency              | LatencyMode                  |                              |
17
+| :option:`--hrd`                           | hrdFlag                      | [0, 1]                       |
18
++-------------------------------------------+------------------------------+------------------------------+
19
+| :option:`--vbv-maxrate`                   | vbvMaxrate                   | Any Positive Integer         |
20
++-------------------------------------------+------------------------------+------------------------------+
21
+| :option:`--vbv-bufsize`                   | vbvBufsize                   | Any Positive Integer         |
22
++-------------------------------------------+------------------------------+------------------------------+
23
+| :option:`--vbv-init`                      | VbvBufInit                   | [0 - 100]                    |
24
++-------------------------------------------+------------------------------+------------------------------+
25
+| :option:`--frame-threads`                 | ThreadCount                  | Any Number                   |
26
 +-------------------------------------------+------------------------------+------------------------------+
27
 | :option:`--svt-search-width`              | SearchAreaWidth              | [1 - 256]                    |
28
 +-------------------------------------------+------------------------------+------------------------------+
29
@@ -139,64 +151,37 @@
30
 fecilitate access to the features of SVT-HEVC which couldn't be mapped to the existing x265 CLI's. 
31
 So these options will have effect only if SVT-HEVC is enabled and would be ignored with default x265 encode.
32
 
33
-Preset & Tune Options Mapping
34
+Preset Option Mapping
35
 =============================
36
-x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 13 presets. Use :option:`--svt-preset-tuner` 
37
-with Placebo preset to access the additional 3 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be 
38
+x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 12 presets. Use :option:`--svt-preset-tuner` 
39
+with Placebo preset to access the additional 2 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be 
40
 used only if SVT-HEVC is enabled and only with Placebo preset, would be ignored otherwise. 
41
 Below table shows the actual mapping of presets,
42
 
43
 +----------------------------------------+------------------------------+
44
 | x265 Preset                            | SVT-HEVC Preset              |
45
 +========================================+==============================+
46
-| Ultrafast                              | 12                           |
47
+| Ultrafast                              | 11                           |
48
 +----------------------------------------+------------------------------+
49
-| Superfast                              | 11                           |
50
+| Superfast                              | 10                           |
51
 +----------------------------------------+------------------------------+
52
-| Veryfast                               | 10                           |
53
+| Veryfast                               | 9                            |
54
 +----------------------------------------+------------------------------+
55
-| Faster                                 | 9                            |
56
+| Faster                                 | 8                            |
57
 +----------------------------------------+------------------------------+
58
-| Fast                                   | 8                            |
59
+| Fast                                   | 7                            |
60
 +----------------------------------------+------------------------------+
61
-| Medium                                 | 7                            |
62
+| Medium                                 | 6                            |
63
 +----------------------------------------+------------------------------+
64
-| Slow                                   | 6                            |
65
+| Slow                                   | 5                            |
66
 +----------------------------------------+------------------------------+
67
-| Slower                                 | 5                            |
68
+| Slower                                 | 4                            |
69
 +----------------------------------------+------------------------------+
70
-| Veryslow                               | 4                            |
71
+| Veryslow                               | 3                            |
72
 +----------------------------------------+------------------------------+
73
-| Placebo                                | 3                            |
74
+| Placebo                                | 2                            |
75
 +----------------------------------------+------------------------------+
76
 | Placebo :option:`--svt-preset-tuner` 0 | 0                            |
77
 +----------------------------------------+------------------------------+
78
 | Placebo :option:`--svt-preset-tuner` 1 | 1                            |
79
 +----------------------------------------+------------------------------+
80
-| Placebo :option:`--svt-preset-tuner` 2 | 2                            |
81
-+----------------------------------------+------------------------------+
82
-
83
-x265 has 5 tune modes (psnr, ssim, grain, zero-latency, animation) whereas SVT-HEVC
84
-has only 3 tune modes (0 - visual quality, 1 - PSNR / SSIM and 2 - VMAF). Below 
85
-table shows the mapping of tune modes,
86
-
87
-+-----------------------+---------------------------+
88
-| x265 Tune Modes       | SVT-HEVC Tune Modes       |
89
-+=======================+===========================+
90
-| vmaf                  | 2                         |
91
-+-----------------------+---------------------------+
92
-| psnr                  | 1                         |
93
-+-----------------------+---------------------------+
94
-| ssim                  | 1                         |
95
-+-----------------------+---------------------------+
96
-| grain                 | 0                         |
97
-+-----------------------+---------------------------+
98
-| fastdecode            | 0                         |
99
-+-----------------------+---------------------------+
100
-| zerolatency           | 0                         |
101
-+-----------------------+---------------------------+
102
-| animation             | 0                         |
103
-+-----------------------+---------------------------+
104
-
105
-Note that : 1.option:`--tune` animation is also mapped to "LatencyMode" of SVT-HEVC.
106
-            2.option: '--tune' vmaf is not supported in x265, its under development.
107
x265_3.2.1.tar.gz/source/CMakeLists.txt -> x265_3.3.tar.gz/source/CMakeLists.txt Changed
20
 
1
@@ -29,7 +29,7 @@
2
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
3
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
4
 # X265_BUILD must be incremented each time the public API is changed
5
-set(X265_BUILD 179)
6
+set(X265_BUILD 188)
7
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
8
                "${PROJECT_BINARY_DIR}/x265.def")
9
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
10
@@ -573,8 +573,7 @@
11
 if(SVTHEVC_FOUND)
12
     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
13
     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
14
-    install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include)
15
-    install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})
16
+    install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${LIB_INSTALL_DIR})
17
 endif()
18
 
19
 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
20
x265_3.2.1.tar.gz/source/cmake/FindNuma.cmake -> x265_3.3.tar.gz/source/cmake/FindNuma.cmake Changed
10
 
1
@@ -14,7 +14,7 @@
2
 #   NUMA_LIBRARY
3
 #     Points to the libnuma that can be passed to target_link_libararies.
4
 #
5
-# Copyright (c) 2013-2017 MulticoreWare, Inc
6
+# Copyright (c) 2013-2020 MulticoreWare, Inc
7
 
8
 include(FindPackageHandleStandardArgs)
9
 
10
x265_3.2.1.tar.gz/source/cmake/FindVLD.cmake -> x265_3.3.tar.gz/source/cmake/FindVLD.cmake Changed
10
 
1
@@ -23,7 +23,7 @@
2
 #     target_link_libararies.
3
 #
4
 #
5
-# Copyright (c) 2013-2017 MulticoreWare, Inc
6
+# Copyright (c) 2013-2020 MulticoreWare, Inc
7
 #
8
 # Permission is hereby granted, free of charge, to any person obtaining a copy
9
 # of this software and associated documentation files (the "Software"), to deal
10
x265_3.2.1.tar.gz/source/cmake/FindVtune.cmake -> x265_3.3.tar.gz/source/cmake/FindVtune.cmake Changed
10
 
1
@@ -5,7 +5,7 @@
2
 #   VTUNE_INCLUDE_DIR: Points to the vtunes include dir
3
 #   VTUNE_LIBRARY_DIR: Points to the directory with libraries
4
 #
5
-# Copyright (c) 2013-2017 MulticoreWare, Inc
6
+# Copyright (c) 2013-2020 MulticoreWare, Inc
7
 
8
 include(FindPackageHandleStandardArgs)
9
 
10
x265_3.2.1.tar.gz/source/cmake/Findsvthevc.cmake -> x265_3.3.tar.gz/source/cmake/Findsvthevc.cmake Changed
60
 
1
@@ -15,34 +15,37 @@
2
 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
3
 endif()
4
 
5
-set(SVT_VERSION_MAJOR_REQUIRED 1)
6
-set(SVT_VERSION_MINOR_REQUIRED 3)
7
-set(SVT_VERSION_PATCHLEVEL_REQUIRED 0)
8
+set(SVT_VERSION_MAJOR_REQUIRED       1)
9
+set(SVT_VERSION_MINOR_REQUIRED       4)
10
+set(SVT_VERSION_PATCHLEVEL_REQUIRED  1)
11
 
12
 find_path(SVT_HEVC_INCLUDE_DIR
13
-    NAMES EbApi.h EbErrorCodes.h EbTime.h
14
+    NAMES EbApiVersion.h EbErrorCodes.h
15
     HINTS $ENV{SVT_HEVC_INCLUDE_DIR}
16
     PATHS ENV
17
     DOC "SVT-HEVC include directory")
18
 
19
 if(SVT_HEVC_INCLUDE_DIR)
20
-file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version)
21
-
22
-string(REGEX MATCH "SVT_VERSION_MAJOR       ([0-9]*)" _ ${version})
23
-set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})
24
-
25
-string(REGEX MATCH "SVT_VERSION_MINOR       ([0-9]*)" _ ${version})
26
-set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})
27
-
28
-string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  ([0-9]*)" _ ${version})
29
-set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})
30
-
31
-if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0")
32
-    message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")
33
-else()
34
-    message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
35
-endif()
36
-
37
+    if(EXISTS "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h")
38
+        file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h" version)
39
+
40
+        string(REGEX MATCH "SVT_VERSION_MAJOR       \\(([0-9]*)\\)" _ ${version})
41
+        set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})
42
+
43
+        string(REGEX MATCH "SVT_VERSION_MINOR       \\(([0-9]*)\\)" _ ${version})
44
+        set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})
45
+
46
+        string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  \\(([0-9]*)\\)" _ ${version})
47
+        set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})
48
+
49
+        if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "4" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "1")
50
+            message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")
51
+        else()
52
+            message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
53
+        endif()
54
+    else()
55
+        message (SEND_ERROR "-- Required version of SVT-HEVC Lib: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")
56
+    endif()
57
 endif()
58
 
59
 find_library(SVT_HEVC_LIBRARY
60
x265_3.2.1.tar.gz/source/common/arm/asm-primitives.cpp -> x265_3.3.tar.gz/source/common/arm/asm-primitives.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/asm.S -> x265_3.3.tar.gz/source/common/arm/asm.S Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * asm.S: arm utility macros
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Mans Rullgard <mans@mansr.com>
9
  *          David Conrad <lessen42@gmail.com>
10
x265_3.2.1.tar.gz/source/common/arm/blockcopy8.S -> x265_3.3.tar.gz/source/common/arm/blockcopy8.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Radhakrishnan VR <radhakrishnan@multicorewareinc.com>
7
  * 
8
x265_3.2.1.tar.gz/source/common/arm/blockcopy8.h -> x265_3.3.tar.gz/source/common/arm/blockcopy8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/arm/cpu-a.S -> x265_3.3.tar.gz/source/common/arm/cpu-a.S Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * cpu-a.S: arm cpu detection
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: David Conrad <lessen42@gmail.com>
9
  *          Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
10
x265_3.2.1.tar.gz/source/common/arm/dct-a.S -> x265_3.3.tar.gz/source/common/arm/dct-a.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <chenm003@163.com>
7
  * 
8
x265_3.2.1.tar.gz/source/common/arm/dct8.h -> x265_3.3.tar.gz/source/common/arm/dct8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <chenm003@163.com>
7
  *          Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/intrapred.h -> x265_3.3.tar.gz/source/common/arm/intrapred.h Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * intrapred.h: Intra Prediction metrics
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
9
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
10
x265_3.2.1.tar.gz/source/common/arm/ipfilter8.S -> x265_3.3.tar.gz/source/common/arm/ipfilter8.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
7
  *          Radhakrishnan VR <radhakrishnan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/ipfilter8.h -> x265_3.3.tar.gz/source/common/arm/ipfilter8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/loopfilter.h -> x265_3.3.tar.gz/source/common/arm/loopfilter.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
7
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/mc-a.S -> x265_3.3.tar.gz/source/common/arm/mc-a.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
7
  *          Radhakrishnan <radhakrishnan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/mc.h -> x265_3.3.tar.gz/source/common/arm/mc.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/arm/pixel-util.S -> x265_3.3.tar.gz/source/common/arm/pixel-util.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
7
  *          Radhakrishnan VR <radhakrishnan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/arm/pixel-util.h -> x265_3.3.tar.gz/source/common/arm/pixel-util.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
 ;*          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/arm/pixel.h -> x265_3.3.tar.gz/source/common/arm/pixel.h Changed
10
 
1
@@ -2,7 +2,7 @@
2
  * pixel.h: x86 pixel metrics
3
  *****************************************************************************
4
  * Copyright (C) 2003-2017 x265 project
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9
  *          Loren Merritt <lorenm@u.washington.edu>
10
x265_3.2.1.tar.gz/source/common/arm/sad-a.S -> x265_3.3.tar.gz/source/common/arm/sad-a.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: David Conrad <lessen42@gmail.com>
7
  *          Janne Grunau <janne-x264@jannau.net>
8
x265_3.2.1.tar.gz/source/common/arm/ssd-a.S -> x265_3.3.tar.gz/source/common/arm/ssd-a.S Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
7
  * 
8
x265_3.2.1.tar.gz/source/common/bitstream.h -> x265_3.3.tar.gz/source/common/bitstream.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Author: Steve Borho <steve@borho.org>
7
  *         Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/common.cpp -> x265_3.3.tar.gz/source/common/common.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/common.h -> x265_3.3.tar.gz/source/common/common.h Changed
23
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
  *          Min Chen <chenm003@163.com>
8
@@ -129,12 +129,14 @@
9
 typedef uint64_t sum2_t;
10
 typedef uint64_t pixel4;
11
 typedef int64_t  ssum2_t;
12
+#define HISTOGRAM_BINS 1024
13
 #else
14
 typedef uint8_t  pixel;
15
 typedef uint16_t sum_t;
16
 typedef uint32_t sum2_t;
17
 typedef uint32_t pixel4;
18
 typedef int32_t  ssum2_t; // Signed sum
19
+#define HISTOGRAM_BINS 256
20
 #endif // if HIGH_BIT_DEPTH
21
 
22
 #if X265_DEPTH < 10
23
x265_3.2.1.tar.gz/source/common/constants.cpp -> x265_3.3.tar.gz/source/common/constants.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/constants.h -> x265_3.3.tar.gz/source/common/constants.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/contexts.h -> x265_3.3.tar.gz/source/common/contexts.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/cpu.cpp -> x265_3.3.tar.gz/source/common/cpu.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Loren Merritt <lorenm@u.washington.edu>
7
  *          Laurent Aimar <fenrir@via.ecp.fr>
8
x265_3.2.1.tar.gz/source/common/cpu.h -> x265_3.3.tar.gz/source/common/cpu.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Loren Merritt <lorenm@u.washington.edu>
7
  *          Steve Borho <steve@borho.org>
8
x265_3.2.1.tar.gz/source/common/cudata.cpp -> x265_3.3.tar.gz/source/common/cudata.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/cudata.h -> x265_3.3.tar.gz/source/common/cudata.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/dct.cpp -> x265_3.3.tar.gz/source/common/dct.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Mandar Gurav <mandar@multicorewareinc.com>
7
  *          Deepthi Devaki Akkoorath <deepthidevaki@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/deblock.cpp -> x265_3.3.tar.gz/source/common/deblock.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
 *         Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/deblock.h -> x265_3.3.tar.gz/source/common/deblock.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
 *         Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/frame.cpp -> x265_3.3.tar.gz/source/common/frame.cpp Changed
16
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Steve Borho <steve@borho.org>
7
 *         Min Chen <chenm003@163.com>
8
@@ -57,6 +57,7 @@
9
     m_addOnPrevChange = NULL;
10
     m_classifyFrame = false;
11
     m_fieldNum = 0;
12
+    m_picStruct = 0;
13
     m_edgePic = NULL;
14
     m_gaussianPic = NULL;
15
     m_thetaPic = NULL;
16
x265_3.2.1.tar.gz/source/common/frame.h -> x265_3.3.tar.gz/source/common/frame.h Changed
16
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Steve Borho <steve@borho.org>
7
 *         Min Chen <chenm003@163.com>
8
@@ -98,6 +98,7 @@
9
 
10
     float*                 m_quantOffsets;       // points to quantOffsets in x265_picture
11
     x265_sei               m_userSEI;
12
+    uint32_t               m_picStruct;          // picture structure SEI message
13
     x265_dolby_vision_rpu            m_rpu;
14
 
15
     /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */
16
x265_3.2.1.tar.gz/source/common/framedata.cpp -> x265_3.3.tar.gz/source/common/framedata.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Steve Borho <steve@borho.org>
7
 *
8
x265_3.2.1.tar.gz/source/common/framedata.h -> x265_3.3.tar.gz/source/common/framedata.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Author: Steve Borho <steve@borho.org>
7
 *
8
x265_3.2.1.tar.gz/source/common/intrapred.cpp -> x265_3.3.tar.gz/source/common/intrapred.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <chenm003@163.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/ipfilter.cpp -> x265_3.3.tar.gz/source/common/ipfilter.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>,
7
  *          Rajesh Paulraj <rajesh@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/loopfilter.cpp -> x265_3.3.tar.gz/source/common/loopfilter.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com>
7
 *          Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/lowres.cpp -> x265_3.3.tar.gz/source/common/lowres.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
  *          Ashok Kumar Mishra <ashok@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/lowres.h -> x265_3.3.tar.gz/source/common/lowres.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/md5.cpp -> x265_3.3.tar.gz/source/common/md5.cpp Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * md5.cpp: Calculate MD5 for SEI
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Min Chen <chenm003@163.com>
9
  *
10
x265_3.2.1.tar.gz/source/common/md5.h -> x265_3.3.tar.gz/source/common/md5.h Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * md5.h: Calculate MD5
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Min Chen <chenm003@163.com>
9
  *
10
x265_3.2.1.tar.gz/source/common/mv.h -> x265_3.3.tar.gz/source/common/mv.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/param.cpp -> x265_3.3.tar.gz/source/common/param.cpp Changed
561
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
@@ -135,6 +135,7 @@
9
 
10
     /* Source specifications */
11
     param->internalBitDepth = X265_DEPTH;
12
+    param->sourceBitDepth = 8;
13
     param->internalCsp = X265_CSP_I420;
14
     param->levelIdc = 0; //Auto-detect level
15
     param->uhdBluray = 0;
16
@@ -146,7 +147,8 @@
17
     param->bEnableAccessUnitDelimiters = 0;
18
     param->bEmitHRDSEI = 0;
19
     param->bEmitInfoSEI = 1;
20
-    param->bEmitHDRSEI = 0;
21
+    param->bEmitHDRSEI = 0; /*Deprecated*/
22
+    param->bEmitHDR10SEI = 0;
23
     param->bEmitIDRRecoverySEI = 0;
24
 
25
     /* CU definitions */
26
@@ -166,6 +168,8 @@
27
     param->bFrameAdaptive = X265_B_ADAPT_TRELLIS;
28
     param->bBPyramid = 1;
29
     param->scenecutThreshold = 40; /* Magic number pulled in from x264 */
30
+    param->edgeTransitionThreshold = 0.01;
31
+    param->bHistBasedSceneCut = 0;
32
     param->lookaheadSlices = 8;
33
     param->lookaheadThreads = 0;
34
     param->scenecutBias = 5.0;
35
@@ -174,6 +178,9 @@
36
     param->chunkEnd = 0;
37
     param->bEnableHRDConcatFlag = 0;
38
     param->bEnableFades = 0;
39
+    param->bEnableSceneCutAwareQp = 0;
40
+    param->scenecutWindow = 500;
41
+    param->maxQpDelta = 5;
42
 
43
     /* Intra Coding Tools */
44
     param->bEnableConstrainedIntra = 0;
45
@@ -204,6 +211,9 @@
46
     param->bEnableHME = 0;
47
     param->hmeSearchMethod[0] = X265_HEX_SEARCH;
48
     param->hmeSearchMethod[1] = param->hmeSearchMethod[2] = X265_UMH_SEARCH;
49
+    param->hmeRange[0] = 16;
50
+    param->hmeRange[1] = 32;
51
+    param->hmeRange[2] = 48;
52
     param->bSourceReferenceEstimation = 0;
53
     param->limitTU = 0;
54
     param->dynamicRd = 0;
55
@@ -273,6 +283,8 @@
56
     param->rc.qpMin = 0;
57
     param->rc.qpMax = QP_MAX_MAX;
58
     param->rc.bEnableConstVbv = 0;
59
+    param->bResetZoneConfig = 1;
60
+    param->reconfigWindowSize = 0;
61
 
62
     /* Video Usability Information (VUI) */
63
     param->vui.aspectRatioIdc = 0;
64
@@ -301,14 +313,21 @@
65
     param->log2MaxPocLsb = 8;
66
     param->maxSlices = 1;
67
 
68
+    /*Conformance window*/
69
+    param->confWinRightOffset = 0;
70
+    param->confWinBottomOffset = 0;
71
+
72
     param->bEmitVUITimingInfo   = 1;
73
     param->bEmitVUIHRDInfo      = 1;
74
     param->bOptQpPPS            = 0;
75
     param->bOptRefListLengthPPS = 0;
76
     param->bOptCUDeltaQP        = 0;
77
     param->bAQMotion = 0;
78
-    param->bHDROpt = 0;
79
-    param->analysisReuseLevel = 5;
80
+    param->bHDROpt = 0; /*DEPRECATED*/
81
+    param->bHDR10Opt = 0;
82
+    param->analysisReuseLevel = 0;  /*DEPRECATED*/
83
+    param->analysisSaveReuseLevel = 0;
84
+    param->analysisLoadReuseLevel = 0;
85
     param->toneMapFile = NULL;
86
     param->bDhdr10opt = 0;
87
     param->dolbyProfile = 0;
88
@@ -338,6 +357,9 @@
89
     param->pictureStructure = -1;
90
     param->bEmitCLL = 1;
91
 
92
+    param->bEnableFrameDuplication = 0;
93
+    param->dupThreshold = 70;
94
+
95
     /* SVT Hevc Encoder specific params */
96
     param->bEnableSvtHevc = 0;
97
     param->svtHevcParam = NULL;
98
@@ -563,6 +585,7 @@
99
             param->bframes = 0;
100
             param->lookaheadDepth = 0;
101
             param->scenecutThreshold = 0;
102
+            param->bHistBasedSceneCut = 0;
103
             param->rc.cuTree = 0;
104
             param->frameNumThreads = 1;
105
         }
106
@@ -598,7 +621,7 @@
107
     }
108
 
109
 #ifdef SVT_HEVC
110
-    if (svt_set_preset_tune(param, preset, tune))
111
+    if (svt_set_preset(param, preset))
112
         return -1;
113
 #endif
114
 
115
@@ -911,12 +934,13 @@
116
     OPT("lookahead-slices") p->lookaheadSlices = atoi(value);
117
     OPT("scenecut")
118
     {
119
-        p->scenecutThreshold = atobool(value);
120
-        if (bError || p->scenecutThreshold)
121
-        {
122
-            bError = false;
123
-            p->scenecutThreshold = atoi(value);
124
-        }
125
+       p->scenecutThreshold = atobool(value);
126
+       if (bError || p->scenecutThreshold)
127
+       {
128
+           bError = false;
129
+           p->scenecutThreshold = atoi(value);
130
+           p->bHistBasedSceneCut = 0;
131
+       }
132
     }
133
     OPT("temporal-layers") p->bEnableTemporalSubLayers = atobool(value);
134
     OPT("keyint") p->keyframeMax = atoi(value);
135
@@ -1182,13 +1206,35 @@
136
         OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS = atobool(value);
137
         OPT("multi-pass-opt-rps") p->bMultiPassOptRPS = atobool(value);
138
         OPT("scenecut-bias") p->scenecutBias = atof(value);
139
+        OPT("hist-scenecut")
140
+        {
141
+            p->bHistBasedSceneCut = atobool(value);
142
+            if (bError)
143
+            {
144
+                bError = false;
145
+                p->bHistBasedSceneCut = 0;
146
+            }
147
+            if (p->bHistBasedSceneCut)
148
+            {
149
+                bError = false;
150
+                p->scenecutThreshold = 0;
151
+            }
152
+        }
153
+        OPT("hist-threshold") p->edgeTransitionThreshold = atof(value);
154
         OPT("lookahead-threads") p->lookaheadThreads = atoi(value);
155
         OPT("opt-cu-delta-qp") p->bOptCUDeltaQP = atobool(value);
156
         OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine = atobool(value);
157
         OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = atobool(value);
158
         OPT("aq-motion") p->bAQMotion = atobool(value);
159
         OPT("dynamic-rd") p->dynamicRd = atof(value);
160
-        OPT("analysis-reuse-level") p->analysisReuseLevel = atoi(value);
161
+        OPT("analysis-reuse-level")
162
+        {
163
+            p->analysisReuseLevel = atoi(value);
164
+            p->analysisSaveReuseLevel = atoi(value);
165
+            p->analysisLoadReuseLevel = atoi(value);
166
+        }
167
+        OPT("analysis-save-reuse-level") p->analysisSaveReuseLevel = atoi(value);
168
+        OPT("analysis-load-reuse-level") p->analysisLoadReuseLevel = atoi(value);
169
         OPT("ssim-rd")
170
         {
171
             int bval = atobool(value);
172
@@ -1199,8 +1245,10 @@
173
                 p->bSsimRd = atobool(value);
174
             }
175
         }
176
-        OPT("hdr") p->bEmitHDRSEI = atobool(value);
177
-        OPT("hdr-opt") p->bHDROpt = atobool(value);
178
+        OPT("hdr") p->bEmitHDR10SEI = atobool(value);  /*DEPRECATED*/
179
+        OPT("hdr10") p->bEmitHDR10SEI = atobool(value);
180
+        OPT("hdr-opt") p->bHDR10Opt = atobool(value); /*DEPRECATED*/
181
+        OPT("hdr10-opt") p->bHDR10Opt = atobool(value);
182
         OPT("limit-sao") p->bLimitSAO = atobool(value);
183
         OPT("dhdr10-info") p->toneMapFile = strdup(value);
184
         OPT("dhdr10-opt") p->bDhdr10opt = atobool(value);
185
@@ -1229,7 +1277,7 @@
186
             }
187
             else if (strcmp(strdup(value), "off") == 0)
188
             {
189
-                p->bAnalysisType = NO_INFO;
190
+                p->bAnalysisType = DEFAULT;
191
             }
192
             else
193
             {
194
@@ -1288,8 +1336,13 @@
195
             p->selectiveSAO = atoi(value);
196
         }
197
         OPT("fades") p->bEnableFades = atobool(value);
198
+        OPT("scenecut-aware-qp") p->bEnableSceneCutAwareQp = atobool(value);
199
+        OPT("scenecut-window") p->scenecutWindow = atoi(value);
200
+        OPT("max-qp-delta") p->maxQpDelta = atoi(value);
201
         OPT("field") p->bField = atobool( value );
202
         OPT("cll") p->bEmitCLL = atobool(value);
203
+        OPT("frame-dup") p->bEnableFrameDuplication = atobool(value);
204
+        OPT("dup-threshold") p->dupThreshold = atoi(value);
205
         OPT("hme") p->bEnableHME = atobool(value);
206
         OPT("hme-search")
207
         {
208
@@ -1311,6 +1364,11 @@
209
             }
210
             p->bEnableHME = true;
211
         }
212
+        OPT("hme-range")
213
+        {
214
+            sscanf(value, "%d,%d,%d", &p->hmeRange[0], &p->hmeRange[1], &p->hmeRange[2]);
215
+            p->bEnableHME = true;
216
+        }
217
         else
218
             return X265_PARAM_BAD_NAME;
219
     }
220
@@ -1618,7 +1676,9 @@
221
     CHECK(param->scenecutThreshold < 0,
222
           "scenecutThreshold must be greater than 0");
223
     CHECK(param->scenecutBias < 0 || 100 < param->scenecutBias,
224
-           "scenecut-bias must be between 0 and 100");
225
+            "scenecut-bias must be between 0 and 100");
226
+    CHECK(param->edgeTransitionThreshold < 0.0 || 2.0 < param->edgeTransitionThreshold,
227
+            "hist-threshold must be between 0.0 and 2.0");
228
     CHECK(param->radl < 0 || param->radl > param->bframes,
229
           "radl must be between 0 and bframes");
230
     CHECK(param->rdPenalty < 0 || param->rdPenalty > 2,
231
@@ -1653,8 +1713,10 @@
232
           "Constant QP is incompatible with 2pass");
233
     CHECK(param->rc.bStrictCbr && (param->rc.bitrate <= 0 || param->rc.vbvBufferSize <=0),
234
           "Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize");
235
-    CHECK((param->analysisSave || param->analysisLoad) && (param->analysisReuseLevel < 1 || param->analysisReuseLevel > 10),
236
-        "Invalid analysis refine level. Value must be between 1 and 10 (inclusive)");
237
+    CHECK(param->analysisSave && (param->analysisSaveReuseLevel < 0 || param->analysisSaveReuseLevel > 10),
238
+        "Invalid analysis save refine level. Value must be between 1 and 10 (inclusive)");
239
+    CHECK(param->analysisLoad && (param->analysisLoadReuseLevel < 0 || param->analysisLoadReuseLevel > 10),
240
+        "Invalid analysis load refine level. Value must be between 1 and 10 (inclusive)");
241
     CHECK(param->analysisLoad && (param->mvRefine < 1 || param->mvRefine > 3),
242
         "Invalid mv refinement level. Value must be between 1 and 3 (inclusive)");
243
     CHECK(param->scaleFactor > 2, "Invalid scale-factor. Supports factor <= 2");
244
@@ -1676,6 +1738,8 @@
245
         "Supported factor for controlling max AU size is from 0.5 to 1");
246
     CHECK((param->dolbyProfile != 0) && (param->dolbyProfile != 50) && (param->dolbyProfile != 81) && (param->dolbyProfile != 82),
247
         "Unsupported Dolby Vision profile, only profile 5, profile 8.1 and profile 8.2 enabled");
248
+    CHECK(param->dupThreshold < 1 || 99 < param->dupThreshold,
249
+        "Invalid frame-duplication threshold. Value must be between 1 and 99.");
250
     if (param->dolbyProfile)
251
     {
252
         CHECK((param->rc.vbvMaxBitrate <= 0 || param->rc.vbvBufferSize <= 0), "Dolby Vision requires VBV settings to enable HRD.\n");
253
@@ -1693,18 +1757,25 @@
254
     }
255
     CHECK(param->selectiveSAO < 0 || param->selectiveSAO > 4,
256
         "Invalid SAO tune level. Value must be between 0 and 4 (inclusive)");
257
+    CHECK(param->scenecutWindow < 0 || param->scenecutWindow > 1000,
258
+        "Invalid scenecut Window duration. Value must be between 0 and 1000(inclusive)");
259
+    CHECK(param->maxQpDelta < 0 || param->maxQpDelta > 10,
260
+        "Invalid maxQpDelta value. Value must be between 0 and 10 (inclusive)");
261
+    for(int level = 0; level < 3; level++)
262
+        CHECK(param->hmeRange[level] < 0 || param->hmeRange[level] >= 32768,
263
+            "Search Range for HME levels must be between 0 and 32768");
264
 #if !X86_64
265
     CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 || param->sourceHeight > 480),
266
         "SEA motion search does not support resolutions greater than 480p in 32 bit build");
267
 #endif
268
 
269
     if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
270
-        param->bEmitHDRSEI = 1;
271
+        param->bEmitHDR10SEI = 1;
272
 
273
     bool isSingleSEI = (param->bRepeatHeaders
274
                      || param->bEmitHRDSEI
275
                      || param->bEmitInfoSEI
276
-                     || param->bEmitHDRSEI
277
+                     || param->bEmitHDR10SEI
278
                      || param->bEmitIDRRecoverySEI
279
                    || !!param->interlaceMode
280
                      || param->preferredTransferCharacteristics > 1
281
@@ -1716,6 +1787,8 @@
282
         param->bSingleSeiNal = 0;
283
         x265_log(param, X265_LOG_WARNING, "None of the SEI messages are enabled. Disabling Single SEI NAL\n");
284
     }
285
+    CHECK(param->confWinRightOffset < 0, "Conformance Window Right Offset must be 0 or greater");
286
+    CHECK(param->confWinBottomOffset < 0, "Conformance Window Bottom Offset must be 0 or greater");
287
     return check_failed;
288
 }
289
 
290
@@ -1772,9 +1845,13 @@
291
         x265_log(param, X265_LOG_INFO, "ME / range / subpel / merge         : %s / %d / %d / %d\n",
292
             x265_motion_est_names[param->searchMethod], param->searchRange, param->subpelRefine, param->maxNumMergeCand);
293
 
294
-    if (param->keyframeMax != INT_MAX || param->scenecutThreshold)
295
-        x265_log(param, X265_LOG_INFO, "Keyframe min / max / scenecut / bias: %d / %d / %d / %.2lf\n", param->keyframeMin, param->keyframeMax, param->scenecutThreshold, param->scenecutBias * 100);
296
-    else
297
+    if (param->scenecutThreshold && param->keyframeMax != INT_MAX) 
298
+        x265_log(param, X265_LOG_INFO, "Keyframe min / max / scenecut / bias  : %d / %d / %d / %.2lf \n",
299
+                 param->keyframeMin, param->keyframeMax, param->scenecutThreshold, param->scenecutBias * 100);
300
+    else if (param->bHistBasedSceneCut && param->keyframeMax != INT_MAX) 
301
+        x265_log(param, X265_LOG_INFO, "Keyframe min / max / scenecut / edge threshold  : %d / %d / %d / %.2lf\n",
302
+                 param->keyframeMin, param->keyframeMax, param->bHistBasedSceneCut, param->edgeTransitionThreshold);
303
+    else if (param->keyframeMax == INT_MAX)
304
         x265_log(param, X265_LOG_INFO, "Keyframe min / max / scenecut       : disabled\n");
305
 
306
     if (param->cbQpOffset || param->crQpOffset)
307
@@ -1941,6 +2018,7 @@
308
     s += sprintf(s, " rc-lookahead=%d", p->lookaheadDepth);
309
     s += sprintf(s, " lookahead-slices=%d", p->lookaheadSlices);
310
     s += sprintf(s, " scenecut=%d", p->scenecutThreshold);
311
+    s += sprintf(s, " hist-scenecut=%d", p->bHistBasedSceneCut);
312
     s += sprintf(s, " radl=%d", p->radl);
313
     BOOL(p->bEnableHRDConcatFlag, "splice");
314
     BOOL(p->bIntraRefresh, "intra-refresh");
315
@@ -1968,9 +2046,15 @@
316
     s += sprintf(s, " subme=%d", p->subpelRefine);
317
     s += sprintf(s, " merange=%d", p->searchRange);
318
     BOOL(p->bEnableTemporalMvp, "temporal-mvp");
319
+    BOOL(p->bEnableFrameDuplication, "frame-dup");
320
+    if(p->bEnableFrameDuplication)
321
+        s += sprintf(s, " dup-threshold=%d", p->dupThreshold);
322
     BOOL(p->bEnableHME, "hme");
323
     if (p->bEnableHME)
324
+    {
325
         s += sprintf(s, " Level 0,1,2=%d,%d,%d", p->hmeSearchMethod[0], p->hmeSearchMethod[1], p->hmeSearchMethod[2]);
326
+        s += sprintf(s, " merange L0,L1,L2=%d,%d,%d", p->hmeRange[0], p->hmeRange[1], p->hmeRange[2]);
327
+    }
328
     BOOL(p->bEnableWeightedPred, "weightp");
329
     BOOL(p->bEnableWeightedBiPred, "weightb");
330
     BOOL(p->bSourceReferenceEstimation, "analyze-src-pics");
331
@@ -2085,10 +2169,11 @@
332
     BOOL(p->bOptRefListLengthPPS, "opt-ref-list-length-pps");
333
     BOOL(p->bMultiPassOptRPS, "multi-pass-opt-rps");
334
     s += sprintf(s, " scenecut-bias=%.2f", p->scenecutBias);
335
+    s += sprintf(s, " hist-threshold=%.2f", p->edgeTransitionThreshold);
336
     BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");
337
     BOOL(p->bAQMotion, "aq-motion");
338
-    BOOL(p->bEmitHDRSEI, "hdr");
339
-    BOOL(p->bHDROpt, "hdr-opt");
340
+    BOOL(p->bEmitHDR10SEI, "hdr10");
341
+    BOOL(p->bHDR10Opt, "hdr10-opt");
342
     BOOL(p->bDhdr10opt, "dhdr10-opt");
343
     BOOL(p->bEmitIDRRecoverySEI, "idr-recovery-sei");
344
     if (p->analysisSave)
345
@@ -2096,6 +2181,8 @@
346
     if (p->analysisLoad)
347
         s += sprintf(s, " analysis-load");
348
     s += sprintf(s, " analysis-reuse-level=%d", p->analysisReuseLevel);
349
+    s += sprintf(s, " analysis-save-reuse-level=%d", p->analysisSaveReuseLevel);
350
+    s += sprintf(s, " analysis-load-reuse-level=%d", p->analysisLoadReuseLevel);
351
     s += sprintf(s, " scale-factor=%d", p->scaleFactor);
352
     s += sprintf(s, " refine-intra=%d", p->intraRefine);
353
     s += sprintf(s, " refine-inter=%d", p->interRefine);
354
@@ -2113,6 +2200,10 @@
355
     BOOL(p->bEnableSvtHevc, "svt");
356
     BOOL(p->bField, "field");
357
     s += sprintf(s, " qp-adaptation-range=%.2f", p->rc.qpAdaptationRange);
358
+    BOOL(p->bEnableSceneCutAwareQp, "scenecut-aware-qp");
359
+    if (p->bEnableSceneCutAwareQp)
360
+        s += sprintf(s, " scenecut-window=%d max-qp-delta=%d", p->scenecutWindow, p->maxQpDelta);
361
+    s += sprintf(s, "conformance-window-offsets right=%d bottom=%d", p->confWinRightOffset, p->confWinBottomOffset);
362
 #undef BOOL
363
     return buf;
364
 }
365
@@ -2205,6 +2296,7 @@
366
     if (src->csvfn) dst->csvfn = strdup(src->csvfn);
367
     else dst->csvfn = NULL;
368
     dst->internalBitDepth = src->internalBitDepth;
369
+    dst->sourceBitDepth = src->sourceBitDepth;
370
     dst->internalCsp = src->internalCsp;
371
     dst->fpsNum = src->fpsNum;
372
     dst->fpsDenom = src->fpsDenom;
373
@@ -2234,6 +2326,7 @@
374
     dst->lookaheadSlices = src->lookaheadSlices;
375
     dst->lookaheadThreads = src->lookaheadThreads;
376
     dst->scenecutThreshold = src->scenecutThreshold;
377
+    dst->bHistBasedSceneCut = src->bHistBasedSceneCut;
378
     dst->bIntraRefresh = src->bIntraRefresh;
379
     dst->maxCUSize = src->maxCUSize;
380
     dst->minCUSize = src->minCUSize;
381
@@ -2259,11 +2352,16 @@
382
     dst->subpelRefine = src->subpelRefine;
383
     dst->searchRange = src->searchRange;
384
     dst->bEnableTemporalMvp = src->bEnableTemporalMvp;
385
+    dst->bEnableFrameDuplication = src->bEnableFrameDuplication;
386
+    dst->dupThreshold = src->dupThreshold;
387
     dst->bEnableHME = src->bEnableHME;
388
     if (src->bEnableHME)
389
     {
390
         for (int level = 0; level < 3; level++)
391
+        {
392
             dst->hmeSearchMethod[level] = src->hmeSearchMethod[level];
393
+            dst->hmeRange[level] = src->hmeRange[level];
394
+        }
395
     }
396
     dst->bEnableWeightedBiPred = src->bEnableWeightedBiPred;
397
     dst->bEnableWeightedPred = src->bEnableWeightedPred;
398
@@ -2319,6 +2417,8 @@
399
     dst->rc.bEnableSlowFirstPass = src->rc.bEnableSlowFirstPass;
400
     dst->rc.zoneCount = src->rc.zoneCount;
401
     dst->rc.zonefileCount = src->rc.zonefileCount;
402
+    dst->reconfigWindowSize = src->reconfigWindowSize;
403
+    dst->bResetZoneConfig = src->bResetZoneConfig;
404
 
405
     if (src->rc.zonefileCount && src->rc.zones)
406
     {
407
@@ -2389,6 +2489,7 @@
408
     dst->bOptRefListLengthPPS = src->bOptRefListLengthPPS;
409
     dst->bMultiPassOptRPS = src->bMultiPassOptRPS;
410
     dst->scenecutBias = src->scenecutBias;
411
+    dst->edgeTransitionThreshold = src->edgeTransitionThreshold;
412
     dst->gopLookahead = src->lookaheadDepth;
413
     dst->bOptCUDeltaQP = src->bOptCUDeltaQP;
414
     dst->analysisMultiPassDistortion = src->analysisMultiPassDistortion;
415
@@ -2396,10 +2497,13 @@
416
     dst->bAQMotion = src->bAQMotion;
417
     dst->bSsimRd = src->bSsimRd;
418
     dst->dynamicRd = src->dynamicRd;
419
-    dst->bEmitHDRSEI = src->bEmitHDRSEI;
420
+    dst->bEmitHDR10SEI = src->bEmitHDR10SEI;
421
     dst->bEmitHRDSEI = src->bEmitHRDSEI;
422
-    dst->bHDROpt = src->bHDROpt;
423
+    dst->bHDROpt = src->bHDROpt; /*DEPRECATED*/
424
+    dst->bHDR10Opt = src->bHDR10Opt;
425
     dst->analysisReuseLevel = src->analysisReuseLevel;
426
+    dst->analysisSaveReuseLevel = src->analysisSaveReuseLevel;
427
+    dst->analysisLoadReuseLevel = src->analysisLoadReuseLevel;
428
     dst->bLimitSAO = src->bLimitSAO;
429
     if (src->toneMapFile) dst->toneMapFile = strdup(src->toneMapFile);
430
     else dst->toneMapFile = NULL;
431
@@ -2445,8 +2549,13 @@
432
     dst->dolbyProfile = src->dolbyProfile;
433
     dst->bEnableSvtHevc = src->bEnableSvtHevc;
434
     dst->bEnableFades = src->bEnableFades;
435
+    dst->bEnableSceneCutAwareQp = src->bEnableSceneCutAwareQp;
436
+    dst->scenecutWindow = src->scenecutWindow;
437
+    dst->maxQpDelta = src->maxQpDelta;
438
     dst->bField = src->bField;
439
 
440
+    dst->confWinRightOffset = src->confWinRightOffset;
441
+    dst->confWinBottomOffset = src->confWinBottomOffset;
442
 #ifdef SVT_HEVC
443
     memcpy(dst->svtHevcParam, src->svtHevcParam, sizeof(EB_H265_ENC_CONFIGURATION));
444
 #endif
445
@@ -2473,8 +2582,8 @@
446
     svtHevcParam->latencyMode = 0;
447
 
448
     //Preset & Tune
449
-    svtHevcParam->encMode = 9;
450
-    svtHevcParam->tune = 0;
451
+    svtHevcParam->encMode = 7;
452
+    svtHevcParam->tune = 1;
453
 
454
     // Interlaced Video 
455
     svtHevcParam->interlacedVideo = 0;
456
@@ -2514,10 +2623,10 @@
457
     svtHevcParam->targetBitRate = 7000000;
458
     svtHevcParam->maxQpAllowed = 48;
459
     svtHevcParam->minQpAllowed = 10;
460
-    svtHevcParam->bitRateReduction = 1;
461
+    svtHevcParam->bitRateReduction = 0;
462
 
463
     // Thresholds
464
-    svtHevcParam->improveSharpness = 1;
465
+    svtHevcParam->improveSharpness = 0;
466
     svtHevcParam->videoUsabilityInfo = 0;
467
     svtHevcParam->highDynamicRangeInput = 0;
468
     svtHevcParam->accessUnitDelimiter = 0;
469
@@ -2527,7 +2636,7 @@
470
     svtHevcParam->unregisteredUserDataSeiFlag = 0;
471
     svtHevcParam->recoveryPointSeiFlag = 0;
472
     svtHevcParam->enableTemporalId = 1;
473
-    svtHevcParam->profile = 2;
474
+    svtHevcParam->profile = 1;
475
     svtHevcParam->tier = 0;
476
     svtHevcParam->level = 0;
477
 
478
@@ -2558,34 +2667,31 @@
479
     svtHevcParam->tileRowCount = 1;
480
     svtHevcParam->tileSliceMode = 0;
481
     svtHevcParam->unrestrictedMotionVector = 1;
482
+    svtHevcParam->threadCount = 0;
483
+
484
+    // vbv
485
+    svtHevcParam->hrdFlag = 0;
486
+    svtHevcParam->vbvMaxrate = 0;
487
+    svtHevcParam->vbvBufsize = 0;
488
+    svtHevcParam->vbvBufInit = 90;
489
 }
490
 
491
-int svt_set_preset_tune(x265_param* param, const char* preset, const char* tune)
492
+int svt_set_preset(x265_param* param, const char* preset)
493
 {
494
     EB_H265_ENC_CONFIGURATION* svtHevcParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam;
495
     
496
     if (preset)
497
     {
498
-        if (!strcmp(preset, "ultrafast")) svtHevcParam->encMode = 12;
499
-        else if (!strcmp(preset, "superfast")) svtHevcParam->encMode = 11;
500
-        else if (!strcmp(preset, "veryfast")) svtHevcParam->encMode = 10;
501
-        else if (!strcmp(preset, "faster")) svtHevcParam->encMode = 9;
502
-        else if (!strcmp(preset, "fast")) svtHevcParam->encMode = 8;
503
-        else if (!strcmp(preset, "medium")) svtHevcParam->encMode = 7;
504
-        else if (!strcmp(preset, "slow")) svtHevcParam->encMode = 6;
505
-        else if (!strcmp(preset, "slower")) svtHevcParam->encMode = 5;
506
-        else if (!strcmp(preset, "veryslow")) svtHevcParam->encMode = 4;
507
-        else if (!strcmp(preset, "placebo")) svtHevcParam->encMode = 3;
508
-        else  return -1;
509
-    }
510
-    if (tune)
511
-    {
512
-        if (!strcmp(tune, "psnr")) svtHevcParam->tune = 1;
513
-        else if (!strcmp(tune, "ssim")) svtHevcParam->tune = 1;
514
-        else if (!strcmp(tune, "grain")) svtHevcParam->tune = 0;
515
-        else if (!strcmp(tune, "animation")) svtHevcParam->tune = 0;
516
-        else if (!strcmp(tune, "vmaf")) svtHevcParam->tune = 2;
517
-        else if (!strcmp(tune, "zero-latency") || !strcmp(tune, "zerolatency")) svtHevcParam->latencyMode = 1;
518
+        if (!strcmp(preset, "ultrafast")) svtHevcParam->encMode = 11;
519
+        else if (!strcmp(preset, "superfast")) svtHevcParam->encMode = 10;
520
+        else if (!strcmp(preset, "veryfast")) svtHevcParam->encMode = 9;
521
+        else if (!strcmp(preset, "faster")) svtHevcParam->encMode = 8;
522
+        else if (!strcmp(preset, "fast")) svtHevcParam->encMode = 7;
523
+        else if (!strcmp(preset, "medium")) svtHevcParam->encMode = 6;
524
+        else if (!strcmp(preset, "slow")) svtHevcParam->encMode = 5;
525
+        else if (!strcmp(preset, "slower")) svtHevcParam->encMode =4;
526
+        else if (!strcmp(preset, "veryslow")) svtHevcParam->encMode = 3;
527
+        else if (!strcmp(preset, "placebo")) svtHevcParam->encMode = 2;
528
         else  return -1;
529
     }
530
     return 0;
531
@@ -2740,11 +2846,10 @@
532
     OPT("svt-speed-control") svtHevcParam->speedControlFlag = x265_atobool(value, bError);
533
     OPT("svt-preset-tuner")
534
     {
535
-        if (svtHevcParam->encMode == 3)
536
+        if (svtHevcParam->encMode == 2)
537
         {
538
             if (!strcmp(value, "0")) svtHevcParam->encMode = 0;
539
             else if (!strcmp(value, "1")) svtHevcParam->encMode = 1;
540
-            else if (!strcmp(value, "2")) svtHevcParam->encMode = 2;
541
             else
542
             {
543
                 x265_log(param, X265_LOG_ERROR, " Unsupported value=%s for svt-preset-tuner \n", value);
544
@@ -2770,6 +2875,16 @@
545
         else
546
             bError = true;
547
     }
548
+    OPT("hrd")
549
+        svtHevcParam->hrdFlag = (uint32_t)x265_atobool(value, bError);
550
+    OPT("vbv-maxrate")
551
+        svtHevcParam->vbvMaxrate = (uint32_t)x265_atoi(value, bError);
552
+    OPT("vbv-bufsize")
553
+        svtHevcParam->vbvBufsize = (uint32_t)x265_atoi(value, bError);
554
+    OPT("vbv-init")
555
+        svtHevcParam->vbvBufInit = (uint64_t)x265_atof(value, bError);
556
+    OPT("frame-threads")
557
+        svtHevcParam->threadCount = (uint32_t)x265_atoi(value, bError);
558
     else
559
         x265_log(param, X265_LOG_INFO, "SVT doesn't support %s param; Disabling it \n", name);
560
 
561
x265_3.2.1.tar.gz/source/common/param.h -> x265_3.3.tar.gz/source/common/param.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/piclist.cpp -> x265_3.3.tar.gz/source/common/piclist.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/piclist.h -> x265_3.3.tar.gz/source/common/piclist.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/picyuv.cpp -> x265_3.3.tar.gz/source/common/picyuv.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/picyuv.h -> x265_3.3.tar.gz/source/common/picyuv.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/pixel.cpp -> x265_3.3.tar.gz/source/common/pixel.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/ppc/dct_altivec.cpp -> x265_3.3.tar.gz/source/common/ppc/dct_altivec.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Roger Moussalli <rmoussal@us.ibm.com>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/ppc/intrapred_altivec.cpp -> x265_3.3.tar.gz/source/common/ppc/intrapred_altivec.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Roger Moussalli <rmoussal@us.ibm.com>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/ppc/ipfilter_altivec.cpp -> x265_3.3.tar.gz/source/common/ppc/ipfilter_altivec.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Roger Moussalli <rmoussal@us.ibm.com>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/ppc/pixel_altivec.cpp -> x265_3.3.tar.gz/source/common/ppc/pixel_altivec.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/ppc/ppccommon.h -> x265_3.3.tar.gz/source/common/ppc/ppccommon.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <min.chen@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/predict.cpp -> x265_3.3.tar.gz/source/common/predict.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/predict.h -> x265_3.3.tar.gz/source/common/predict.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/primitives.cpp -> x265_3.3.tar.gz/source/common/primitives.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/primitives.h -> x265_3.3.tar.gz/source/common/primitives.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/quant.cpp -> x265_3.3.tar.gz/source/common/quant.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/quant.h -> x265_3.3.tar.gz/source/common/quant.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/scalinglist.cpp -> x265_3.3.tar.gz/source/common/scalinglist.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/scalinglist.h -> x265_3.3.tar.gz/source/common/scalinglist.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/shortyuv.cpp -> x265_3.3.tar.gz/source/common/shortyuv.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
  *
8
x265_3.2.1.tar.gz/source/common/shortyuv.h -> x265_3.3.tar.gz/source/common/shortyuv.h Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /*****************************************************************************
3
  * x265: ShortYUV class for short sized YUV-style frames
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
9
  *
10
x265_3.2.1.tar.gz/source/common/slice.cpp -> x265_3.3.tar.gz/source/common/slice.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/slice.h -> x265_3.3.tar.gz/source/common/slice.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/threading.cpp -> x265_3.3.tar.gz/source/common/threading.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/threading.h -> x265_3.3.tar.gz/source/common/threading.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/threadpool.cpp -> x265_3.3.tar.gz/source/common/threadpool.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/threadpool.h -> x265_3.3.tar.gz/source/common/threadpool.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/vec/dct-sse3.cpp -> x265_3.3.tar.gz/source/common/vec/dct-sse3.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/vec/dct-sse41.cpp -> x265_3.3.tar.gz/source/common/vec/dct-sse41.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/vec/dct-ssse3.cpp -> x265_3.3.tar.gz/source/common/vec/dct-ssse3.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/vec/vec-primitives.cpp -> x265_3.3.tar.gz/source/common/vec/vec-primitives.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/version.cpp -> x265_3.3.tar.gz/source/common/version.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/wavefront.cpp -> x265_3.3.tar.gz/source/common/wavefront.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/wavefront.h -> x265_3.3.tar.gz/source/common/wavefront.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/winxp.cpp -> x265_3.3.tar.gz/source/common/winxp.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/winxp.h -> x265_3.3.tar.gz/source/common/winxp.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/x86/asm-primitives.cpp -> x265_3.3.tar.gz/source/common/x86/asm-primitives.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/blockcopy8.asm -> x265_3.3.tar.gz/source/common/x86/blockcopy8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com>
7
 ;*          Murugan Vairavel <murugan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/blockcopy8.h -> x265_3.3.tar.gz/source/common/x86/blockcopy8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
 ;*          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/x86/const-a.asm -> x265_3.3.tar.gz/source/common/x86/const-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* const-a.asm: x86 global constants
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Fiona Glaser <fiona@x264.com>
10
x265_3.2.1.tar.gz/source/common/x86/cpu-a.asm -> x265_3.3.tar.gz/source/common/x86/cpu-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* cpu-a.asm: x86 cpu utilities
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Laurent Aimar <fenrir@via.ecp.fr>
9
 ;*          Loren Merritt <lorenm@u.washington.edu>
10
x265_3.2.1.tar.gz/source/common/x86/dct8.asm -> x265_3.3.tar.gz/source/common/x86/dct8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/dct8.h -> x265_3.3.tar.gz/source/common/x86/dct8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/x86/h-ipfilter16.asm -> x265_3.3.tar.gz/source/common/x86/h-ipfilter16.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Murugan Vairavel <murugan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/h-ipfilter8.asm -> x265_3.3.tar.gz/source/common/x86/h-ipfilter8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com>
7
 ;*          Nabajit Deka <nabajit@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/h4-ipfilter16.asm -> x265_3.3.tar.gz/source/common/x86/h4-ipfilter16.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Murugan Vairavel <murugan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/intrapred.h -> x265_3.3.tar.gz/source/common/x86/intrapred.h Changed
10
 
1
@@ -2,7 +2,7 @@
2
  * intrapred.h: Intra Prediction metrics
3
  *****************************************************************************
4
  * Copyright (C) 2003-2013 x264 project
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
9
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
10
x265_3.2.1.tar.gz/source/common/x86/intrapred16.asm -> x265_3.3.tar.gz/source/common/x86/intrapred16.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
7
 ;*          Yuvaraj Venkatesh <yuvaraj@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/intrapred8.asm -> x265_3.3.tar.gz/source/common/x86/intrapred8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
7
 ;*          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/intrapred8_allangs.asm -> x265_3.3.tar.gz/source/common/x86/intrapred8_allangs.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
7
 ;*          Praveen Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/ipfilter16.asm -> x265_3.3.tar.gz/source/common/x86/ipfilter16.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Murugan Vairavel <murugan@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/ipfilter8.asm -> x265_3.3.tar.gz/source/common/x86/ipfilter8.asm Changed
15
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com>
7
 ;*          Nabajit Deka <nabajit@multicorewareinc.com>
8
@@ -14946,4 +14946,4 @@
9
 ;-------------------------------------------------------------------------------------------------------------
10
 ;-------------------------------------------------------------------------------------------------------------
11
 ;ipfilter_luma_avx512 code end
12
-;-------------------------------------------------------------------------------------------------------------
13
\ No newline at end of file
14
+;-------------------------------------------------------------------------------------------------------------
15
x265_3.2.1.tar.gz/source/common/x86/ipfilter8.h -> x265_3.3.tar.gz/source/common/x86/ipfilter8.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/x86/loopfilter.asm -> x265_3.3.tar.gz/source/common/x86/loopfilter.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm001@163.com>
7
 ;*          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/loopfilter.h -> x265_3.3.tar.gz/source/common/x86/loopfilter.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
7
  *          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/mc-a.asm -> x265_3.3.tar.gz/source/common/x86/mc-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* mc-a.asm: x86 motion compensation
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Fiona Glaser <fiona@x264.com>
10
x265_3.2.1.tar.gz/source/common/x86/mc-a2.asm -> x265_3.3.tar.gz/source/common/x86/mc-a2.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* mc-a2.asm: x86 motion compensation
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Fiona Glaser <fiona@x264.com>
10
x265_3.2.1.tar.gz/source/common/x86/mc.h -> x265_3.3.tar.gz/source/common/x86/mc.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/common/x86/pixel-32.asm -> x265_3.3.tar.gz/source/common/x86/pixel-32.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* pixel-32.asm: x86_32 pixel metrics
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Laurent Aimar <fenrir@via.ecp.fr>
10
x265_3.2.1.tar.gz/source/common/x86/pixel-a.asm -> x265_3.3.tar.gz/source/common/x86/pixel-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* pixel.asm: x86 pixel metrics
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Holger Lubitz <holger@lubitz.org>
10
x265_3.2.1.tar.gz/source/common/x86/pixel-util.h -> x265_3.3.tar.gz/source/common/x86/pixel-util.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
 ;*          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/x86/pixel-util8.asm -> x265_3.3.tar.gz/source/common/x86/pixel-util8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
7
 ;*          Nabajit Deka <nabajit@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/pixel.h -> x265_3.3.tar.gz/source/common/x86/pixel.h Changed
10
 
1
@@ -2,7 +2,7 @@
2
  * pixel.h: x86 pixel metrics
3
  *****************************************************************************
4
  * Copyright (C) 2003-2013 x264 project
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9
  *          Loren Merritt <lorenm@u.washington.edu>
10
x265_3.2.1.tar.gz/source/common/x86/pixeladd8.asm -> x265_3.3.tar.gz/source/common/x86/pixeladd8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com>
7
 ;*          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/x86/sad-a.asm -> x265_3.3.tar.gz/source/common/x86/sad-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* sad-a.asm: x86 sad functions
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Fiona Glaser <fiona@x264.com>
10
x265_3.2.1.tar.gz/source/common/x86/sad16-a.asm -> x265_3.3.tar.gz/source/common/x86/sad16-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* sad16-a.asm: x86 high depth sad functions
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Oskar Arvidsson <oskar@irock.se>
9
 ;*          Henrik Gramner <henrik@gramner.com>
10
x265_3.2.1.tar.gz/source/common/x86/seaintegral.asm -> x265_3.3.tar.gz/source/common/x86/seaintegral.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Jayashri Murugan <jayashri@multicorewareinc.com>
7
 ;*          Vignesh V Menon <vignesh@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/seaintegral.h -> x265_3.3.tar.gz/source/common/x86/seaintegral.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Vignesh V Menon <vignesh@multicorewareinc.com>
7
 *          Jayashri Murugan <jayashri@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/ssd-a.asm -> x265_3.3.tar.gz/source/common/x86/ssd-a.asm Changed
17
 
1
@@ -2,7 +2,7 @@
2
 ;* ssd-a.asm: x86 ssd functions
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Fiona Glaser <fiona@x264.com>
10
@@ -3702,4 +3702,4 @@
11
     movd    eax, xm0
12
 %endif
13
     RET
14
-%endif
15
\ No newline at end of file
16
+%endif
17
x265_3.2.1.tar.gz/source/common/x86/v4-ipfilter16.asm -> x265_3.3.tar.gz/source/common/x86/v4-ipfilter16.asm Changed
15
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Nabajit Deka <nabajit@multicorewareinc.com>
7
 ;*          Murugan Vairavel <murugan@multicorewareinc.com>
8
@@ -3528,4 +3528,4 @@
9
 FILTER_VER_CHROMA_AVX2_8x12 pp, 1, 6
10
 FILTER_VER_CHROMA_AVX2_8x12 ps, 0, INTERP_SHIFT_PS
11
 FILTER_VER_CHROMA_AVX2_8x12 sp, 1, INTERP_SHIFT_SP
12
-FILTER_VER_CHROMA_AVX2_8x12 ss, 0, 6
13
\ No newline at end of file
14
+FILTER_VER_CHROMA_AVX2_8x12 ss, 0, 6
15
x265_3.2.1.tar.gz/source/common/x86/v4-ipfilter8.asm -> x265_3.3.tar.gz/source/common/x86/v4-ipfilter8.asm Changed
8
 
1
@@ -1,5 +1,5 @@
2
 ;*****************************************************************************
3
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 ;*
6
 ;* Authors: Min Chen <chenm003@163.com>
7
 ;*          Nabajit Deka <nabajit@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/common/x86/x86inc.asm -> x265_3.3.tar.gz/source/common/x86/x86inc.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* x86inc.asm: x264asm abstraction layer
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWarae, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWarae, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Anton Mitrofanov <BugMaster@narod.ru>
10
x265_3.2.1.tar.gz/source/common/x86/x86util.asm -> x265_3.3.tar.gz/source/common/x86/x86util.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* x86util.asm: x86 utility macros
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Holger Lubitz <holger@lubitz.org>
9
 ;*          Loren Merritt <lorenm@u.washington.edu>
10
x265_3.2.1.tar.gz/source/common/yuv.cpp -> x265_3.3.tar.gz/source/common/yuv.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/common/yuv.h -> x265_3.3.tar.gz/source/common/yuv.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/dynamicHDR10/BasicStructures.h -> x265_3.3.tar.gz/source/dynamicHDR10/BasicStructures.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/JsonHelper.cpp -> x265_3.3.tar.gz/source/dynamicHDR10/JsonHelper.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/JsonHelper.h -> x265_3.3.tar.gz/source/dynamicHDR10/JsonHelper.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/LICENSE.txt -> x265_3.3.tar.gz/source/dynamicHDR10/LICENSE.txt Changed
7
 
1
@@ -1,4 +1,4 @@
2
-Copyright (C) 2013-2017 MulticoreWare, Inc
3
+Copyright (C) 2013-2020 MulticoreWare, Inc
4
 
5
 This program is free software; you can redistribute it and/or modify
6
 it under the terms of the GNU General Public License as published by
7
x265_3.2.1.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.cpp -> x265_3.3.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.h -> x265_3.3.tar.gz/source/dynamicHDR10/SeiMetadataDictionary.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/api.cpp -> x265_3.3.tar.gz/source/dynamicHDR10/api.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/hdr10plus.h -> x265_3.3.tar.gz/source/dynamicHDR10/hdr10plus.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/metadataFromJson.cpp -> x265_3.3.tar.gz/source/dynamicHDR10/metadataFromJson.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/dynamicHDR10/metadataFromJson.h -> x265_3.3.tar.gz/source/dynamicHDR10/metadataFromJson.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
7
  *          Kavitha Sampath <kavitha@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/encoder/analysis.cpp -> x265_3.3.tar.gz/source/encoder/analysis.cpp Changed
278
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
 *          Steve Borho <steve@borho.org>
8
@@ -202,14 +202,17 @@
9
         m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions];
10
     }
11
     
12
-    if ((m_param->analysisSave || m_param->analysisLoad) && m_slice->m_sliceType != I_SLICE && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel < 10)
13
+    int reuseLevel = X265_MAX(m_param->analysisSaveReuseLevel, m_param->analysisLoadReuseLevel);
14
+    if ((m_param->analysisSave || m_param->analysisLoad) && m_slice->m_sliceType != I_SLICE && reuseLevel > 1 && reuseLevel < 10)
15
     {
16
         int numPredDir = m_slice->isInterP() ? 1 : 2;
17
         m_reuseInterDataCTU = m_frame->m_analysisData.interData;
18
-        m_reuseRef = &m_reuseInterDataCTU->ref [ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
19
+        if (((m_param->analysisSaveReuseLevel > 1) && (m_param->analysisSaveReuseLevel < 7)) ||
20
+            ((m_param->analysisLoadReuseLevel > 1) && (m_param->analysisLoadReuseLevel < 7)))
21
+            m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
22
         m_reuseDepth = &m_reuseInterDataCTU->depth[ctu.m_cuAddr * ctu.m_numPartitions];
23
         m_reuseModes = &m_reuseInterDataCTU->modes[ctu.m_cuAddr * ctu.m_numPartitions];
24
-        if (m_param->analysisReuseLevel > 4)
25
+        if (reuseLevel > 4)
26
         {
27
             m_reusePartSize = &m_reuseInterDataCTU->partSize[ctu.m_cuAddr * ctu.m_numPartitions];
28
             m_reuseMergeFlag = &m_reuseInterDataCTU->mergeFlag[ctu.m_cuAddr * ctu.m_numPartitions];
29
@@ -223,7 +226,7 @@
30
     if (m_slice->m_sliceType == I_SLICE)
31
     {
32
         x265_analysis_intra_data* intraDataCTU = m_frame->m_analysisData.intraData;
33
-        if (m_param->analysisLoad && m_param->analysisReuseLevel > 1)
34
+        if (m_param->analysisLoadReuseLevel > 1)
35
         {
36
             memcpy(ctu.m_cuDepth, &intraDataCTU->depth[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);
37
             memcpy(ctu.m_lumaIntraDir, &intraDataCTU->modes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);
38
@@ -234,10 +237,10 @@
39
     }
40
     else
41
     {
42
-        bool bCopyAnalysis = ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16));
43
-        bool BCompressInterCUrd0_4 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel <= 4);
44
-        bool BCompressInterCUrd5_6 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);
45
-        bCopyAnalysis = bCopyAnalysis || BCompressInterCUrd0_4 || BCompressInterCUrd5_6;
46
+        bool bCopyAnalysis = ((m_param->analysisLoadReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && ctu.m_numPartitions <= 16));
47
+        bool bCompressInterCUrd0_4 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && m_param->rdLevel <= 4);
48
+        bool bCompressInterCUrd5_6 = (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7 && m_param->rdLevel >= 5 && m_param->rdLevel <= 6);
49
+        bCopyAnalysis = bCopyAnalysis || bCompressInterCUrd0_4 || bCompressInterCUrd5_6;
50
 
51
         if (bCopyAnalysis)
52
         {
53
@@ -275,8 +278,8 @@
54
             /* generate residual for entire CTU at once and copy to reconPic */
55
             encodeResidue(ctu, cuGeom);
56
         }
57
-        else if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10 && (!(m_param->bAnalysisType == HEVC_INFO) || m_slice->m_sliceType != P_SLICE)) ||
58
-                 ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisReuseLevel >= 7 && ctu.m_numPartitions <= 16))
59
+        else if ((m_param->analysisLoadReuseLevel == 10 && (!(m_param->bAnalysisType == HEVC_INFO) || m_slice->m_sliceType != P_SLICE)) ||
60
+                ((m_param->bAnalysisType == AVC_INFO) && m_param->analysisLoadReuseLevel >= 7 && ctu.m_numPartitions <= 16))
61
         {
62
             x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;
63
             int posCTU = ctu.m_cuAddr * numPartition;
64
@@ -375,12 +378,12 @@
65
     CUData* neighbourCU;
66
     uint8_t count = 0;
67
     int32_t maxTUDepth = -1;
68
-    neighbourCU = m_slice->m_refFrameList[0][0]->m_encData->m_picCTU;
69
+    neighbourCU = &m_slice->m_refFrameList[0][0]->m_encData->m_picCTU[parentCTU.m_cuAddr];
70
     predDepth += neighbourCU->m_refTuDepth[cuGeom.geomRecurId];
71
     count++;
72
     if (m_slice->isInterB())
73
     {
74
-        neighbourCU = m_slice->m_refFrameList[1][0]->m_encData->m_picCTU;
75
+        neighbourCU = &m_slice->m_refFrameList[1][0]->m_encData->m_picCTU[parentCTU.m_cuAddr];
76
         predDepth += neighbourCU->m_refTuDepth[cuGeom.geomRecurId];
77
         count++;
78
     }
79
@@ -456,7 +459,7 @@
80
     int bestCUQP = qp;
81
     int lambdaQP = lqp;
82
     bool doQPRefine = (bDecidedDepth && depth <= m_slice->m_pps->maxCuDQPDepth) || (!bDecidedDepth && depth == m_slice->m_pps->maxCuDQPDepth);
83
-    if (m_param->analysisReuseLevel >= 7)
84
+    if (m_param->analysisLoadReuseLevel >= 7)
85
         doQPRefine = false;
86
     if (doQPRefine)
87
     {
88
@@ -1164,7 +1167,7 @@
89
     SplitData splitCUData;
90
 
91
     bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);
92
-    bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
93
+    bool bRefineAVCAnalysis = (m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
94
     bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);
95
 
96
     if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)
97
@@ -1259,7 +1262,7 @@
98
                 mightSplit &= !bDecidedDepth;
99
             }
100
         }
101
-        if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10))
102
+        if ((m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10))
103
         {
104
             if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
105
             {
106
@@ -1273,7 +1276,7 @@
107
                     if (m_param->rdLevel)
108
                         skipModes = m_param->bEnableEarlySkip && md.bestMode;
109
                 }
110
-                if (m_param->analysisReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
111
+                if (m_param->analysisLoadReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
112
                 {
113
                     if (m_reuseModes[cuGeom.absPartIdx] != MODE_INTRA  && m_reuseModes[cuGeom.absPartIdx] != 4)
114
                     {
115
@@ -1300,7 +1303,8 @@
116
             }
117
         }
118
         /* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if skip mode was not set above */
119
-        if ((mightNotSplit && depth >= minDepth && !md.bestMode && !bCtuInfoCheck) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]))) /* TODO: Re-evaluate if analysis load/save still works */
120
+        if ((mightNotSplit && depth >= minDepth && !md.bestMode && !bCtuInfoCheck) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
121
+            /* TODO: Re-evaluate if analysis load/save still works */
122
         {
123
             /* Compute Merge Cost */
124
             md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
125
@@ -1310,7 +1314,7 @@
126
                 skipModes = (m_param->bEnableEarlySkip || m_refineLevel == 2)
127
                 && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d threshold per depth
128
         }
129
-        if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
130
+        if (md.bestMode && m_param->bEnableRecursionSkip && !bCtuInfoCheck && !(m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
131
         {
132
             skipRecursion = md.bestMode->cu.isSkipped(0);
133
             if (mightSplit && depth >= minDepth && !skipRecursion)
134
@@ -1321,7 +1325,7 @@
135
                     skipRecursion = complexityCheckCU(*md.bestMode);
136
             }
137
         }
138
-        if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
139
+        if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisLoadReuseLevel == 7)
140
             skipRecursion = true;
141
         /* Step 2. Evaluate each of the 4 split sub-blocks in series */
142
         if (mightSplit && !skipRecursion)
143
@@ -1378,7 +1382,7 @@
144
                 splitPred->sa8dCost = m_rdCost.calcRdSADCost((uint32_t)splitPred->distortion, splitPred->sa8dBits);
145
         }
146
         /* If analysis mode is simple do not Evaluate other modes */
147
-        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
148
+        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)
149
         {
150
             if (m_slice->m_sliceType == P_SLICE)
151
             {
152
@@ -1857,7 +1861,7 @@
153
     SplitData splitCUData;
154
 
155
     bool bHEVCBlockAnalysis = (m_param->bAnalysisType == AVC_INFO && cuGeom.numPartitions > 16);
156
-    bool bRefineAVCAnalysis = (m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
157
+    bool bRefineAVCAnalysis = (m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1]));
158
     bool bNooffloading = !(m_param->bAnalysisType == AVC_INFO);
159
 
160
     if (bHEVCBlockAnalysis || bRefineAVCAnalysis || bNooffloading)
161
@@ -1953,7 +1957,7 @@
162
                 mightSplit &= !bDecidedDepth;
163
             }
164
         }
165
-        if (m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
166
+        if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10)
167
         {
168
             if (mightNotSplit && depth == m_reuseDepth[cuGeom.absPartIdx])
169
             {
170
@@ -1971,7 +1975,7 @@
171
                     if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode)
172
                         skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
173
                 }
174
-                if (m_param->analysisReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
175
+                if (m_param->analysisLoadReuseLevel > 4 && m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)
176
                     skipRectAmp = true && !!md.bestMode;
177
             }
178
         }
179
@@ -1999,7 +2003,7 @@
180
         }
181
         /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
182
         if ((mightNotSplit && !md.bestMode && !bCtuInfoCheck) ||
183
-            (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
184
+            (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7 && (m_modeFlag[0] || m_modeFlag[1])))
185
         {
186
             md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
187
             md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
188
@@ -2014,7 +2018,7 @@
189
             if (m_param->bEnableRecursionSkip && depth && m_modeDepth[depth - 1].bestMode)
190
                 skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
191
         }
192
-        if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisReuseLevel == 7)
193
+        if (m_param->bAnalysisType == AVC_INFO && md.bestMode && cuGeom.numPartitions <= 16 && m_param->analysisLoadReuseLevel == 7)
194
             skipRecursion = true;
195
         // estimate split cost
196
         /* Step 2. Evaluate each of the 4 split sub-blocks in series */
197
@@ -2068,7 +2072,7 @@
198
             checkDQPForSplitPred(*splitPred, cuGeom);
199
         }
200
         /* If analysis mode is simple do not Evaluate other modes */
201
-        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
202
+        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)
203
         {
204
             if (m_slice->m_sliceType == P_SLICE)
205
             {
206
@@ -2461,7 +2465,7 @@
207
             for (uint32_t part = 0; part < numPU; part++)
208
             {
209
                 PredictionUnit pu(mode.cu, cuGeom, part);
210
-                if ((m_param->analysisLoad && m_param->analysisReuseLevel == 10) || (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel >= 7))
211
+                if (m_param->analysisLoadReuseLevel == 10 || (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel >= 7))
212
                 {
213
                     x265_analysis_inter_data* interDataCTU = m_frame->m_analysisData.interData;
214
                     int cuIdx = (mode.cu.m_cuAddr * parentCTU.m_numPartitions) + cuGeom.absPartIdx;
215
@@ -2552,7 +2556,7 @@
216
                 checkDQPForSplitPred(*md.bestMode, cuGeom);
217
         }
218
 
219
-        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisReuseLevel == 7)
220
+        if (m_param->bAnalysisType == AVC_INFO && m_param->analysisLoadReuseLevel == 7)
221
         {
222
             for (int list = 0; list < m_slice->isInterB() + 1; list++)
223
             {
224
@@ -2607,7 +2611,7 @@
225
                 if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth)
226
                     nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom));
227
 
228
-                int lamdaQP = (m_param->analysisReuseLevel >= 7) ? nextQP : lqp;
229
+                int lamdaQP = (m_param->analysisLoadReuseLevel >= 7) ? nextQP : lqp;
230
 
231
                 if (split)
232
                     m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, childGeom, nextQP) : compressInterCU_rd0_4(parentCTU, childGeom, nextQP);
233
@@ -3013,7 +3017,7 @@
234
     interMode.cu.setPredModeSubParts(MODE_INTER);
235
     int numPredDir = m_slice->isInterP() ? 1 : 2;
236
 
237
-    if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
238
+    if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10 && m_reuseInterDataCTU)
239
     {
240
         int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;
241
         int index = 0;
242
@@ -3056,7 +3060,7 @@
243
     }
244
     interMode.sa8dCost = m_rdCost.calcRdSADCost((uint32_t)interMode.distortion, interMode.sa8dBits);
245
 
246
-    if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)
247
+    if (m_param->analysisSaveReuseLevel > 1 && m_reuseInterDataCTU)
248
     {
249
         int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;
250
         int index = 0;
251
@@ -3078,7 +3082,7 @@
252
     interMode.cu.setPredModeSubParts(MODE_INTER);
253
     int numPredDir = m_slice->isInterP() ? 1 : 2;
254
 
255
-    if (m_param->analysisLoad && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
256
+    if (m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10 && m_reuseInterDataCTU)
257
     {
258
         int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;
259
         int index = 0;
260
@@ -3113,7 +3117,7 @@
261
     /* predInterSearch sets interMode.sa8dBits, but this is ignored */
262
     encodeResAndCalcRdInterCU(interMode, cuGeom);
263
 
264
-    if (m_param->analysisSave && m_reuseInterDataCTU && m_param->analysisReuseLevel > 1)
265
+    if (m_param->analysisSaveReuseLevel > 1 && m_reuseInterDataCTU)
266
     {
267
         int refOffset = cuGeom.geomRecurId * 16 * numPredDir + partSize * numPredDir * 2;
268
         int index = 0;
269
@@ -3612,7 +3616,7 @@
270
             qp += distortionData->offset[ctu.m_cuAddr];
271
     }
272
 
273
-    if (m_param->analysisLoad && m_param->analysisReuseLevel == 10 && m_param->rc.cuTree)
274
+    if (m_param->analysisLoadReuseLevel == 10 && m_param->rc.cuTree)
275
     {
276
         int cuIdx = (ctu.m_cuAddr * ctu.m_numPartitions) + cuGeom.absPartIdx;
277
         if (ctu.m_slice->m_sliceType == I_SLICE)
278
x265_3.2.1.tar.gz/source/encoder/analysis.h -> x265_3.3.tar.gz/source/encoder/analysis.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Deepthi Nandakumar <deepthi@multicorewareinc.com>
7
 *          Steve Borho <steve@borho.org>
8
x265_3.2.1.tar.gz/source/encoder/api.cpp -> x265_3.3.tar.gz/source/encoder/api.cpp Changed
329
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -100,7 +100,7 @@
9
     if(param) PARAM_NS::x265_param_default(param);
10
     if(latestParam) PARAM_NS::x265_param_default(latestParam);
11
     if(zoneParam) PARAM_NS::x265_param_default(zoneParam);
12
-
13
+  
14
     if (!param || !latestParam || !zoneParam)
15
         goto fail;
16
     if (p->rc.zoneCount || p->rc.zonefileCount)
17
@@ -176,6 +176,8 @@
18
 
19
     // may change params for auto-detect, etc
20
     encoder->configure(param);
21
+    if (encoder->m_aborted)
22
+        goto fail;
23
     // may change rate control and CPB params
24
     if (!enforceLevel(*param, encoder->m_vps))
25
         goto fail;
26
@@ -190,10 +192,23 @@
27
     }
28
 
29
     encoder->create();
30
+    p->frameNumThreads = encoder->m_param->frameNumThreads;
31
+
32
+    if (!param->bResetZoneConfig)
33
+    {
34
+        param->rc.zones = X265_MALLOC(x265_zone, param->rc.zonefileCount);
35
+        for (int i = 0; i < param->rc.zonefileCount; i++)
36
+        {
37
+            param->rc.zones[i].zoneParam = X265_MALLOC(x265_param, 1);
38
+            memcpy(param->rc.zones[i].zoneParam, param, sizeof(x265_param));
39
+            param->rc.zones[i].relativeComplexity = X265_MALLOC(double, param->reconfigWindowSize);
40
+        }
41
+    }
42
 
43
     memcpy(zoneParam, param, sizeof(x265_param));
44
     for (int i = 0; i < param->rc.zonefileCount; i++)
45
     {
46
+        param->rc.zones[i].startFrame = -1;
47
         encoder->configureZone(zoneParam, param->rc.zones[i].zoneParam);
48
     }
49
 
50
@@ -362,6 +377,36 @@
51
     return ret;
52
 }
53
 
54
+
55
+int x265_encoder_reconfig_zone(x265_encoder* enc, x265_zone* zone_in)
56
+{
57
+    if (!enc || !zone_in)
58
+        return -1;
59
+
60
+    Encoder* encoder = static_cast<Encoder*>(enc);
61
+    int read = encoder->zoneReadCount[encoder->m_zoneIndex].get();
62
+    int write = encoder->zoneWriteCount[encoder->m_zoneIndex].get();
63
+
64
+    x265_zone* zone = &(encoder->m_param->rc).zones[encoder->m_zoneIndex];
65
+    x265_param* zoneParam = zone->zoneParam;
66
+
67
+    if (write && (read < write))
68
+    {
69
+        read = encoder->zoneReadCount[encoder->m_zoneIndex].waitForChange(read);
70
+    }
71
+
72
+    zone->startFrame = zone_in->startFrame;
73
+    zoneParam->rc.bitrate = zone_in->zoneParam->rc.bitrate;
74
+    zoneParam->rc.vbvMaxBitrate = zone_in->zoneParam->rc.vbvMaxBitrate;
75
+    memcpy(zone->relativeComplexity, zone_in->relativeComplexity, sizeof(double) * encoder->m_param->reconfigWindowSize);
76
+    
77
+    encoder->zoneWriteCount[encoder->m_zoneIndex].incr();
78
+    encoder->m_zoneIndex++;
79
+    encoder->m_zoneIndex %= encoder->m_param->rc.zonefileCount;
80
+
81
+    return 0;
82
+}
83
+
84
 int x265_encoder_encode(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out)
85
 {
86
     if (!enc)
87
@@ -372,12 +417,12 @@
88
 
89
 #ifdef SVT_HEVC
90
     EB_ERRORTYPE return_error;
91
-    static unsigned char picSendDone = 0;
92
-    numEncoded = 0;
93
-    static int codedNal = 0, eofReached = 0;
94
-   EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)encoder->m_svtAppData->svtHevcParams;
95
     if (encoder->m_param->bEnableSvtHevc)
96
     {
97
+        static unsigned char picSendDone = 0;
98
+        numEncoded = 0;
99
+        static int codedNal = 0, eofReached = 0;
100
+        EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)encoder->m_svtAppData->svtHevcParams;
101
         if (pic_in)
102
         {
103
             if (pic_in->colorSpace == X265_CSP_I420) // SVT-HEVC supports only yuv420p color space
104
@@ -728,6 +773,12 @@
105
     int numDir = 2; //irrespective of P or B slices set direction as 2
106
     uint32_t numPlanes = param->internalCsp == X265_CSP_I400 ? 1 : 3;
107
 
108
+    int maxReuseLevel = X265_MAX(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel);
109
+    int minReuseLevel = (param->analysisSaveReuseLevel && param->analysisLoadReuseLevel) ?
110
+                        X265_MIN(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel) : maxReuseLevel;
111
+
112
+    bool isMultiPassOpt = param->analysisMultiPassRefine || param->analysisMultiPassDistortion;
113
+                      
114
 #if X265_DEPTH < 10 && (LINKED_10BIT || LINKED_12BIT)
115
     uint32_t numCUs_sse_t = param->internalBitDepth > 8 ? analysis->numCUsInFrame << 1 : analysis->numCUsInFrame;
116
 #elif X265_DEPTH >= 10 && LINKED_8BIT
117
@@ -735,7 +786,7 @@
118
 #else
119
     uint32_t numCUs_sse_t = analysis->numCUsInFrame;
120
 #endif
121
-    if (param->analysisMultiPassRefine || param->analysisMultiPassDistortion || param->ctuDistortionRefine)
122
+    if (isMultiPassOpt || param->ctuDistortionRefine)
123
     {
124
         //Allocate memory for distortionData pointer
125
         CHECKED_MALLOC_ZERO(distortionData, x265_analysis_distortion_data, 1);
126
@@ -749,7 +800,7 @@
127
         analysis->distortionData = distortionData;
128
     }
129
 
130
-    if (param->bDisableLookahead && isVbv)
131
+    if (!isMultiPassOpt && param->bDisableLookahead && isVbv)
132
     {
133
         CHECKED_MALLOC_ZERO(analysis->lookahead.intraSatdForVbv, uint32_t, analysis->numCuInHeight);
134
         CHECKED_MALLOC_ZERO(analysis->lookahead.satdForVbv, uint32_t, analysis->numCuInHeight);
135
@@ -758,40 +809,47 @@
136
     }
137
 
138
     //Allocate memory for weightParam pointer
139
-    if (!(param->bAnalysisType == AVC_INFO))
140
+    if (!isMultiPassOpt && !(param->bAnalysisType == AVC_INFO))
141
         CHECKED_MALLOC_ZERO(analysis->wt, x265_weight_param, numPlanes * numDir);
142
 
143
-    if (param->analysisReuseLevel < 2)
144
-        return;
145
-
146
     //Allocate memory for intraData pointer
147
-    CHECKED_MALLOC_ZERO(intraData, x265_analysis_intra_data, 1);
148
-    CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
149
-    CHECKED_MALLOC_ZERO(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
150
-    CHECKED_MALLOC_ZERO(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);
151
-    CHECKED_MALLOC_ZERO(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
152
-    if (param->rc.cuTree)
153
-        CHECKED_MALLOC_ZERO(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);
154
+    if ((maxReuseLevel > 1) || isMultiPassOpt)
155
+    {
156
+        CHECKED_MALLOC_ZERO(intraData, x265_analysis_intra_data, 1);
157
+        CHECKED_MALLOC(intraData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
158
+    }
159
+
160
+    if (maxReuseLevel > 1)
161
+    {
162
+        CHECKED_MALLOC_ZERO(intraData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
163
+        CHECKED_MALLOC_ZERO(intraData->partSizes, char, analysis->numPartitions * analysis->numCUsInFrame);
164
+        CHECKED_MALLOC_ZERO(intraData->chromaModes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
165
+        if (param->rc.cuTree)
166
+            CHECKED_MALLOC_ZERO(intraData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);
167
+    }
168
     analysis->intraData = intraData;
169
 
170
-    //Allocate memory for interData pointer based on ReuseLevels
171
-    CHECKED_MALLOC_ZERO(interData, x265_analysis_inter_data, 1);
172
-    CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
173
-    CHECKED_MALLOC_ZERO(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
174
+    if ((maxReuseLevel > 1) || isMultiPassOpt)
175
+    {
176
+        //Allocate memory for interData pointer based on ReuseLevels
177
+        CHECKED_MALLOC_ZERO(interData, x265_analysis_inter_data, 1);
178
+        CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
179
+        CHECKED_MALLOC_ZERO(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
180
 
181
-    if (param->rc.cuTree)
182
-        CHECKED_MALLOC_ZERO(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);
183
-    CHECKED_MALLOC_ZERO(interData->mvpIdx[0], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
184
-    CHECKED_MALLOC_ZERO(interData->mvpIdx[1], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
185
-    CHECKED_MALLOC_ZERO(interData->mv[0], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);
186
-    CHECKED_MALLOC_ZERO(interData->mv[1], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);
187
+        if (param->rc.cuTree && !isMultiPassOpt)
188
+            CHECKED_MALLOC_ZERO(interData->cuQPOff, int8_t, analysis->numPartitions * analysis->numCUsInFrame);
189
+        CHECKED_MALLOC_ZERO(interData->mvpIdx[0], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
190
+        CHECKED_MALLOC_ZERO(interData->mvpIdx[1], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
191
+        CHECKED_MALLOC_ZERO(interData->mv[0], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);
192
+        CHECKED_MALLOC_ZERO(interData->mv[1], x265_analysis_MV, analysis->numPartitions * analysis->numCUsInFrame);
193
+    }
194
 
195
-    if (param->analysisReuseLevel > 4)
196
+    if (maxReuseLevel > 4)
197
     {
198
         CHECKED_MALLOC_ZERO(interData->partSize, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
199
         CHECKED_MALLOC_ZERO(interData->mergeFlag, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
200
     }
201
-    if (param->analysisReuseLevel >= 7)
202
+    if (maxReuseLevel >= 7)
203
     {
204
         CHECKED_MALLOC_ZERO(interData->interDir, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
205
         CHECKED_MALLOC_ZERO(interData->sadCost, int64_t, analysis->numPartitions * analysis->numCUsInFrame);
206
@@ -801,14 +859,13 @@
207
             CHECKED_MALLOC_ZERO(analysis->modeFlag[dir], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
208
         }
209
     }
210
-    else
211
+    if ((minReuseLevel >= 2) && (minReuseLevel <= 6))
212
     {
213
-        if (param->analysisMultiPassRefine || param->analysisMultiPassDistortion){
214
-            CHECKED_MALLOC_ZERO(interData->ref, int32_t, 2 * analysis->numPartitions * analysis->numCUsInFrame);
215
-        }
216
-        else
217
-            CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);
218
+        CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);
219
     }
220
+    if (isMultiPassOpt)
221
+        CHECKED_MALLOC_ZERO(interData->ref, int32_t, 2 * analysis->numPartitions * analysis->numCUsInFrame);
222
+
223
     analysis->interData = interData;
224
 
225
     return;
226
@@ -819,10 +876,15 @@
227
 
228
 void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis)
229
 {
230
+    int maxReuseLevel = X265_MAX(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel);
231
+    int minReuseLevel = (param->analysisSaveReuseLevel && param->analysisLoadReuseLevel) ?
232
+                        X265_MIN(param->analysisSaveReuseLevel, param->analysisLoadReuseLevel) : maxReuseLevel;
233
+
234
     bool isVbv = param->rc.vbvMaxBitrate > 0 && param->rc.vbvBufferSize > 0;
235
+    bool isMultiPassOpt = param->analysisMultiPassRefine || param->analysisMultiPassDistortion;
236
 
237
     //Free memory for Lookahead pointers
238
-    if (param->bDisableLookahead && isVbv)
239
+    if (!isMultiPassOpt && param->bDisableLookahead && isVbv)
240
     {
241
         X265_FREE(analysis->lookahead.satdForVbv);
242
         X265_FREE(analysis->lookahead.intraSatdForVbv);
243
@@ -844,21 +906,21 @@
244
     }
245
 
246
     /* Early exit freeing weights alone if level is 1 (when there is no analysis inter/intra) */
247
-    if (analysis->wt && !(param->bAnalysisType == AVC_INFO))
248
+    if (!isMultiPassOpt && analysis->wt && !(param->bAnalysisType == AVC_INFO))
249
         X265_FREE(analysis->wt);
250
 
251
-    if (param->analysisReuseLevel < 2)
252
-        return;
253
-
254
     //Free memory for intraData pointers
255
     if (analysis->intraData)
256
     {
257
         X265_FREE((analysis->intraData)->depth);
258
-        X265_FREE((analysis->intraData)->modes);
259
-        X265_FREE((analysis->intraData)->partSizes);
260
-        X265_FREE((analysis->intraData)->chromaModes);
261
-        if (param->rc.cuTree)
262
-            X265_FREE((analysis->intraData)->cuQPOff);
263
+        if (!isMultiPassOpt)
264
+        {
265
+            X265_FREE((analysis->intraData)->modes);
266
+            X265_FREE((analysis->intraData)->partSizes);
267
+            X265_FREE((analysis->intraData)->chromaModes);
268
+            if (param->rc.cuTree)
269
+                X265_FREE((analysis->intraData)->cuQPOff);
270
+        }
271
         X265_FREE(analysis->intraData);
272
         analysis->intraData = NULL;
273
     }
274
@@ -868,19 +930,19 @@
275
     {
276
         X265_FREE((analysis->interData)->depth);
277
         X265_FREE((analysis->interData)->modes);
278
-        if (param->rc.cuTree)
279
+        if (!isMultiPassOpt && param->rc.cuTree)
280
             X265_FREE((analysis->interData)->cuQPOff);
281
         X265_FREE((analysis->interData)->mvpIdx[0]);
282
         X265_FREE((analysis->interData)->mvpIdx[1]);
283
         X265_FREE((analysis->interData)->mv[0]);
284
         X265_FREE((analysis->interData)->mv[1]);
285
 
286
-        if (param->analysisReuseLevel > 4)
287
+        if (maxReuseLevel > 4)
288
         {
289
             X265_FREE((analysis->interData)->mergeFlag);
290
             X265_FREE((analysis->interData)->partSize);
291
         }
292
-        if (param->analysisReuseLevel >= 7)
293
+        if (maxReuseLevel >= 7)
294
         {
295
             int numDir = 2;
296
             X265_FREE((analysis->interData)->interDir);
297
@@ -889,13 +951,13 @@
298
             {
299
                 X265_FREE((analysis->interData)->refIdx[dir]);
300
                 if (analysis->modeFlag[dir] != NULL)
301
-                {
302
+                { 
303
                     X265_FREE(analysis->modeFlag[dir]);
304
                     analysis->modeFlag[dir] = NULL;
305
                 }
306
             }
307
         }
308
-        else
309
+        if (((minReuseLevel >= 2) && (minReuseLevel <= 6)) || isMultiPassOpt)
310
             X265_FREE((analysis->interData)->ref);
311
         X265_FREE(analysis->interData);
312
         analysis->interData = NULL;
313
@@ -924,6 +986,7 @@
314
     pic->userSEI.numPayloads = 0;
315
     pic->rpu.payloadSize = 0;
316
     pic->rpu.payload = NULL;
317
+    pic->picStruct = 0;
318
 
319
     if ((param->analysisSave || param->analysisLoad) || (param->bAnalysisType == AVC_INFO))
320
     {
321
@@ -987,6 +1050,7 @@
322
     &x265_encoder_open,
323
     &x265_encoder_parameters,
324
     &x265_encoder_reconfig,
325
+    &x265_encoder_reconfig_zone,
326
     &x265_encoder_headers,
327
     &x265_encoder_encode,
328
     &x265_encoder_get_stats,
329
x265_3.2.1.tar.gz/source/encoder/bitcost.cpp -> x265_3.3.tar.gz/source/encoder/bitcost.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/bitcost.h -> x265_3.3.tar.gz/source/encoder/bitcost.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/encoder/dpb.cpp -> x265_3.3.tar.gz/source/encoder/dpb.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/dpb.h -> x265_3.3.tar.gz/source/encoder/dpb.h Changed
28
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -52,12 +52,15 @@
9
         m_lastIDR = 0;
10
         m_pocCRA = 0;
11
         m_bhasLeadingPicture = param->radl;
12
-        for (int i = 0; i < param->rc.zonefileCount; i++)
13
+        if (param->bResetZoneConfig)
14
         {
15
-            if (param->rc.zones[i].zoneParam->radl)
16
+            for (int i = 0; i < param->rc.zonefileCount ; i++)
17
             {
18
-                m_bhasLeadingPicture = param->rc.zones[i].zoneParam->radl;
19
-                break;
20
+                if (param->rc.zones[i].zoneParam->radl)
21
+                {
22
+                    m_bhasLeadingPicture = param->rc.zones[i].zoneParam->radl;
23
+                    break;
24
+                }
25
             }
26
         }
27
         m_bRefreshPending = false;
28
x265_3.2.1.tar.gz/source/encoder/encoder.cpp -> x265_3.3.tar.gz/source/encoder/encoder.cpp Changed
1918
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
@@ -81,6 +81,7 @@
9
 #define MVTHRESHOLD (10*10)
10
 #define PU_2Nx2N 1
11
 #define MAX_CHROMA_QP_OFFSET 12
12
+#define CONF_OFFSET_BYTES (2 * sizeof(int))
13
 static const char* defaultAnalysisFileName = "x265_analysis.dat";
14
 
15
 using namespace X265_NS;
16
@@ -117,6 +118,8 @@
17
     m_cR = 1.0;
18
     for (int i = 0; i < X265_MAX_FRAME_THREADS; i++)
19
         m_frameEncoder[i] = NULL;
20
+    for (uint32_t i = 0; i < DUP_BUFFER; i++)
21
+        m_dupBuffer[i] = NULL;
22
     MotionEstimate::initScales();
23
 
24
 #if ENABLE_HDR10_PLUS
25
@@ -128,11 +131,17 @@
26
 #if SVT_HEVC
27
     m_svtAppData = NULL;
28
 #endif
29
-
30
     m_prevTonemapPayload.payload = NULL;
31
     m_startPoint = 0;
32
     m_saveCTUSize = 0;
33
+    m_edgePic = NULL;
34
+    m_edgeHistThreshold = 0;
35
+    m_chromaHistThreshold = 0.0;
36
+    m_scaledEdgeThreshold = 0.0;
37
+    m_scaledChromaThreshold = 0.0;
38
+    m_zoneIndex = 0;
39
 }
40
+
41
 inline char *strcatFilename(const char *input, const char *suffix)
42
 {
43
     char *output = X265_MALLOC(char, strlen(input) + strlen(suffix) + 1);
44
@@ -160,6 +169,87 @@
45
     int rows = (p->sourceHeight + p->maxCUSize - 1) >> g_log2Size[p->maxCUSize];
46
     int cols = (p->sourceWidth  + p->maxCUSize - 1) >> g_log2Size[p->maxCUSize];
47
 
48
+    if (m_param->bEnableFrameDuplication)
49
+    {
50
+        size_t framesize = 0;
51
+        int pixelbytes = p->sourceBitDepth > 8 ? 2 : 1;
52
+        for (int i = 0; i < x265_cli_csps[p->internalCsp].planes; i++)
53
+        {
54
+            int stride = (p->sourceWidth >> x265_cli_csps[p->internalCsp].width[i]) * pixelbytes;
55
+            framesize += (stride * (p->sourceHeight >> x265_cli_csps[p->internalCsp].height[i]));
56
+        }
57
+
58
+        //Sets the picture structure and emits it in the picture timing SEI message
59
+        m_param->pictureStructure = 0; 
60
+
61
+        for (uint32_t i = 0; i < DUP_BUFFER; i++)
62
+        {
63
+            m_dupBuffer[i] = (AdaptiveFrameDuplication*)x265_malloc(sizeof(AdaptiveFrameDuplication));
64
+            m_dupBuffer[i]->dupPic = NULL;
65
+            m_dupBuffer[i]->dupPic = x265_picture_alloc();
66
+            x265_picture_init(p, m_dupBuffer[i]->dupPic);
67
+            m_dupBuffer[i]->dupPlane = NULL;
68
+            m_dupBuffer[i]->dupPlane = X265_MALLOC(char, framesize);
69
+            m_dupBuffer[i]->dupPic->planes[0] = m_dupBuffer[i]->dupPlane;
70
+            m_dupBuffer[i]->bOccupied = false;
71
+            m_dupBuffer[i]->bDup = false;
72
+        }
73
+
74
+        if (!(p->sourceBitDepth == 8 && p->internalBitDepth == 8))
75
+        {
76
+            int size = p->sourceWidth * p->sourceHeight;
77
+            int hshift = CHROMA_H_SHIFT(p->internalCsp);
78
+            int vshift = CHROMA_V_SHIFT(p->internalCsp);
79
+            int widthC = p->sourceWidth >> hshift;
80
+            int heightC = p->sourceHeight >> vshift;
81
+
82
+            m_dupPicOne[0] = X265_MALLOC(pixel, size);
83
+            m_dupPicTwo[0] = X265_MALLOC(pixel, size);
84
+            if (p->internalCsp != X265_CSP_I400)
85
+            {
86
+                for (int k = 1; k < 3; k++)
87
+                {
88
+                    m_dupPicOne[k] = X265_MALLOC(pixel, widthC * heightC);
89
+                    m_dupPicTwo[k] = X265_MALLOC(pixel, widthC * heightC);
90
+                }
91
+            }
92
+        }
93
+    }
94
+
95
+    if (m_param->bHistBasedSceneCut)
96
+    {
97
+        for (int i = 0; i < x265_cli_csps[m_param->internalCsp].planes; i++)
98
+        {
99
+            m_planeSizes[i] = (m_param->sourceWidth >> x265_cli_csps[p->internalCsp].width[i]) * (m_param->sourceHeight >> x265_cli_csps[m_param->internalCsp].height[i]);
100
+        }
101
+        uint32_t pixelbytes = m_param->internalBitDepth > 8 ? 2 : 1;
102
+        m_edgePic = X265_MALLOC(pixel, m_planeSizes[0] * pixelbytes);
103
+        m_edgeHistThreshold = m_param->edgeTransitionThreshold;
104
+        m_chromaHistThreshold = m_edgeHistThreshold * 10.0;
105
+        m_chromaHistThreshold = x265_min(m_chromaHistThreshold, MAX_SCENECUT_THRESHOLD);
106
+        m_scaledEdgeThreshold = m_edgeHistThreshold * SCENECUT_STRENGTH_FACTOR;
107
+        m_scaledEdgeThreshold = x265_min(m_scaledEdgeThreshold, MAX_SCENECUT_THRESHOLD);
108
+        m_scaledChromaThreshold = m_chromaHistThreshold * SCENECUT_STRENGTH_FACTOR;
109
+        m_scaledChromaThreshold = x265_min(m_scaledChromaThreshold, MAX_SCENECUT_THRESHOLD);
110
+        if (m_param->sourceBitDepth != m_param->internalBitDepth)
111
+        {
112
+            int size = m_param->sourceWidth * m_param->sourceHeight;
113
+            int hshift = CHROMA_H_SHIFT(m_param->internalCsp);
114
+            int vshift = CHROMA_V_SHIFT(m_param->internalCsp);
115
+            int widthC = m_param->sourceWidth >> hshift;
116
+            int heightC = m_param->sourceHeight >> vshift;
117
+
118
+            m_inputPic[0] = X265_MALLOC(pixel, size);
119
+            if (m_param->internalCsp != X265_CSP_I400)
120
+            {
121
+                for (int j = 1; j < 3; j++)
122
+                {
123
+                    m_inputPic[j] = X265_MALLOC(pixel, widthC * heightC);
124
+                }
125
+            }
126
+        }
127
+    }
128
+
129
     // Do not allow WPP if only one row or fewer than 3 columns, it is pointless and unstable
130
     if (rows == 1 || cols < 3)
131
     {
132
@@ -273,7 +363,13 @@
133
             lookAheadThreadPool[i].start();
134
     m_lookahead->m_numPools = pools;
135
     m_dpb = new DPB(m_param);
136
-    m_rateControl = new RateControl(*m_param);
137
+    m_rateControl = new RateControl(*m_param, this);
138
+    if (!m_param->bResetZoneConfig)
139
+    {
140
+        zoneReadCount = new ThreadSafeInteger[m_param->rc.zonefileCount];
141
+        zoneWriteCount = new ThreadSafeInteger[m_param->rc.zonefileCount];
142
+    }
143
+
144
     initVPS(&m_vps);
145
     initSPS(&m_sps);
146
     initPPS(&m_pps);
147
@@ -396,15 +492,6 @@
148
             m_aborted = true;
149
         }
150
     }
151
-    if (m_param->analysisLoad && m_param->bUseAnalysisFile)
152
-    {
153
-        m_analysisFileIn = x265_fopen(m_param->analysisLoad, "rb");
154
-        if (!m_analysisFileIn)
155
-        {
156
-            x265_log_file(NULL, X265_LOG_ERROR, "Analysis load: failed to open file %s\n", m_param->analysisLoad);
157
-            m_aborted = true;
158
-        }
159
-    }
160
 
161
     if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
162
     {
163
@@ -572,7 +659,7 @@
164
     if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)
165
     {
166
         curFrame->m_analysisData.sliceType = X265_TYPE_I;
167
-        if (m_param->analysisReuseLevel < 7)
168
+        if (m_param->analysisLoadReuseLevel < 7)
169
             return -1;
170
         curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
171
         int num16x16inCUWidth = m_param->maxCUSize >> 4;
172
@@ -602,7 +689,7 @@
173
     else
174
     {
175
         uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;
176
-        if (m_param->analysisReuseLevel < 7)
177
+        if (m_param->analysisLoadReuseLevel < 7)
178
             return -1;
179
         curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
180
         int num16x16inCUWidth = m_param->maxCUSize >> 4;
181
@@ -644,7 +731,7 @@
182
                             (interData)->mvpIdx[k][cuPos + cuOffset] = (srcInterData)->mvpIdx[k][(mbIndex * 16) + cuOffset];
183
                             (interData)->refIdx[k][cuPos + cuOffset] = (srcInterData)->refIdx[k][(mbIndex * 16) + cuOffset];
184
                             memcpy(&(interData)->mv[k][cuPos + cuOffset], &(srcInterData)->mv[k][(mbIndex * 16) + cuOffset], sizeof(MV));
185
-                            if (m_param->analysisReuseLevel == 7 && numPU == PU_2Nx2N &&
186
+                            if (m_param->analysisLoadReuseLevel == 7 && numPU == PU_2Nx2N &&
187
                                 ((interData)->depth[cuPos + cuOffset] == (m_param->maxCUSize >> 5)))
188
                             {
189
                                 int mv_x = (interData)->mv[k][cuPos + cuOffset].x;
190
@@ -678,7 +765,7 @@
191
             if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)
192
             {
193
                 curFrame->m_analysisData.sliceType = X265_TYPE_I;
194
-                if (m_param->analysisReuseLevel < 2)
195
+                if (m_param->analysisLoadReuseLevel < 2)
196
                     return -1;
197
 
198
                 curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
199
@@ -699,7 +786,7 @@
200
             else
201
             {
202
                 uint32_t numDir = analysis_data->sliceType == X265_TYPE_P ? 1 : 2;
203
-                if (m_param->analysisReuseLevel < 2)
204
+                if (m_param->analysisLoadReuseLevel < 2)
205
                     return -1;
206
 
207
                 curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
208
@@ -712,7 +799,7 @@
209
                     memset(&(currInterData)->depth[count], (interData)->depth[d], bytes);
210
                     memset(&(currInterData)->modes[count], (interData)->modes[d], bytes);
211
                     memcpy(&(currInterData)->sadCost[count], &(analysis_data->interData)->sadCost[d], bytes);
212
-                    if (m_param->analysisReuseLevel > 4)
213
+                    if (m_param->analysisLoadReuseLevel > 4)
214
                     {
215
                         memset(&(currInterData)->partSize[count], (interData)->partSize[d], bytes);
216
                         int numPU = nbPartsTable[(interData)->partSize[d]];
217
@@ -720,7 +807,7 @@
218
                         {
219
                             if (pu) d++;
220
                             (currInterData)->mergeFlag[count + pu] = (interData)->mergeFlag[d];
221
-                            if (m_param->analysisReuseLevel >= 7)
222
+                            if (m_param->analysisLoadReuseLevel >= 7)
223
                             {
224
                                 (currInterData)->interDir[count + pu] = (interData)->interDir[d];
225
                                 for (uint32_t i = 0; i < numDir; i++)
226
@@ -728,7 +815,7 @@
227
                                     (currInterData)->mvpIdx[i][count + pu] = (interData)->mvpIdx[i][d];
228
                                     (currInterData)->refIdx[i][count + pu] = (interData)->refIdx[i][d];
229
                                     memcpy(&(currInterData)->mv[i][count + pu], &(interData)->mv[i][d], sizeof(MV));
230
-                                    if (m_param->analysisReuseLevel == 7 && numPU == PU_2Nx2N && m_param->num4x4Partitions <= 16)
231
+                                    if (m_param->analysisLoadReuseLevel == 7 && numPU == PU_2Nx2N && m_param->num4x4Partitions <= 16)
232
                                     {
233
                                         int mv_x = (currInterData)->mv[i][count + pu].x;
234
                                         int mv_y = (currInterData)->mv[i][count + pu].y;
235
@@ -771,6 +858,53 @@
236
         m_exportedPic = NULL;
237
     }
238
 
239
+    if (m_param->bEnableFrameDuplication)
240
+    {
241
+        for (uint32_t i = 0; i < DUP_BUFFER; i++)
242
+        {
243
+            X265_FREE(m_dupBuffer[i]->dupPlane);
244
+            x265_picture_free(m_dupBuffer[i]->dupPic);
245
+            X265_FREE(m_dupBuffer[i]);
246
+        }
247
+
248
+        if (!(m_param->sourceBitDepth == 8 && m_param->internalBitDepth == 8))
249
+        {
250
+            for (int k = 0; k < 3; k++)
251
+            {
252
+                if (k == 0)
253
+                {
254
+                    X265_FREE(m_dupPicOne[k]);
255
+                    X265_FREE(m_dupPicTwo[k]);
256
+                }
257
+                else if(k >= 1 && m_param->internalCsp != X265_CSP_I400)
258
+                {
259
+                    X265_FREE(m_dupPicOne[k]);
260
+                    X265_FREE(m_dupPicTwo[k]);
261
+                }
262
+            }
263
+        }
264
+    }
265
+
266
+    if (m_param->bHistBasedSceneCut)
267
+    {
268
+        if (m_edgePic != NULL)
269
+        {
270
+            X265_FREE_ZERO(m_edgePic);
271
+        }
272
+
273
+        if (m_param->sourceBitDepth != m_param->internalBitDepth)
274
+        {
275
+            X265_FREE_ZERO(m_inputPic[0]);
276
+            if (m_param->internalCsp != X265_CSP_I400)
277
+            {
278
+                for (int i = 1; i < 3; i++)
279
+                {
280
+                    X265_FREE_ZERO(m_inputPic[i]);
281
+                }
282
+            }
283
+        }
284
+    }
285
+
286
     for (int i = 0; i < m_param->frameNumThreads; i++)
287
     {
288
         if (m_frameEncoder[i])
289
@@ -791,6 +925,11 @@
290
     }
291
 
292
     delete m_dpb;
293
+    if (!m_param->bResetZoneConfig && m_param->rc.zonefileCount)
294
+    {
295
+        delete[] zoneReadCount;
296
+        delete[] zoneWriteCount;
297
+    }
298
     if (m_rateControl)
299
     {
300
         m_rateControl->destroy();
301
@@ -981,6 +1120,449 @@
302
     }
303
 }
304
 
305
+//Find Sum of Squared Difference (SSD) between two pictures
306
+uint64_t Encoder::computeSSD(pixel *fenc, pixel *rec, intptr_t stride, uint32_t width, uint32_t height, x265_param *param)
307
+{
308
+    uint64_t ssd = 0;
309
+
310
+    if (!param->bEnableFrameDuplication || (width & 3))
311
+    {
312
+        if ((width | height) & 3)
313
+        {
314
+            /* Slow Path */
315
+            for (uint32_t y = 0; y < height; y++)
316
+            {
317
+                for (uint32_t x = 0; x < width; x++)
318
+                {
319
+                    int diff = (int)(fenc[x] - rec[x]);
320
+                    ssd += diff * diff;
321
+                }
322
+
323
+                fenc += stride;
324
+                rec += stride;
325
+            }
326
+
327
+            return ssd;
328
+        }
329
+    }
330
+
331
+    uint32_t y = 0;
332
+
333
+    /* Consume rows in ever narrower chunks of height */
334
+    for (int size = BLOCK_64x64; size >= BLOCK_4x4 && y < height; size--)
335
+    {
336
+        uint32_t rowHeight = 1 << (size + 2);
337
+
338
+        for (; y + rowHeight <= height; y += rowHeight)
339
+        {
340
+            uint32_t y1, x = 0;
341
+
342
+            /* Consume each row using the largest square blocks possible */
343
+            if (size == BLOCK_64x64 && !(stride & 31))
344
+                for (; x + 64 <= width; x += 64)
345
+                    ssd += primitives.cu[BLOCK_64x64].sse_pp(fenc + x, stride, rec + x, stride);
346
+
347
+            if (size >= BLOCK_32x32 && !(stride & 15))
348
+                for (; x + 32 <= width; x += 32)
349
+                    for (y1 = 0; y1 + 32 <= rowHeight; y1 += 32)
350
+                        ssd += primitives.cu[BLOCK_32x32].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
351
+
352
+            if (size >= BLOCK_16x16)
353
+                for (; x + 16 <= width; x += 16)
354
+                    for (y1 = 0; y1 + 16 <= rowHeight; y1 += 16)
355
+                        ssd += primitives.cu[BLOCK_16x16].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
356
+
357
+            if (size >= BLOCK_8x8)
358
+                for (; x + 8 <= width; x += 8)
359
+                    for (y1 = 0; y1 + 8 <= rowHeight; y1 += 8)
360
+                        ssd += primitives.cu[BLOCK_8x8].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
361
+
362
+            for (; x + 4 <= width; x += 4)
363
+                for (y1 = 0; y1 + 4 <= rowHeight; y1 += 4)
364
+                    ssd += primitives.cu[BLOCK_4x4].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
365
+
366
+            fenc += stride * rowHeight;
367
+            rec += stride * rowHeight;
368
+        }
369
+    }
370
+
371
+    /* Handle last few rows of frames for videos 
372
+    with height not divisble by 4 */
373
+    uint32_t h = height % y;
374
+    if (param->bEnableFrameDuplication && h)
375
+    {
376
+        for (uint32_t i = 0; i < h; i++)
377
+        {
378
+            for (uint32_t j = 0; j < width; j++)
379
+            {
380
+                int diff = (int)(fenc[j] - rec[j]);
381
+                ssd += diff * diff;
382
+            }
383
+
384
+            fenc += stride;
385
+            rec += stride;
386
+        }
387
+    }
388
+
389
+    return ssd;
390
+}
391
+
392
+//Compute the PSNR weightage between two pictures
393
+double Encoder::ComputePSNR(x265_picture *firstPic, x265_picture *secPic, x265_param *param)
394
+{
395
+    uint64_t ssdY = 0, ssdU = 0, ssdV = 0;
396
+    intptr_t strideL, strideC;
397
+    uint32_t widthL, heightL, widthC, heightC;
398
+    double psnrY = 0, psnrU = 0, psnrV = 0, psnrWeight = 0;
399
+    int width = firstPic->width;
400
+    int height = firstPic->height;
401
+    int hshift = CHROMA_H_SHIFT(firstPic->colorSpace);
402
+    int vshift = CHROMA_V_SHIFT(firstPic->colorSpace);
403
+    pixel *yFirstPic = NULL, *ySecPic = NULL;
404
+    pixel *uFirstPic = NULL, *uSecPic = NULL;
405
+    pixel *vFirstPic = NULL, *vSecPic = NULL;
406
+
407
+    strideL = widthL = width;
408
+    heightL = height;
409
+
410
+    strideC = widthC = widthL >> hshift;
411
+    heightC = heightL >> vshift;
412
+
413
+    int size = width * height;
414
+    int maxvalY = 255 << (X265_DEPTH - 8);
415
+    int maxvalC = 255 << (X265_DEPTH - 8);
416
+    double refValueY = (double)maxvalY * maxvalY * size;
417
+    double refValueC = (double)maxvalC * maxvalC * size / 4.0;
418
+
419
+    if (firstPic->bitDepth == 8 && X265_DEPTH == 8)
420
+    {
421
+        yFirstPic = (pixel*)firstPic->planes[0];
422
+        ySecPic = (pixel*)secPic->planes[0];
423
+        if (param->internalCsp != X265_CSP_I400)
424
+        {
425
+            uFirstPic = (pixel*)firstPic->planes[1];
426
+            uSecPic = (pixel*)secPic->planes[1];
427
+            vFirstPic = (pixel*)firstPic->planes[2];
428
+            vSecPic = (pixel*)secPic->planes[2];
429
+        }
430
+    }
431
+    else if (firstPic->bitDepth == 8 && X265_DEPTH > 8)
432
+    {
433
+        int shift = (X265_DEPTH - 8);
434
+        uint8_t *yChar1, *yChar2, *uChar1, *uChar2, *vChar1, *vChar2;
435
+
436
+        yChar1 = (uint8_t*)firstPic->planes[0];
437
+        yChar2 = (uint8_t*)secPic->planes[0];
438
+
439
+        primitives.planecopy_cp(yChar1, firstPic->stride[0] / sizeof(*yChar1), m_dupPicOne[0], firstPic->stride[0] / sizeof(*yChar1), width, height, shift);
440
+        primitives.planecopy_cp(yChar2, secPic->stride[0] / sizeof(*yChar2), m_dupPicTwo[0], secPic->stride[0] / sizeof(*yChar2), width, height, shift);
441
+
442
+        if (param->internalCsp != X265_CSP_I400)
443
+        {
444
+            uChar1 = (uint8_t*)firstPic->planes[1];
445
+            uChar2 = (uint8_t*)secPic->planes[1];
446
+            vChar1 = (uint8_t*)firstPic->planes[2];
447
+            vChar2 = (uint8_t*)secPic->planes[2];
448
+
449
+            primitives.planecopy_cp(uChar1, firstPic->stride[1] / sizeof(*uChar1), m_dupPicOne[1], firstPic->stride[1] / sizeof(*uChar1), widthC, heightC, shift);
450
+            primitives.planecopy_cp(uChar2, secPic->stride[1] / sizeof(*uChar2), m_dupPicTwo[1], secPic->stride[1] / sizeof(*uChar2), widthC, heightC, shift);
451
+
452
+            primitives.planecopy_cp(vChar1, firstPic->stride[2] / sizeof(*vChar1), m_dupPicOne[2], firstPic->stride[2] / sizeof(*vChar1), widthC, heightC, shift);
453
+            primitives.planecopy_cp(vChar2, secPic->stride[2] / sizeof(*vChar2), m_dupPicTwo[2], secPic->stride[2] / sizeof(*vChar2), widthC, heightC, shift);
454
+        }
455
+    }
456
+    else
457
+    {
458
+        uint16_t *yShort1, *yShort2, *uShort1, *uShort2, *vShort1, *vShort2;
459
+        /* defensive programming, mask off bits that are supposed to be zero */
460
+        uint16_t mask = (1 << X265_DEPTH) - 1;
461
+        int shift = abs(firstPic->bitDepth - X265_DEPTH);
462
+
463
+        yShort1 = (uint16_t*)firstPic->planes[0];
464
+        yShort2 = (uint16_t*)secPic->planes[0];
465
+
466
+        if (firstPic->bitDepth > X265_DEPTH)
467
+        {
468
+            /* shift right and mask pixels to final size */
469
+            primitives.planecopy_sp(yShort1, firstPic->stride[0] / sizeof(*yShort1), m_dupPicOne[0], firstPic->stride[0] / sizeof(*yShort1), width, height, shift, mask);
470
+            primitives.planecopy_sp(yShort2, secPic->stride[0] / sizeof(*yShort2), m_dupPicTwo[0], secPic->stride[0] / sizeof(*yShort2), width, height, shift, mask);
471
+        }
472
+        else /* Case for (pic.bitDepth <= X265_DEPTH) */
473
+        {
474
+            /* shift left and mask pixels to final size */
475
+            primitives.planecopy_sp_shl(yShort1, firstPic->stride[0] / sizeof(*yShort1), m_dupPicOne[0], firstPic->stride[0] / sizeof(*yShort1), width, height, shift, mask);
476
+            primitives.planecopy_sp_shl(yShort2, secPic->stride[0] / sizeof(*yShort2), m_dupPicTwo[0], secPic->stride[0] / sizeof(*yShort2), width, height, shift, mask);
477
+        }
478
+
479
+        if (param->internalCsp != X265_CSP_I400)
480
+        {
481
+            uShort1 = (uint16_t*)firstPic->planes[1];
482
+            uShort2 = (uint16_t*)secPic->planes[1];
483
+            vShort1 = (uint16_t*)firstPic->planes[2];
484
+            vShort2 = (uint16_t*)secPic->planes[2];
485
+
486
+            if (firstPic->bitDepth > X265_DEPTH)
487
+            {
488
+                primitives.planecopy_sp(uShort1, firstPic->stride[1] / sizeof(*uShort1), m_dupPicOne[1], firstPic->stride[1] / sizeof(*uShort1), widthC, heightC, shift, mask);
489
+                primitives.planecopy_sp(uShort2, secPic->stride[1] / sizeof(*uShort2), m_dupPicTwo[1], secPic->stride[1] / sizeof(*uShort2), widthC, heightC, shift, mask);
490
+
491
+                primitives.planecopy_sp(vShort1, firstPic->stride[2] / sizeof(*vShort1), m_dupPicOne[2], firstPic->stride[2] / sizeof(*vShort1), widthC, heightC, shift, mask);
492
+                primitives.planecopy_sp(vShort2, secPic->stride[2] / sizeof(*vShort2), m_dupPicTwo[2], secPic->stride[2] / sizeof(*vShort2), widthC, heightC, shift, mask);
493
+            }
494
+            else /* Case for (pic.bitDepth <= X265_DEPTH) */
495
+            {
496
+                primitives.planecopy_sp_shl(uShort1, firstPic->stride[1] / sizeof(*uShort1), m_dupPicOne[1], firstPic->stride[1] / sizeof(*uShort1), widthC, heightC, shift, mask);
497
+                primitives.planecopy_sp_shl(uShort2, secPic->stride[1] / sizeof(*uShort2), m_dupPicTwo[1], secPic->stride[1] / sizeof(*uShort2), widthC, heightC, shift, mask);
498
+
499
+                primitives.planecopy_sp_shl(vShort1, firstPic->stride[2] / sizeof(*vShort1), m_dupPicOne[2], firstPic->stride[2] / sizeof(*vShort1), widthC, heightC, shift, mask);
500
+                primitives.planecopy_sp_shl(vShort2, secPic->stride[2] / sizeof(*vShort2), m_dupPicTwo[2], secPic->stride[2] / sizeof(*vShort2), widthC, heightC, shift, mask);
501
+            }
502
+        }
503
+    }
504
+
505
+    if (!(firstPic->bitDepth == 8 && X265_DEPTH == 8))
506
+    {
507
+        yFirstPic = m_dupPicOne[0]; ySecPic = m_dupPicTwo[0];
508
+        uFirstPic = m_dupPicOne[1]; uSecPic = m_dupPicTwo[1];
509
+        vFirstPic = m_dupPicOne[2]; vSecPic = m_dupPicTwo[2];
510
+    }
511
+
512
+    //Compute SSD
513
+    ssdY = computeSSD(yFirstPic, ySecPic, strideL, widthL, heightL, param);
514
+    psnrY = (ssdY ? 10.0 * log10(refValueY / (double)ssdY) : 99.99);
515
+
516
+    if (param->internalCsp != X265_CSP_I400)
517
+    {
518
+        ssdU = computeSSD(uFirstPic, uSecPic, strideC, widthC, heightC, param);
519
+        ssdV = computeSSD(vFirstPic, vSecPic, strideC, widthC, heightC, param);
520
+        psnrU = (ssdU ? 10.0 * log10(refValueC / (double)ssdU) : 99.99);
521
+        psnrV = (ssdV ? 10.0 * log10(refValueC / (double)ssdV) : 99.99);
522
+    }
523
+
524
+    //Compute PSNR(picN,pic(N+1))
525
+    return psnrWeight = (psnrY * 6 + psnrU + psnrV) / 8;
526
+}
527
+
528
+void Encoder::copyPicture(x265_picture *dest, const x265_picture *src)
529
+{
530
+    dest->poc = src->poc;
531
+    dest->pts = src->pts;
532
+    dest->userSEI = src->userSEI;
533
+    dest->bitDepth = src->bitDepth;
534
+    dest->framesize = src->framesize;
535
+    dest->height = src->height;
536
+    dest->width = src->width;
537
+    dest->colorSpace = src->colorSpace;
538
+    dest->userSEI = src->userSEI;
539
+    dest->rpu.payload = src->rpu.payload;
540
+    dest->picStruct = src->picStruct;
541
+    dest->stride[0] = src->stride[0];
542
+    dest->stride[1] = src->stride[1];
543
+    dest->stride[2] = src->stride[2];
544
+    memcpy(dest->planes[0], src->planes[0], src->framesize * sizeof(char));
545
+    dest->planes[1] = (char*)dest->planes[0] + src->stride[0] * src->height;
546
+    dest->planes[2] = (char*)dest->planes[1] + src->stride[1] * (src->height >> x265_cli_csps[src->colorSpace].height[1]);
547
+}
548
+
549
+bool Encoder::computeHistograms(x265_picture *pic)
550
+{
551
+    pixel *src = NULL, *planeV = NULL, *planeU = NULL;
552
+    uint32_t widthC, heightC;
553
+    int hshift, vshift;
554
+
555
+    hshift = CHROMA_H_SHIFT(pic->colorSpace);
556
+    vshift = CHROMA_V_SHIFT(pic->colorSpace);
557
+    widthC = pic->width >> hshift;
558
+    heightC = pic->height >> vshift;
559
+
560
+    if (pic->bitDepth == X265_DEPTH)
561
+    {
562
+        src = (pixel*)pic->planes[0];
563
+        if (m_param->internalCsp != X265_CSP_I400)
564
+        {
565
+            planeU = (pixel*)pic->planes[1];
566
+            planeV = (pixel*)pic->planes[2];
567
+        }
568
+    }
569
+    else if (pic->bitDepth == 8 && X265_DEPTH > 8)
570
+    {
571
+        int shift = (X265_DEPTH - 8);
572
+        uint8_t *yChar, *uChar, *vChar;
573
+
574
+        yChar = (uint8_t*)pic->planes[0];
575
+        primitives.planecopy_cp(yChar, pic->stride[0] / sizeof(*yChar), m_inputPic[0], pic->stride[0] / sizeof(*yChar), pic->width, pic->height, shift);
576
+        src = m_inputPic[0];
577
+        if (m_param->internalCsp != X265_CSP_I400)
578
+        {
579
+            uChar = (uint8_t*)pic->planes[1];
580
+            vChar = (uint8_t*)pic->planes[2];
581
+            primitives.planecopy_cp(uChar, pic->stride[1] / sizeof(*uChar), m_inputPic[1], pic->stride[1] / sizeof(*uChar), widthC, heightC, shift);
582
+            primitives.planecopy_cp(vChar, pic->stride[2] / sizeof(*vChar), m_inputPic[2], pic->stride[2] / sizeof(*vChar), widthC, heightC, shift);
583
+            planeU = m_inputPic[1];
584
+            planeV = m_inputPic[2];
585
+        }
586
+    }
587
+    else
588
+    {
589
+        uint16_t *yShort, *uShort, *vShort;
590
+        /* mask off bits that are supposed to be zero */
591
+        uint16_t mask = (1 << X265_DEPTH) - 1;
592
+        int shift = abs(pic->bitDepth - X265_DEPTH);
593
+
594
+        yShort = (uint16_t*)pic->planes[0];
595
+        uShort = (uint16_t*)pic->planes[1];
596
+        vShort = (uint16_t*)pic->planes[2];
597
+
598
+        if (pic->bitDepth > X265_DEPTH)
599
+        {
600
+            /* shift right and mask pixels to final size */
601
+            primitives.planecopy_sp(yShort, pic->stride[0] / sizeof(*yShort), m_inputPic[0], pic->stride[0] / sizeof(*yShort), pic->width, pic->height, shift, mask);
602
+            if (m_param->internalCsp != X265_CSP_I400)
603
+            {
604
+                primitives.planecopy_sp(uShort, pic->stride[1] / sizeof(*uShort), m_inputPic[1], pic->stride[1] / sizeof(*uShort), widthC, heightC, shift, mask);
605
+                primitives.planecopy_sp(vShort, pic->stride[2] / sizeof(*vShort), m_inputPic[2], pic->stride[2] / sizeof(*vShort), widthC, heightC, shift, mask);
606
+            }
607
+        }
608
+        else /* Case for (pic.bitDepth < X265_DEPTH) */
609
+        {
610
+            /* shift left and mask pixels to final size */
611
+            primitives.planecopy_sp_shl(yShort, pic->stride[0] / sizeof(*yShort), m_inputPic[0], pic->stride[0] / sizeof(*yShort), pic->width, pic->height, shift, mask);
612
+            if (m_param->internalCsp != X265_CSP_I400)
613
+            {
614
+                primitives.planecopy_sp_shl(uShort, pic->stride[1] / sizeof(*uShort), m_inputPic[1], pic->stride[1] / sizeof(*uShort), widthC, heightC, shift, mask);
615
+                primitives.planecopy_sp_shl(vShort, pic->stride[2] / sizeof(*vShort), m_inputPic[2], pic->stride[2] / sizeof(*vShort), widthC, heightC, shift, mask);
616
+            }
617
+        }
618
+
619
+        src = m_inputPic[0];
620
+        planeU = m_inputPic[1];
621
+        planeV = m_inputPic[2];
622
+    }
623
+
624
+    size_t bufSize = sizeof(pixel) * m_planeSizes[0];
625
+    int32_t planeCount = x265_cli_csps[m_param->internalCsp].planes;
626
+    memset(m_edgePic, 0, bufSize);
627
+
628
+    if (!computeEdge(m_edgePic, src, NULL, pic->width, pic->height, pic->width, false))
629
+    {
630
+        x265_log(m_param, X265_LOG_ERROR, "Failed edge computation!");
631
+        return false;
632
+    }
633
+
634
+    pixel pixelVal;
635
+    int32_t *edgeHist = m_curEdgeHist;
636
+    memset(edgeHist, 0, 2 * sizeof(int32_t));
637
+    for (int64_t i = 0; i < m_planeSizes[0]; i++)
638
+    {
639
+        if (!m_edgePic[i])
640
+           edgeHist[0]++;
641
+        else
642
+           edgeHist[1]++;
643
+    }
644
+
645
+    if (pic->colorSpace != X265_CSP_I400)
646
+    {
647
+        /* U Histogram Calculation */
648
+        int32_t *uHist = m_curUVHist[0];
649
+        memset(uHist, 0, HISTOGRAM_BINS * sizeof(int32_t));
650
+
651
+        for (int64_t i = 0; i < m_planeSizes[1]; i++)
652
+        {
653
+            pixelVal = planeU[i];
654
+            uHist[pixelVal]++;
655
+        }
656
+
657
+        /* V Histogram Calculation */
658
+        if (planeCount == 3)
659
+        {
660
+            pixelVal = 0;
661
+            int32_t *vHist = m_curUVHist[1];
662
+            memset(vHist, 0, HISTOGRAM_BINS * sizeof(int32_t));
663
+
664
+            for (int64_t i = 0; i < m_planeSizes[2]; i++)
665
+            {
666
+                pixelVal = planeV[i];
667
+                vHist[pixelVal]++;
668
+            }
669
+            for (int i = 0; i < HISTOGRAM_BINS; i++)
670
+            {
671
+                m_curMaxUVHist[i] = x265_max(uHist[i], vHist[i]);
672
+            }
673
+        }
674
+        else
675
+        {   /* in case of bi planar color space */
676
+            memcpy(m_curMaxUVHist, m_curUVHist[0], HISTOGRAM_BINS * sizeof(int32_t));
677
+        }
678
+    }
679
+    return true;
680
+}
681
+
682
+void Encoder::computeHistogramSAD(double *maxUVNormalizedSad, double *edgeNormalizedSad, int curPoc)
683
+{
684
+
685
+    if (curPoc == 0)
686
+    {   /* first frame is scenecut by default no sad computation for the same. */
687
+        *maxUVNormalizedSad = 0.0;
688
+        *edgeNormalizedSad  = 0.0;
689
+    }
690
+    else
691
+    {
692
+        /* compute sum of absolute difference of normalized histogram bins for maxUV and edge histograms. */
693
+        int32_t edgefreqDiff = 0;
694
+        int32_t maxUVfreqDiff = 0;
695
+        double  edgeProbabilityDiff = 0;
696
+
697
+        for (int j = 0; j < HISTOGRAM_BINS; j++)
698
+        {
699
+            if (j < 2)
700
+            {
701
+                edgefreqDiff = abs(m_curEdgeHist[j] - m_prevEdgeHist[j]);
702
+                edgeProbabilityDiff = (double) edgefreqDiff / m_planeSizes[0];
703
+                *edgeNormalizedSad += edgeProbabilityDiff;
704
+            }
705
+            maxUVfreqDiff = abs(m_curMaxUVHist[j] - m_prevMaxUVHist[j]);
706
+            *maxUVNormalizedSad += (double)maxUVfreqDiff / m_planeSizes[2];
707
+        }
708
+    }
709
+
710
+    /* store histograms of previous frame for reference */
711
+    size_t bufsize = HISTOGRAM_BINS * sizeof(int32_t);
712
+    memcpy(m_prevMaxUVHist, m_curMaxUVHist, bufsize);
713
+    memcpy(m_prevEdgeHist, m_curEdgeHist, 2 * sizeof(int32_t));
714
+}
715
+
716
+void Encoder::findSceneCuts(x265_picture *pic, bool& bDup, double maxUVSad, double edgeSad)
717
+{
718
+    pic->frameData.bScenecut = false;
719
+
720
+    if (pic->poc == 0)
721
+    {
722
+        /* for first frame */
723
+        pic->frameData.bScenecut = false;
724
+        bDup = false;
725
+    }
726
+    else
727
+    {
728
+        if (edgeSad == 0.0 && maxUVSad == 0.0)
729
+        {
730
+            bDup = true;
731
+        }
732
+        else if (edgeSad > m_edgeHistThreshold && maxUVSad >= m_chromaHistThreshold)
733
+        {
734
+            pic->frameData.bScenecut = true;
735
+            bDup = false;
736
+        }
737
+        else if (edgeSad > m_scaledEdgeThreshold || maxUVSad >= m_scaledChromaThreshold)
738
+        {
739
+            pic->frameData.bScenecut = true;
740
+            bDup = false;
741
+        }
742
+    }
743
+
744
+    if (pic->frameData.bScenecut)
745
+       x265_log(m_param, X265_LOG_DEBUG, "scene cut at %d \n", pic->poc);
746
+}
747
+
748
 /**
749
  * Feed one new input frame into the encoder, get one frame out. If pic_in is
750
  * NULL, a flush condition is implied and pic_in must be NULL for all subsequent
751
@@ -1004,6 +1586,12 @@
752
     if (m_aborted)
753
         return -1;
754
 
755
+    const x265_picture* inputPic = NULL;
756
+    static int written = 0, read = 0;
757
+    bool dontRead = false;
758
+    bool bdropFrame = false;
759
+    bool dropflag = false;
760
+
761
     if (m_exportedPic)
762
     {
763
         if (!m_param->bUseAnalysisFile && m_param->analysisSave)
764
@@ -1012,33 +1600,121 @@
765
         m_exportedPic = NULL;
766
         m_dpb->recycleUnreferenced();
767
     }
768
-    if (pic_in && (!m_param->chunkEnd || (m_encodedFrameNum < m_param->chunkEnd)))
769
+    if ((pic_in && (!m_param->chunkEnd || (m_encodedFrameNum < m_param->chunkEnd))) || (m_param->bEnableFrameDuplication && !pic_in && (read < written)))
770
     {
771
-        if (m_latestParam->forceFlush == 1)
772
+        if (m_param->bHistBasedSceneCut && pic_in)
773
         {
774
-            m_lookahead->setLookaheadQueue();
775
-            m_latestParam->forceFlush = 0;
776
+            x265_picture *pic = (x265_picture *) pic_in;
777
+            if (computeHistograms(pic))
778
+            {
779
+                double maxUVSad = 0.0, edgeSad = 0.0;
780
+                computeHistogramSAD(&maxUVSad, &edgeSad, pic_in->poc);
781
+                findSceneCuts(pic, bdropFrame, maxUVSad, edgeSad);
782
+            }
783
         }
784
-        if (m_latestParam->forceFlush == 2)
785
+
786
+        if ((m_param->bEnableFrameDuplication && !pic_in && (read < written)))
787
+            dontRead = true;
788
+        else
789
         {
790
-            m_lookahead->m_filled = false;
791
-            m_latestParam->forceFlush = 0;
792
+            if (m_latestParam->forceFlush == 1)
793
+            {
794
+                m_lookahead->setLookaheadQueue();
795
+                m_latestParam->forceFlush = 0;
796
+            }
797
+            if (m_latestParam->forceFlush == 2)
798
+            {
799
+                m_lookahead->m_filled = false;
800
+                m_latestParam->forceFlush = 0;
801
+            }
802
+
803
+            if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
804
+            {
805
+                x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must be between 8 and 16\n",
806
+                         pic_in->bitDepth);
807
+                return -1;
808
+            }
809
         }
810
 
811
-        if (pic_in->bitDepth < 8 || pic_in->bitDepth > 16)
812
+        if (m_param->bEnableFrameDuplication)
813
         {
814
-            x265_log(m_param, X265_LOG_ERROR, "Input bit depth (%d) must be between 8 and 16\n",
815
-                     pic_in->bitDepth);
816
-            return -1;
817
+            double psnrWeight = 0;
818
+
819
+            if (!dontRead)
820
+            {
821
+                if (!m_dupBuffer[0]->bOccupied)
822
+                {
823
+                    copyPicture(m_dupBuffer[0]->dupPic, pic_in);
824
+                    m_dupBuffer[0]->bOccupied = true;
825
+                    written++;
826
+                    return 0;
827
+                }
828
+                else if (!m_dupBuffer[1]->bOccupied)
829
+                {
830
+                    copyPicture(m_dupBuffer[1]->dupPic, pic_in);
831
+                    m_dupBuffer[1]->bOccupied = true;
832
+                    written++;
833
+                }
834
+
835
+                if (m_param->bEnableFrameDuplication && m_param->bHistBasedSceneCut)
836
+                {
837
+                    if (!bdropFrame && m_dupBuffer[1]->dupPic->frameData.bScenecut == false)
838
+                    {
839
+                        psnrWeight = ComputePSNR(m_dupBuffer[0]->dupPic, m_dupBuffer[1]->dupPic, m_param);
840
+                        if (psnrWeight >= m_param->dupThreshold)
841
+                            dropflag = true;
842
+                    }
843
+                    else
844
+                    {
845
+                        dropflag = true;
846
+                    }
847
+                }
848
+                else if (m_param->bEnableFrameDuplication)
849
+                {
850
+                    psnrWeight = ComputePSNR(m_dupBuffer[0]->dupPic, m_dupBuffer[1]->dupPic, m_param);
851
+                    if (psnrWeight >= m_param->dupThreshold)
852
+                        dropflag = true;
853
+                }
854
+
855
+                if (dropflag)
856
+                {
857
+                    if (m_dupBuffer[0]->bDup)
858
+                    {
859
+                        m_dupBuffer[0]->dupPic->picStruct = tripling;
860
+                        m_dupBuffer[0]->bDup = false;
861
+                        read++;
862
+                    }
863
+                    else
864
+                    {
865
+                        m_dupBuffer[0]->dupPic->picStruct = doubling;
866
+                        m_dupBuffer[0]->bDup = true;
867
+                        m_dupBuffer[1]->bOccupied = false;
868
+                        read++;
869
+                        return 0;
870
+                    }
871
+                }
872
+                else if (m_dupBuffer[0]->bDup)
873
+                    m_dupBuffer[0]->bDup = false;
874
+                else
875
+                    m_dupBuffer[0]->dupPic->picStruct = 0;
876
+            }
877
+
878
+            if (read < written)
879
+            {
880
+                inputPic = m_dupBuffer[0]->dupPic;
881
+                read++;
882
+            }
883
         }
884
+        else
885
+            inputPic = pic_in;
886
 
887
         Frame *inFrame;
888
-        x265_param* p = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param;
889
+        x265_param *p = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param;
890
         if (m_dpb->m_freeList.empty())
891
         {
892
             inFrame = new Frame;
893
             inFrame->m_encodeStartTime = x265_mdate();
894
-            if (inFrame->create(p, pic_in->quantOffsets))
895
+            if (inFrame->create(p, inputPic->quantOffsets))
896
             {
897
                 /* the first PicYuv created is asked to generate the CU and block unit offset
898
                  * arrays which are then shared with all subsequent PicYuv (orig and recon) 
899
@@ -1098,34 +1774,39 @@
900
         }
901
 
902
         /* Copy input picture into a Frame and PicYuv, send to lookahead */
903
-        inFrame->m_fencPic->copyFromPicture(*pic_in, *m_param, m_sps.conformanceWindow.rightOffset, m_sps.conformanceWindow.bottomOffset);
904
+        inFrame->m_fencPic->copyFromPicture(*inputPic, *m_param, m_sps.conformanceWindow.rightOffset, m_sps.conformanceWindow.bottomOffset);
905
 
906
         inFrame->m_poc       = ++m_pocLast;
907
-        inFrame->m_userData  = pic_in->userData;
908
-        inFrame->m_pts       = pic_in->pts;
909
-        inFrame->m_forceqp   = pic_in->forceqp;
910
+        inFrame->m_userData  = inputPic->userData;
911
+        inFrame->m_pts       = inputPic->pts;
912
+        if (m_param->bHistBasedSceneCut)
913
+        {
914
+            inFrame->m_lowres.bScenecut = (inputPic->frameData.bScenecut == 1) ? true : false;
915
+        }
916
+        inFrame->m_forceqp   = inputPic->forceqp;
917
         inFrame->m_param     = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param;
918
+        inFrame->m_picStruct = inputPic->picStruct;
919
         if (m_param->bField && m_param->interlaceMode)
920
-            inFrame->m_fieldNum = pic_in->fieldNum;
921
+            inFrame->m_fieldNum = inputPic->fieldNum;
922
 
923
-        copyUserSEIMessages(inFrame, pic_in);
924
+        copyUserSEIMessages(inFrame, inputPic);
925
 
926
-        /*Copy Dolby Vision RPU from pic_in to frame*/
927
-        if (pic_in->rpu.payloadSize)
928
+        /*Copy Dolby Vision RPU from inputPic to frame*/
929
+        if (inputPic->rpu.payloadSize)
930
         {
931
-            inFrame->m_rpu.payloadSize = pic_in->rpu.payloadSize;
932
-            inFrame->m_rpu.payload = new uint8_t[pic_in->rpu.payloadSize];
933
-            memcpy(inFrame->m_rpu.payload, pic_in->rpu.payload, pic_in->rpu.payloadSize);
934
+            inFrame->m_rpu.payloadSize = inputPic->rpu.payloadSize;
935
+            inFrame->m_rpu.payload = new uint8_t[inputPic->rpu.payloadSize];
936
+            memcpy(inFrame->m_rpu.payload, inputPic->rpu.payload, inputPic->rpu.payloadSize);
937
         }
938
 
939
-        if (pic_in->quantOffsets != NULL)
940
+        if (inputPic->quantOffsets != NULL)
941
         {
942
             int cuCount;
943
             if (m_param->rc.qgSize == 8)
944
                 cuCount = inFrame->m_lowres.maxBlocksInRowFullRes * inFrame->m_lowres.maxBlocksInColFullRes;
945
             else
946
                 cuCount = inFrame->m_lowres.maxBlocksInRow * inFrame->m_lowres.maxBlocksInCol;
947
-            memcpy(inFrame->m_quantOffsets, pic_in->quantOffsets, cuCount * sizeof(float));
948
+            memcpy(inFrame->m_quantOffsets, inputPic->quantOffsets, cuCount * sizeof(float));
949
         }
950
 
951
         if (m_pocLast == 0)
952
@@ -1147,18 +1828,18 @@
953
         }
954
 
955
         /* Use the frame types from the first pass, if available */
956
-        int sliceType = (m_param->rc.bStatRead) ? m_rateControl->rateControlSliceType(inFrame->m_poc) : pic_in->sliceType;
957
+        int sliceType = (m_param->rc.bStatRead) ? m_rateControl->rateControlSliceType(inFrame->m_poc) : inputPic->sliceType;
958
 
959
-        /* In analysisSave mode, x265_analysis_data is allocated in pic_in and inFrame points to this */
960
+        /* In analysisSave mode, x265_analysis_data is allocated in inputPic and inFrame points to this */
961
         /* Load analysis data before lookahead->addPicture, since sliceType has been decided */
962
         if (m_param->analysisLoad)
963
         {
964
             /* reads analysis data for the frame and allocates memory based on slicetype */
965
-            static int paramBytes = 0;
966
+            static int paramBytes = CONF_OFFSET_BYTES;
967
             if (!inFrame->m_poc && m_param->bAnalysisType != HEVC_INFO)
968
             {
969
-                x265_analysis_data analysisData = pic_in->analysisData;
970
-                paramBytes = validateAnalysisData(&analysisData, 0);
971
+                x265_analysis_validate saveParam = inputPic->analysisData.saveParam;
972
+                paramBytes += validateAnalysisData(&saveParam, 0);
973
                 if (paramBytes == -1)
974
                 {
975
                     m_aborted = true;
976
@@ -1178,10 +1859,10 @@
977
                 uint32_t outOfBoundaryLowresH = extendedHeight - m_param->sourceHeight / 2;
978
                 if (outOfBoundaryLowresH * 2 >= m_param->maxCUSize)
979
                     cuLocInFrame.skipHeight = true;
980
-                readAnalysisFile(&inFrame->m_analysisData, inFrame->m_poc, pic_in, paramBytes, cuLocInFrame);
981
+                readAnalysisFile(&inFrame->m_analysisData, inFrame->m_poc, inputPic, paramBytes, cuLocInFrame);
982
             }
983
             else
984
-                readAnalysisFile(&inFrame->m_analysisData, inFrame->m_poc, pic_in, paramBytes);
985
+                readAnalysisFile(&inFrame->m_analysisData, inFrame->m_poc, inputPic, paramBytes);
986
             inFrame->m_poc = inFrame->m_analysisData.poc;
987
             sliceType = inFrame->m_analysisData.sliceType;
988
             inFrame->m_lowres.bScenecut = !!inFrame->m_analysisData.bScenecut;
989
@@ -1202,9 +1883,9 @@
990
                 }
991
             }
992
         }
993
-        if (m_param->bUseRcStats && pic_in->rcData)
994
+        if (m_param->bUseRcStats && inputPic->rcData)
995
         {
996
-            RcStats* rc = (RcStats*)pic_in->rcData;
997
+            RcStats* rc = (RcStats*)inputPic->rcData;
998
             m_rateControl->m_accumPQp = rc->cumulativePQp;
999
             m_rateControl->m_accumPNorm = rc->cumulativePNorm;
1000
             m_rateControl->m_isNextGop = true;
1001
@@ -1228,6 +1909,18 @@
1002
             }
1003
             m_param->bUseRcStats = 0;
1004
         }
1005
+
1006
+        if (m_param->bEnableFrameDuplication && ((read < written) || (m_dupBuffer[0]->dupPic->picStruct == tripling && (read <= written))))
1007
+        {
1008
+            if (m_dupBuffer[0]->dupPic->picStruct == tripling)
1009
+                m_dupBuffer[0]->bOccupied = m_dupBuffer[1]->bOccupied = false;
1010
+            else
1011
+            {
1012
+                copyPicture(m_dupBuffer[0]->dupPic, m_dupBuffer[1]->dupPic);
1013
+                m_dupBuffer[1]->bOccupied = false;
1014
+            }
1015
+        }
1016
+
1017
         if (m_reconfigureRc)
1018
             inFrame->m_reconfigureRc = true;
1019
 
1020
@@ -1262,7 +1955,7 @@
1021
             Slice *slice = outFrame->m_encData->m_slice;
1022
             x265_frame_stats* frameData = NULL;
1023
 
1024
-            /* Free up pic_in->analysisData since it has already been used */
1025
+            /* Free up inputPic->analysisData since it has already been used */
1026
             if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))
1027
                 x265_free_analysis_data(m_param, &outFrame->m_analysisData);
1028
 
1029
@@ -1410,6 +2103,32 @@
1030
 
1031
             if ((m_outputCount + 1)  >= m_param->chunkStart)
1032
                 finishFrameStats(outFrame, curEncoder, frameData, m_pocLast);
1033
+            if (m_param->analysisSave)
1034
+            {
1035
+                pic_out->analysisData.frameBits = frameData->bits;
1036
+                if (!slice->isIntra())
1037
+                {
1038
+                    for (int ref = 0; ref < MAX_NUM_REF; ref++)
1039
+                        pic_out->analysisData.list0POC[ref] = frameData->list0POC[ref];
1040
+
1041
+                    double totalIntraPercent = 0;
1042
+
1043
+                    for (uint32_t depth = 0; depth < m_param->maxCUDepth; depth++)
1044
+                        for (uint32_t intramode = 0; intramode < 3; intramode++)
1045
+                            totalIntraPercent += frameData->cuStats.percentIntraDistribution[depth][intramode];
1046
+                    totalIntraPercent += frameData->cuStats.percentIntraNxN;
1047
+
1048
+                    for (uint32_t depth = 0; depth < m_param->maxCUDepth; depth++)
1049
+                        totalIntraPercent += frameData->puStats.percentIntraPu[depth];
1050
+                    pic_out->analysisData.totalIntraPercent = totalIntraPercent;
1051
+
1052
+                    if (!slice->isInterP())
1053
+                    {
1054
+                        for (int ref = 0; ref < MAX_NUM_REF; ref++)
1055
+                            pic_out->analysisData.list1POC[ref] = frameData->list1POC[ref];
1056
+                    }
1057
+                }
1058
+            }
1059
 
1060
             /* Write RateControl Frame level stats in multipass encodes */
1061
             if (m_param->rc.bStatWrite)
1062
@@ -1460,6 +2179,9 @@
1063
             frameEnc = m_lookahead->getDecidedPicture();
1064
         if (frameEnc && !pass && (!m_param->chunkEnd || (m_encodedFrameNum < m_param->chunkEnd)))
1065
         {
1066
+            if (m_param->bEnableSceneCutAwareQp && frameEnc->m_lowres.bScenecut)
1067
+                m_rateControl->m_lastScenecut = frameEnc->m_poc;
1068
+
1069
             if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
1070
             {
1071
                 uint32_t widthInCU = (m_param->sourceWidth + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize;
1072
@@ -1470,12 +2192,15 @@
1073
                 frameEnc->m_analysisData.poc = frameEnc->m_poc;
1074
                 if (m_param->rc.bStatRead)
1075
                     readAnalysisFile(&frameEnc->m_analysisData, frameEnc->m_poc, frameEnc->m_lowres.sliceType);
1076
-             }
1077
+            }
1078
 
1079
-            for (int i = 0; i < m_param->rc.zonefileCount; i++)
1080
+            if (m_param->bResetZoneConfig)
1081
             {
1082
-                if (m_param->rc.zones[i].startFrame == frameEnc->m_poc)
1083
-                    x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
1084
+                for (int i = 0; i < m_param->rc.zonefileCount; i++)
1085
+                {
1086
+                    if (m_param->rc.zones[i].startFrame == frameEnc->m_poc)
1087
+                        x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
1088
+                }
1089
             }
1090
 
1091
             if (frameEnc->m_reconfigureRc && m_reconfigureRc)
1092
@@ -2292,12 +3017,12 @@
1093
         frameStats->ssim = ssim;
1094
         if (!slice->isIntra())
1095
         {
1096
-            for (int ref = 0; ref < 16; ref++)
1097
+            for (int ref = 0; ref < MAX_NUM_REF; ref++)
1098
                 frameStats->list0POC[ref] = ref < slice->m_numRefIdx[0] ? slice->m_refPOCList[0][ref] - slice->m_lastIDR : -1;
1099
 
1100
             if (!slice->isInterP())
1101
             {
1102
-                for (int ref = 0; ref < 16; ref++)
1103
+                for (int ref = 0; ref < MAX_NUM_REF; ref++)
1104
                     frameStats->list1POC[ref] = ref < slice->m_numRefIdx[1] ? slice->m_refPOCList[1][ref] - slice->m_lastIDR : -1;
1105
             }
1106
         }
1107
@@ -2480,7 +3205,7 @@
1108
     if (m_param->bSingleSeiNal)
1109
         bs.resetBits();
1110
 
1111
-    if (m_param->bEmitHDRSEI)
1112
+    if (m_param->bEmitHDR10SEI)
1113
     {
1114
         if (m_param->bEmitCLL)
1115
         {
1116
@@ -2648,7 +3373,7 @@
1117
 
1118
     pps->chromaQpOffset[0] = m_param->cbQpOffset;
1119
     pps->chromaQpOffset[1] = m_param->crQpOffset;
1120
-    pps->pps_slice_chroma_qp_offsets_present_flag = m_param->bHDROpt;
1121
+    pps->pps_slice_chroma_qp_offsets_present_flag = m_param->bHDR10Opt;
1122
 
1123
     pps->bConstrainedIntraPred = m_param->bEnableConstrainedIntra;
1124
     pps->bUseWeightPred = m_param->bEnableWeightedPred;
1125
@@ -2670,48 +3395,51 @@
1126
 
1127
 void Encoder::configureZone(x265_param *p, x265_param *zone)
1128
 {
1129
-    p->maxNumReferences = zone->maxNumReferences;
1130
-    p->bEnableFastIntra = zone->bEnableFastIntra;
1131
-    p->bEnableEarlySkip = zone->bEnableEarlySkip;
1132
-    p->bEnableRecursionSkip = zone->bEnableRecursionSkip;
1133
-    p->searchMethod = zone->searchMethod;
1134
-    p->searchRange = zone->searchRange;
1135
-    p->subpelRefine = zone->subpelRefine;
1136
-    p->rdoqLevel = zone->rdoqLevel;
1137
-    p->rdLevel = zone->rdLevel;
1138
-    p->bEnableRectInter = zone->bEnableRectInter;
1139
-    p->maxNumMergeCand = zone->maxNumMergeCand;
1140
-    p->bIntraInBFrames = zone->bIntraInBFrames;
1141
-    if(zone->scalingLists)
1142
-        p->scalingLists = strdup(zone->scalingLists);
1143
-
1144
-    p->rc.aqMode = zone->rc.aqMode;
1145
-    p->rc.aqStrength = zone->rc.aqStrength;
1146
-    p->noiseReductionInter = zone->noiseReductionInter;
1147
-    p->noiseReductionIntra = zone->noiseReductionIntra;
1148
-
1149
-    p->limitModes = zone->limitModes;
1150
-    p->bEnableSplitRdSkip = zone->bEnableSplitRdSkip;
1151
-    p->bCULossless = zone->bCULossless;
1152
-    p->bEnableRdRefine = zone->bEnableRdRefine;
1153
-    p->limitTU = zone->limitTU;
1154
-    p->bEnableTSkipFast = zone->bEnableTSkipFast;
1155
-    p->rdPenalty = zone->rdPenalty;
1156
-    p->dynamicRd = zone->dynamicRd;
1157
-    p->bEnableTransformSkip = zone->bEnableTransformSkip;
1158
-    p->bEnableAMP = zone->bEnableAMP;
1159
-
1160
-    if (m_param->rc.rateControlMode == X265_RC_ABR)
1161
-        p->rc.bitrate = zone->rc.bitrate;
1162
-    if (m_param->rc.rateControlMode == X265_RC_CRF)
1163
-        p->rc.rfConstant = zone->rc.rfConstant;
1164
-    if (m_param->rc.rateControlMode == X265_RC_CQP)
1165
+    if (m_param->bResetZoneConfig)
1166
     {
1167
-        p->rc.qp = zone->rc.qp;
1168
-        p->rc.aqMode = X265_AQ_NONE;
1169
-        p->rc.hevcAq = 0;
1170
+        p->maxNumReferences = zone->maxNumReferences;
1171
+        p->bEnableFastIntra = zone->bEnableFastIntra;
1172
+        p->bEnableEarlySkip = zone->bEnableEarlySkip;
1173
+        p->bEnableRecursionSkip = zone->bEnableRecursionSkip;
1174
+        p->searchMethod = zone->searchMethod;
1175
+        p->searchRange = zone->searchRange;
1176
+        p->subpelRefine = zone->subpelRefine;
1177
+        p->rdoqLevel = zone->rdoqLevel;
1178
+        p->rdLevel = zone->rdLevel;
1179
+        p->bEnableRectInter = zone->bEnableRectInter;
1180
+        p->maxNumMergeCand = zone->maxNumMergeCand;
1181
+        p->bIntraInBFrames = zone->bIntraInBFrames;
1182
+        if (zone->scalingLists)
1183
+            p->scalingLists = strdup(zone->scalingLists);
1184
+
1185
+        p->rc.aqMode = zone->rc.aqMode;
1186
+        p->rc.aqStrength = zone->rc.aqStrength;
1187
+        p->noiseReductionInter = zone->noiseReductionInter;
1188
+        p->noiseReductionIntra = zone->noiseReductionIntra;
1189
+
1190
+        p->limitModes = zone->limitModes;
1191
+        p->bEnableSplitRdSkip = zone->bEnableSplitRdSkip;
1192
+        p->bCULossless = zone->bCULossless;
1193
+        p->bEnableRdRefine = zone->bEnableRdRefine;
1194
+        p->limitTU = zone->limitTU;
1195
+        p->bEnableTSkipFast = zone->bEnableTSkipFast;
1196
+        p->rdPenalty = zone->rdPenalty;
1197
+        p->dynamicRd = zone->dynamicRd;
1198
+        p->bEnableTransformSkip = zone->bEnableTransformSkip;
1199
+        p->bEnableAMP = zone->bEnableAMP;
1200
+
1201
+        if (m_param->rc.rateControlMode == X265_RC_ABR)
1202
+            p->rc.bitrate = zone->rc.bitrate;
1203
+        if (m_param->rc.rateControlMode == X265_RC_CRF)
1204
+            p->rc.rfConstant = zone->rc.rfConstant;
1205
+        if (m_param->rc.rateControlMode == X265_RC_CQP)
1206
+        {
1207
+            p->rc.qp = zone->rc.qp;
1208
+            p->rc.aqMode = X265_AQ_NONE;
1209
+            p->rc.hevcAq = 0;
1210
+        }
1211
+        p->radl = zone->radl;
1212
     }
1213
-    p->radl = zone->radl;
1214
     memcpy(zone, p, sizeof(x265_param));
1215
 }
1216
 
1217
@@ -2734,7 +3462,7 @@
1218
     p->vui.matrixCoeffs = dovi[doviProfile].matrixCoeffs;
1219
 
1220
     if (dovi[doviProfile].doviProfileId == 81)
1221
-        p->bEmitHDRSEI = p->bEmitCLL = 1;
1222
+        p->bEmitHDR10SEI = p->bEmitCLL = 1;
1223
 
1224
     if (dovi[doviProfile].doviProfileId == 50)
1225
         p->crQpOffset = 3;
1226
@@ -2766,6 +3494,7 @@
1227
          * adaptive I frame placement */
1228
         p->keyframeMax = INT_MAX;
1229
         p->scenecutThreshold = 0;
1230
+        p->bHistBasedSceneCut = 0;
1231
     }
1232
     else if (p->keyframeMax <= 1)
1233
     {
1234
@@ -2779,6 +3508,7 @@
1235
         p->lookaheadDepth = 0;
1236
         p->bframes = 0;
1237
         p->scenecutThreshold = 0;
1238
+        p->bHistBasedSceneCut = 0;
1239
         p->bFrameAdaptive = 0;
1240
         p->rc.cuTree = 0;
1241
         p->bEnableWeightedPred = 0;
1242
@@ -2931,10 +3661,38 @@
1243
         p->rc.rfConstantMin = 0;
1244
     }
1245
 
1246
-    if (!(p->bAnalysisType == HEVC_INFO) && (p->analysisLoad || p->analysisSave) && p->rc.cuTree && p->analysisReuseLevel < 10)
1247
+    if (p->analysisSaveReuseLevel && !p->analysisSave)
1248
     {
1249
-        x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis reuse level 10, Disabling cu-tree\n");
1250
-        p->rc.cuTree = 0;
1251
+        x265_log(p, X265_LOG_WARNING, "analysis-save-reuse-level can be set only when analysis-save is enabled."
1252
+            " Resetting analysis-save-reuse-level to 0.\n");
1253
+        p->analysisSaveReuseLevel = 0;
1254
+    }
1255
+
1256
+    if (p->analysisLoadReuseLevel && !p->analysisLoad)
1257
+    {
1258
+        x265_log(p, X265_LOG_WARNING, "analysis-load-reuse-level can be set only when analysis-load is enabled."
1259
+            " Resetting analysis-load-reuse-level to 0.\n");
1260
+        p->analysisLoadReuseLevel = 0;
1261
+    }
1262
+
1263
+    if (p->analysisSave && !p->analysisSaveReuseLevel)
1264
+        p->analysisSaveReuseLevel = 5;
1265
+
1266
+    if (p->analysisLoad && !p->analysisLoadReuseLevel)
1267
+        p->analysisLoadReuseLevel = 5;
1268
+
1269
+    if ((p->bAnalysisType == DEFAULT) && p->rc.cuTree)
1270
+    {
1271
+        if (p->analysisSaveReuseLevel && p->analysisSaveReuseLevel < 10)
1272
+        {
1273
+            x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-save-reuse-level 10, Disabling cu-tree\n");
1274
+            p->rc.cuTree = 0;
1275
+        }
1276
+        if (p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)
1277
+        {
1278
+            x265_log(p, X265_LOG_WARNING, "cu-tree works only with analysis-load-reuse-level 10, Disabling cu-tree\n");
1279
+            p->rc.cuTree = 0;
1280
+        }
1281
     }
1282
 
1283
     if ((p->analysisLoad || p->analysisSave) && (p->bDistributeModeAnalysis || p->bDistributeMotionEstimation))
1284
@@ -2956,45 +3714,37 @@
1285
         {
1286
             p->scaleFactor = 0;
1287
         }
1288
-        else if ((!p->analysisLoad && !p->analysisSave) || (p->analysisReuseLevel > 6 && p->analysisReuseLevel != 10))
1289
+        else if ((p->analysisSaveReuseLevel > 6 && p->analysisSaveReuseLevel != 10) || (p->analysisLoadReuseLevel > 6 && p->analysisLoadReuseLevel != 10))
1290
         {
1291
-            x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis load/save and analysis-reuse-level 1-6 and 10. Disabling scale-factor.\n");
1292
+            x265_log(p, X265_LOG_WARNING, "Input scaling works with analysis-save/load and analysis-save/load-reuse-level 1-6 and 10. Disabling scale-factor.\n");
1293
             p->scaleFactor = 0;
1294
         }
1295
     }
1296
 
1297
-    if (p->intraRefine)
1298
+    if (p->intraRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)
1299
     {
1300
-        if (!p->analysisLoad || p->analysisReuseLevel < 10)
1301
-        {
1302
-            x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-reuse-level 10. Disabling intra refine.\n");
1303
-            p->intraRefine = 0;
1304
-        }
1305
+        x265_log(p, X265_LOG_WARNING, "Intra refinement requires analysis load, analysis-load-reuse-level 10. Disabling intra refine.\n");
1306
+        p->intraRefine = 0;
1307
     }
1308
 
1309
-    if (p->interRefine)
1310
+    if (p->interRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)
1311
     {
1312
-        if (!p->analysisLoad || p->analysisReuseLevel < 10)
1313
-        {
1314
-            x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-reuse-level 10. Disabling inter refine.\n");
1315
-            p->interRefine = 0;
1316
-        }
1317
+        x265_log(p, X265_LOG_WARNING, "Inter refinement requires analysis load, analysis-load-reuse-level 10. Disabling inter refine.\n");
1318
+        p->interRefine = 0;
1319
     }
1320
 
1321
-    if (p->bDynamicRefine)
1322
+    if (p->bDynamicRefine && p->analysisLoadReuseLevel && p->analysisLoadReuseLevel < 10)
1323
     {
1324
-        if (!p->analysisLoad || p->analysisReuseLevel < 10)
1325
-        {
1326
-            x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-reuse-level 10. Disabling dynamic refine.\n");
1327
-            p->bDynamicRefine = 0;
1328
-        }
1329
+        x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-load-reuse-level 10. Disabling dynamic refine.\n");
1330
+        p->bDynamicRefine = 0;
1331
+
1332
         if (p->interRefine)
1333
         {
1334
             x265_log(p, X265_LOG_WARNING, "Inter refine cannot be used with dynamic refine. Disabling refine-inter.\n");
1335
             p->interRefine = 0;
1336
         }
1337
     }
1338
-    if (p->scaleFactor && p->analysisLoad && !p->interRefine && !p->bDynamicRefine && p->analysisReuseLevel == 10)
1339
+    if (p->scaleFactor && !p->interRefine && !p->bDynamicRefine && p->analysisLoadReuseLevel == 10)
1340
     {
1341
         x265_log(p, X265_LOG_WARNING, "Inter refinement 0 is not supported with scaling and analysis-reuse-level=10. Enabling refine-inter 1.\n");
1342
         p->interRefine = 1;
1343
@@ -3081,7 +3831,7 @@
1344
 
1345
     if (!p->rc.bStatWrite && !p->rc.bStatRead && (p->analysisMultiPassRefine || p->analysisMultiPassDistortion))
1346
     {
1347
-        x265_log(p, X265_LOG_WARNING, "analysis-multi-pass/distortion is enabled only when rc multi pass is enabled. Disabling multi-pass-opt-analysis and multi-pass-opt-distortion");
1348
+        x265_log(p, X265_LOG_WARNING, "analysis-multi-pass/distortion is enabled only when rc multi pass is enabled. Disabling multi-pass-opt-analysis and multi-pass-opt-distortion\n");
1349
         p->analysisMultiPassRefine = 0;
1350
         p->analysisMultiPassDistortion = 0;
1351
     }
1352
@@ -3095,26 +3845,78 @@
1353
     p->bSaoNonDeblocked &= p->bEnableSAO;
1354
     p->bEnableTSkipFast &= p->bEnableTransformSkip;
1355
     p->bLimitSAO &= p->bEnableSAO;
1356
+
1357
+    if (m_param->bUseAnalysisFile && m_param->analysisLoad && (p->confWinRightOffset || p->confWinBottomOffset))
1358
+        x265_log(p, X265_LOG_WARNING, "It is recommended not to set conformance window offset in file based analysis-load."
1359
+                                      " Offsets are shared in the analysis file already.\n");
1360
     /* initialize the conformance window */
1361
     m_conformanceWindow.bEnabled = false;
1362
     m_conformanceWindow.rightOffset = 0;
1363
     m_conformanceWindow.topOffset = 0;
1364
     m_conformanceWindow.bottomOffset = 0;
1365
     m_conformanceWindow.leftOffset = 0;
1366
-    /* set pad size if width is not multiple of the minimum CU size */
1367
-    if (p->scaleFactor == 2 && ((p->sourceWidth / 2) & (p->minCUSize - 1)) && p->analysisLoad)
1368
+
1369
+    uint32_t padsize = 0;
1370
+    if (m_param->analysisLoad && m_param->bUseAnalysisFile)
1371
     {
1372
-        uint32_t rem = (p->sourceWidth / 2) & (p->minCUSize - 1);
1373
-        uint32_t padsize = p->minCUSize - rem;
1374
-        p->sourceWidth += padsize * 2;
1375
+        m_analysisFileIn = x265_fopen(m_param->analysisLoad, "rb");
1376
+        if (!m_analysisFileIn)
1377
+        {
1378
+            x265_log_file(NULL, X265_LOG_ERROR, "Analysis load: failed to open file %s\n", m_param->analysisLoad);
1379
+            m_aborted = true;
1380
+        }
1381
+        else
1382
+        {
1383
+            if (fread(&m_conformanceWindow.rightOffset, sizeof(int), 1, m_analysisFileIn) != 1)
1384
+            {
1385
+                x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Conformance window right offset missing\n");
1386
+                m_aborted = true;
1387
+            }
1388
+            else if (m_conformanceWindow.rightOffset && p->analysisLoadReuseLevel > 1)
1389
+            {
1390
+                int scaleFactor = p->scaleFactor < 2 ? 1 : p->scaleFactor;
1391
+                padsize = m_conformanceWindow.rightOffset * scaleFactor;
1392
+                p->sourceWidth += padsize;
1393
+                m_conformanceWindow.bEnabled = true;
1394
+                m_conformanceWindow.rightOffset = padsize;
1395
+            }
1396
 
1397
-        m_conformanceWindow.bEnabled = true;
1398
-        m_conformanceWindow.rightOffset = padsize * 2;
1399
+            if (fread(&m_conformanceWindow.bottomOffset, sizeof(int), 1, m_analysisFileIn) != 1)
1400
+            {
1401
+                x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Conformance window bottom offset missing\n");
1402
+                m_aborted = true;
1403
+            }
1404
+            else if (m_conformanceWindow.bottomOffset && p->analysisLoadReuseLevel > 1)
1405
+            {
1406
+                int scaleFactor = p->scaleFactor < 2 ? 1 : p->scaleFactor;
1407
+                padsize = m_conformanceWindow.bottomOffset * scaleFactor;
1408
+                p->sourceHeight += padsize;
1409
+                m_conformanceWindow.bEnabled = true;
1410
+                m_conformanceWindow.bottomOffset = padsize;
1411
+            }
1412
+        }
1413
     }
1414
-    else if(p->sourceWidth & (p->minCUSize - 1))
1415
+
1416
+    /* set pad size if width is not multiple of the minimum CU size */
1417
+    if (p->confWinRightOffset)
1418
+    {
1419
+        if ((p->sourceWidth + p->confWinRightOffset) & (p->minCUSize - 1))
1420
+        {
1421
+            x265_log(p, X265_LOG_ERROR, "Incompatible conformance window right offset."
1422
+                                          " This when added to the source width should be a multiple of minCUSize\n");
1423
+            m_aborted = true;
1424
+        }
1425
+        else
1426
+        {
1427
+            p->sourceWidth += p->confWinRightOffset;
1428
+            m_conformanceWindow.bEnabled = true;
1429
+            m_conformanceWindow.rightOffset = p->confWinRightOffset;
1430
+        }
1431
+    }
1432
+    else if (p->sourceWidth & (p->minCUSize - 1))
1433
     {
1434
         uint32_t rem = p->sourceWidth & (p->minCUSize - 1);
1435
-        uint32_t padsize = p->minCUSize - rem;
1436
+        padsize = p->minCUSize - rem;
1437
         p->sourceWidth += padsize;
1438
 
1439
         m_conformanceWindow.bEnabled = true;
1440
@@ -3160,6 +3962,30 @@
1441
         p->dynamicRd = 0;
1442
         x265_log(p, X265_LOG_WARNING, "Dynamic-rd disabled, requires RD <= 4, VBV and aq-mode enabled\n");
1443
     }
1444
+
1445
+    if (!p->bEnableFrameDuplication && p->dupThreshold && p->dupThreshold != 70)
1446
+    {
1447
+        x265_log(p, X265_LOG_WARNING, "Frame-duplication threshold works only with frame-duplication enabled. Enabling frame-duplication.\n");
1448
+        p->bEnableFrameDuplication = 1;
1449
+    }
1450
+
1451
+    if (p->bEnableFrameDuplication && p->interlaceMode)
1452
+    {
1453
+        x265_log(p, X265_LOG_WARNING, "Frame-duplication does not support interlace mode. Disabling Frame Duplication.\n");
1454
+        p->bEnableFrameDuplication = 0;
1455
+    }
1456
+
1457
+    if (p->bEnableFrameDuplication && p->pictureStructure != 0 && p->pictureStructure != -1)
1458
+    {
1459
+        x265_log(p, X265_LOG_WARNING, "Frame-duplication works only with pic_struct = 0. Setting pic-struct = 0.\n");
1460
+        p->pictureStructure = 0;
1461
+    }
1462
+
1463
+    if (m_param->bEnableFrameDuplication && (!bIsVbv || !m_param->bEmitHRDSEI))
1464
+    {
1465
+        x265_log(m_param, X265_LOG_WARNING, "Frame-duplication require NAL HRD and VBV parameters. Disabling frame duplication\n");
1466
+        m_param->bEnableFrameDuplication = 0;
1467
+    }
1468
 #ifdef ENABLE_HDR10_PLUS
1469
     if (m_param->bDhdr10opt && m_param->toneMapFile == NULL)
1470
     {
1471
@@ -3291,18 +4117,25 @@
1472
         }
1473
     }
1474
     /* set pad size if height is not multiple of the minimum CU size */
1475
-    if (p->scaleFactor == 2 && ((p->sourceHeight / 2) & (p->minCUSize - 1)) && p->analysisLoad)
1476
+    if (p->confWinBottomOffset)
1477
     {
1478
-        uint32_t rem = (p->sourceHeight / 2) & (p->minCUSize - 1);
1479
-        uint32_t padsize = p->minCUSize - rem;
1480
-        p->sourceHeight += padsize * 2;
1481
-        m_conformanceWindow.bEnabled = true;
1482
-        m_conformanceWindow.bottomOffset = padsize * 2;
1483
+        if ((p->sourceHeight + p->confWinBottomOffset) & (p->minCUSize - 1))
1484
+        {
1485
+            x265_log(p, X265_LOG_ERROR, "Incompatible conformance window bottom offset."
1486
+                " This when added to the source height should be a multiple of minCUSize\n");
1487
+            m_aborted = true;
1488
+        }
1489
+        else
1490
+        {
1491
+            p->sourceHeight += p->confWinBottomOffset;
1492
+            m_conformanceWindow.bEnabled = true;
1493
+            m_conformanceWindow.bottomOffset = p->confWinBottomOffset;
1494
+        }
1495
     }
1496
     else if(p->sourceHeight & (p->minCUSize - 1))
1497
     {
1498
         uint32_t rem = p->sourceHeight & (p->minCUSize - 1);
1499
-        uint32_t padsize = p->minCUSize - rem;
1500
+        padsize = p->minCUSize - rem;
1501
         p->sourceHeight += padsize;
1502
         m_conformanceWindow.bEnabled = true;
1503
         m_conformanceWindow.bottomOffset = padsize;
1504
@@ -3329,21 +4162,21 @@
1505
         x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit);
1506
         p->maxSlices = slicesLimit;
1507
     }
1508
-    if (p->bHDROpt)
1509
+    if (p->bHDR10Opt)
1510
     {
1511
         if (p->internalCsp != X265_CSP_I420 || p->internalBitDepth != 10 || p->vui.colorPrimaries != 9 ||
1512
             p->vui.transferCharacteristics != 16 || p->vui.matrixCoeffs != 9)
1513
         {
1514
-            x265_log(p, X265_LOG_ERROR, "Recommended Settings for HDR: colour primaries should be BT.2020,\n"
1515
+            x265_log(p, X265_LOG_ERROR, "Recommended Settings for HDR10-opt: colour primaries should be BT.2020,\n"
1516
                                         "                                            transfer characteristics should be SMPTE ST.2084,\n"
1517
                                         "                                            matrix coeffs should be BT.2020,\n"
1518
                                         "                                            the input video should be 10 bit 4:2:0\n"
1519
-                                        "                                            Disabling offset tuning for HDR videos\n");
1520
-            p->bHDROpt = 0;
1521
+                                        "                                            Disabling hdr10-opt.\n");
1522
+            p->bHDR10Opt = 0;
1523
         }
1524
     }
1525
 
1526
-    if (m_param->toneMapFile || p->bHDROpt || p->bEmitHDRSEI)
1527
+    if (m_param->toneMapFile || p->bHDR10Opt || p->bEmitHDR10SEI)
1528
     {
1529
         if (!p->bRepeatHeaders)
1530
         {
1531
@@ -3396,6 +4229,12 @@
1532
         x265_log(p, X265_LOG_WARNING, "Turning on repeat - headers for zone encoding\n");
1533
     }
1534
 
1535
+    if (!m_param->bResetZoneConfig && (p->keyframeMax != p->keyframeMin))
1536
+        x265_log(p, X265_LOG_WARNING, "External zone reconfiguration requires a fixed GOP size to enable appropriate signaling of HRD info\n");
1537
+
1538
+    if (!m_param->bResetZoneConfig && (p->reconfigWindowSize != (uint64_t)p->keyframeMax))
1539
+        x265_log(p, X265_LOG_WARNING, "Zone size must be multiple of GOP size to enable appropriate signaling of HRD info\n");
1540
+
1541
     if (m_param->bEnableHME)
1542
     {
1543
         if (m_param->sourceHeight < 540)
1544
@@ -3403,11 +4242,22 @@
1545
             x265_log(p, X265_LOG_WARNING, "Source height < 540p is too low for HME. Disabling HME.\n");
1546
             p->bEnableHME = 0;
1547
         }
1548
-        if (m_param->bEnableHME && m_param->searchMethod != m_param->hmeSearchMethod[2])
1549
-        {
1550
+    }
1551
+
1552
+    if (m_param->bEnableHME)
1553
+    {
1554
+        if (m_param->searchMethod != m_param->hmeSearchMethod[2])
1555
             m_param->searchMethod = m_param->hmeSearchMethod[2];
1556
-        }
1557
+        if (m_param->searchRange != m_param->hmeRange[2])
1558
+            m_param->searchRange = m_param->hmeRange[2];
1559
     }
1560
+
1561
+   if (p->bHistBasedSceneCut && !p->edgeTransitionThreshold)
1562
+   {
1563
+       p->edgeTransitionThreshold = 0.01;
1564
+       x265_log(p, X265_LOG_WARNING, "using  default threshold %.2lf for scene cut detection\n", p->edgeTransitionThreshold);
1565
+   }
1566
+
1567
 }
1568
 
1569
 void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x265_picture* picIn, int paramBytes)
1570
@@ -3518,7 +4368,7 @@
1571
     {
1572
         if (m_param->bAnalysisType == HEVC_INFO)
1573
             return;
1574
-        if (m_param->analysisReuseLevel < 2)
1575
+        if (m_param->analysisLoadReuseLevel < 2)
1576
             return;
1577
 
1578
         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL;
1579
@@ -3578,7 +4428,7 @@
1580
         uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
1581
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
1582
         X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));
1583
-        if (m_param->analysisReuseLevel < 2)
1584
+        if (m_param->analysisLoadReuseLevel < 2)
1585
             return;
1586
 
1587
         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL;
1588
@@ -3587,9 +4437,9 @@
1589
         int8_t* refIdx[2];
1590
         int8_t* cuQPBuf = NULL;
1591
 
1592
-        int numBuf = m_param->analysisReuseLevel > 4 ? 4 : 2;
1593
+        int numBuf = m_param->analysisLoadReuseLevel > 4 ? 4 : 2;
1594
         bool bIntraInInter = false;
1595
-        if (m_param->analysisReuseLevel == 10)
1596
+        if (m_param->analysisLoadReuseLevel == 10)
1597
         {
1598
             numBuf++;
1599
             bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames);
1600
@@ -3612,14 +4462,14 @@
1601
             X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);
1602
             if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }
1603
 
1604
-            if (m_param->analysisReuseLevel > 4)
1605
+            if (m_param->analysisLoadReuseLevel > 4)
1606
             {
1607
                 partSize = modeBuf + depthBytes;
1608
                 mergeFlag = partSize + depthBytes;
1609
                 X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);
1610
                 X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);
1611
 
1612
-                if (m_param->analysisReuseLevel == 10)
1613
+                if (m_param->analysisLoadReuseLevel == 10)
1614
                 {
1615
                     interDir = mergeFlag + depthBytes;
1616
                     X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);
1617
@@ -3650,7 +4500,7 @@
1618
                 memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);
1619
                 if (m_param->rc.cuTree)
1620
                     memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);
1621
-                if (m_param->analysisReuseLevel > 4)
1622
+                if (m_param->analysisLoadReuseLevel > 4)
1623
                 {
1624
                     if (m_param->scaleFactor && modeBuf[d] == MODE_INTRA && partSize[d] == SIZE_NxN)
1625
                         partSize[d] = SIZE_2Nx2N;
1626
@@ -3660,7 +4510,7 @@
1627
                     {
1628
                         if (pu) d++;
1629
                         (analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];
1630
-                        if (m_param->analysisReuseLevel == 10)
1631
+                        if (m_param->analysisLoadReuseLevel == 10)
1632
                         {
1633
                             (analysis->interData)->interDir[count + pu] = interDir[d];
1634
                             for (uint32_t i = 0; i < numDir; i++)
1635
@@ -3676,7 +4526,7 @@
1636
                             }
1637
                         }
1638
                     }
1639
-                    if (m_param->analysisReuseLevel == 10 && bIntraInInter)
1640
+                    if (m_param->analysisLoadReuseLevel == 10 && bIntraInInter)
1641
                         memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);
1642
                 }
1643
                 count += bytes;
1644
@@ -3686,7 +4536,7 @@
1645
                 X265_FREE(cuQPBuf);
1646
             X265_FREE(tempBuf);
1647
         }
1648
-        if (m_param->analysisReuseLevel == 10)
1649
+        if (m_param->analysisLoadReuseLevel == 10)
1650
         {
1651
             if (m_param->bAnalysisType != HEVC_INFO)
1652
             {
1653
@@ -3869,7 +4719,7 @@
1654
 
1655
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
1656
     {
1657
-        if (m_param->analysisReuseLevel < 2)
1658
+        if (m_param->analysisLoadReuseLevel < 2)
1659
             return;
1660
 
1661
         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL;
1662
@@ -3938,7 +4788,7 @@
1663
         uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
1664
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
1665
         X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));
1666
-        if (m_param->analysisReuseLevel < 2)
1667
+        if (m_param->analysisLoadReuseLevel < 2)
1668
             return;
1669
 
1670
         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL;
1671
@@ -3947,9 +4797,9 @@
1672
         int8_t* refIdx[2];
1673
         int8_t* cuQPBuf = NULL;
1674
 
1675
-        int numBuf = m_param->analysisReuseLevel > 4 ? 4 : 2;
1676
+        int numBuf = m_param->analysisLoadReuseLevel > 4 ? 4 : 2;
1677
         bool bIntraInInter = false;
1678
-        if (m_param->analysisReuseLevel == 10)
1679
+        if (m_param->analysisLoadReuseLevel == 10)
1680
         {
1681
             numBuf++;
1682
             bIntraInInter = (analysis->sliceType == X265_TYPE_P || m_param->bIntraInBFrames);
1683
@@ -3965,13 +4815,13 @@
1684
         X265_FREAD(depthBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->depth);
1685
         X265_FREAD(modeBuf, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->modes);
1686
         if (m_param->rc.cuTree) { X265_FREAD(cuQPBuf, sizeof(int8_t), depthBytes, m_analysisFileIn, interPic->cuQPOff); }
1687
-        if (m_param->analysisReuseLevel > 4)
1688
+        if (m_param->analysisLoadReuseLevel > 4)
1689
         {
1690
             partSize = modeBuf + depthBytes;
1691
             mergeFlag = partSize + depthBytes;
1692
             X265_FREAD(partSize, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->partSize);
1693
             X265_FREAD(mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->mergeFlag);
1694
-            if (m_param->analysisReuseLevel == 10)
1695
+            if (m_param->analysisLoadReuseLevel == 10)
1696
             {
1697
                 interDir = mergeFlag + depthBytes;
1698
                 X265_FREAD(interDir, sizeof(uint8_t), depthBytes, m_analysisFileIn, interPic->interDir);
1699
@@ -4015,10 +4865,10 @@
1700
                 memset(&(analysis->interData)->modes[count], modeBuf[d], bytes);
1701
                 if (m_param->rc.cuTree)
1702
                     memset(&(analysis->interData)->cuQPOff[count], cuQPBuf[d], bytes);
1703
-                if (m_param->analysisReuseLevel == 10 && bIntraInInter)
1704
+                if (m_param->analysisLoadReuseLevel == 10 && bIntraInInter)
1705
                     memset(&(analysis->intraData)->chromaModes[count], chromaDir[d], bytes);
1706
 
1707
-                if (m_param->analysisReuseLevel > 4)
1708
+                if (m_param->analysisLoadReuseLevel > 4)
1709
                 {
1710
                     puOrientation puOrient;
1711
                     puOrient.init();
1712
@@ -4044,7 +4894,7 @@
1713
                             d++;
1714
 
1715
                         (analysis->interData)->mergeFlag[count + pu] = mergeFlag[d];
1716
-                        if (m_param->analysisReuseLevel == 10)
1717
+                        if (m_param->analysisLoadReuseLevel == 10)
1718
                         {
1719
                             (analysis->interData)->interDir[count + pu] = interDir[d];
1720
                             MV mvCopy[2];
1721
@@ -4079,7 +4929,7 @@
1722
             X265_FREE(cuQPBuf);
1723
         X265_FREE(tempBuf);
1724
 
1725
-        if (m_param->analysisReuseLevel == 10)
1726
+        if (m_param->analysisLoadReuseLevel == 10)
1727
         {
1728
             for (uint32_t i = 0; i < numDir; i++)
1729
             {
1730
@@ -4120,7 +4970,7 @@
1731
 }
1732
 
1733
 
1734
-int Encoder::validateAnalysisData(x265_analysis_data* analysis, int writeFlag)
1735
+int Encoder::validateAnalysisData(x265_analysis_validate* saveParam, int writeFlag)
1736
 {
1737
 #define X265_PARAM_VALIDATE(analysisParam, size, bytes, param, errorMsg)\
1738
     if(!writeFlag)\
1739
@@ -4161,14 +5011,18 @@
1740
     }\
1741
     count++;
1742
 
1743
-    x265_analysis_validate *saveParam = &analysis->saveParam;
1744
     FILE*     fileOffset = NULL;
1745
     int       readValue = 0;
1746
     int       count = 0;
1747
 
1748
+    if (m_param->bUseAnalysisFile && writeFlag)
1749
+    {
1750
+        X265_PARAM_VALIDATE(saveParam->rightOffset, sizeof(int), 1, &m_conformanceWindow.rightOffset, right-offset);
1751
+        X265_PARAM_VALIDATE(saveParam->bottomOffset, sizeof(int), 1, &m_conformanceWindow.bottomOffset, bottom-offset);
1752
+    }
1753
+
1754
     X265_PARAM_VALIDATE(saveParam->intraRefresh, sizeof(int), 1, &m_param->bIntraRefresh, intra-refresh);
1755
     X265_PARAM_VALIDATE(saveParam->maxNumReferences, sizeof(int), 1, &m_param->maxNumReferences, ref);
1756
-    X265_PARAM_VALIDATE(saveParam->analysisReuseLevel, sizeof(int), 1, &m_param->analysisReuseLevel, analysis-reuse-level);
1757
     X265_PARAM_VALIDATE(saveParam->keyframeMax, sizeof(int), 1, &m_param->keyframeMax, keyint);
1758
     X265_PARAM_VALIDATE(saveParam->keyframeMin, sizeof(int), 1, &m_param->keyframeMin, min-keyint);
1759
     X265_PARAM_VALIDATE(saveParam->openGOP, sizeof(int), 1, &m_param->bOpenGOP, open-gop);
1760
@@ -4184,6 +5038,7 @@
1761
     int sourceHeight, sourceWidth;
1762
     if (writeFlag)
1763
     {
1764
+        X265_PARAM_VALIDATE(saveParam->analysisReuseLevel, sizeof(int), 1, &m_param->analysisSaveReuseLevel, analysis - save - reuse - level);
1765
         sourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;
1766
         sourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;
1767
         X265_PARAM_VALIDATE(saveParam->sourceWidth, sizeof(int), 1, &sourceWidth, res-width);
1768
@@ -4193,17 +5048,42 @@
1769
     else
1770
     {
1771
         fileOffset = m_analysisFileIn;
1772
+
1773
+        int saveLevel = 0;
1774
+        bool isIncompatibleReuseLevel = false;
1775
+        int loadLevel = m_param->analysisLoadReuseLevel;
1776
+
1777
+        X265_FREAD(&saveLevel, sizeof(int), 1, m_analysisFileIn, &(saveParam->analysisReuseLevel));
1778
+        
1779
+        if (loadLevel == 10 && saveLevel != 10)
1780
+            isIncompatibleReuseLevel = true;
1781
+        else if (((loadLevel >= 7) && (loadLevel <= 9)) && ((saveLevel < 7) || (saveLevel > 9)))
1782
+            isIncompatibleReuseLevel = true;
1783
+        else if ((loadLevel == 5 || loadLevel == 6) && ((saveLevel != 5) && (saveLevel != 6)))
1784
+            isIncompatibleReuseLevel = true;
1785
+        else if ((loadLevel >= 2 && loadLevel <= 4) && (saveLevel < 2 || saveLevel > 6))
1786
+            isIncompatibleReuseLevel = true;
1787
+        else if (!saveLevel)
1788
+            isIncompatibleReuseLevel = true;
1789
+
1790
+        if (isIncompatibleReuseLevel)
1791
+        {
1792
+            x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data. Incompatible reuse-levels.\n");
1793
+            m_aborted = true;
1794
+            return -1;
1795
+        }
1796
+
1797
         bool error = false;
1798
         int curSourceHeight = m_param->sourceHeight - m_conformanceWindow.bottomOffset;
1799
         int curSourceWidth = m_param->sourceWidth - m_conformanceWindow.rightOffset;
1800
-
1801
+      
1802
         X265_FREAD(&sourceWidth, sizeof(int), 1, m_analysisFileIn, &(saveParam->sourceWidth));
1803
         X265_FREAD(&sourceHeight, sizeof(int), 1, m_analysisFileIn, &(saveParam->sourceHeight));
1804
         X265_FREAD(&readValue, sizeof(int), 1, m_analysisFileIn, &(saveParam->maxCUSize));
1805
 
1806
         bool isScaledRes = (2 * sourceHeight == curSourceHeight) && (2 * sourceWidth == curSourceWidth);
1807
-        if (!isScaledRes && (sourceHeight != curSourceHeight || sourceWidth != curSourceWidth 
1808
-                            || readValue != (int)m_param->maxCUSize || m_param->scaleFactor))
1809
+        if (!isScaledRes && (m_param->analysisLoadReuseLevel > 1) && (sourceHeight != curSourceHeight
1810
+            || sourceWidth != curSourceWidth || readValue != (int)m_param->maxCUSize || m_param->scaleFactor))
1811
             error = true;
1812
         else if (isScaledRes && !m_param->scaleFactor)
1813
             error = true;
1814
@@ -4495,7 +5375,7 @@
1815
 
1816
     if (!analysis->poc)
1817
     {
1818
-        if (validateAnalysisData(analysis, 1) == -1)
1819
+        if (validateAnalysisData(&analysis->saveParam, 1) == -1)
1820
         {
1821
             m_aborted = true;
1822
             return;
1823
@@ -4518,7 +5398,7 @@
1824
         analysis->frameRecordSize += analysis->numCUsInFrame * sizeof(sse_t);
1825
     }
1826
 
1827
-    if (m_param->analysisReuseLevel > 1)
1828
+    if (m_param->analysisSaveReuseLevel > 1)
1829
     {
1830
 
1831
         if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
1832
@@ -4571,14 +5451,14 @@
1833
                     interDataCTU->depth[depthBytes] = depth;
1834
 
1835
                     predMode = ctu->m_predMode[absPartIdx];
1836
-                    if (m_param->analysisReuseLevel != 10 && ctu->m_refIdx[1][absPartIdx] != -1)
1837
+                    if (m_param->analysisSaveReuseLevel != 10 && ctu->m_refIdx[1][absPartIdx] != -1)
1838
                         predMode = 4; // used as indicator if the block is coded as bidir
1839
 
1840
                     interDataCTU->modes[depthBytes] = predMode;
1841
                     if (m_param->rc.cuTree)
1842
                         interDataCTU->cuQPOff[depthBytes] = (int8_t)(ctu->m_qpAnalysis[absPartIdx] - baseQP);
1843
 
1844
-                    if (m_param->analysisReuseLevel > 4)
1845
+                    if (m_param->analysisSaveReuseLevel > 4)
1846
                     {
1847
                         partSize = ctu->m_partSize[absPartIdx];
1848
                         interDataCTU->partSize[depthBytes] = partSize;
1849
@@ -4591,7 +5471,7 @@
1850
                             if (puIdx) depthBytes++;
1851
                             interDataCTU->mergeFlag[depthBytes] = ctu->m_mergeFlag[puabsPartIdx];
1852
 
1853
-                            if (m_param->analysisReuseLevel == 10)
1854
+                            if (m_param->analysisSaveReuseLevel == 10)
1855
                             {
1856
                                 interDataCTU->interDir[depthBytes] = ctu->m_interDir[puabsPartIdx];
1857
                                 for (uint32_t dir = 0; dir < numDir; dir++)
1858
@@ -4602,12 +5482,12 @@
1859
                                 }
1860
                             }
1861
                         }
1862
-                        if (m_param->analysisReuseLevel == 10 && bIntraInInter)
1863
+                        if (m_param->analysisSaveReuseLevel == 10 && bIntraInInter)
1864
                             intraDataCTU->chromaModes[depthBytes] = ctu->m_chromaIntraDir[absPartIdx];
1865
                     }
1866
                     absPartIdx += ctu->m_numPartitions >> (depth * 2);
1867
                 }
1868
-                if (m_param->analysisReuseLevel == 10 && bIntraInInter)
1869
+                if (m_param->analysisSaveReuseLevel == 10 && bIntraInInter)
1870
                     memcpy(&intraDataCTU->modes[ctu->m_cuAddr * ctu->m_numPartitions], ctu->m_lumaIntraDir, sizeof(uint8_t)* ctu->m_numPartitions);
1871
             }
1872
         }
1873
@@ -4622,10 +5502,10 @@
1874
             analysis->frameRecordSize += depthBytes * 2;
1875
             if (m_param->rc.cuTree)
1876
             analysis->frameRecordSize += (sizeof(int8_t) * depthBytes);
1877
-            if (m_param->analysisReuseLevel > 4)
1878
+            if (m_param->analysisSaveReuseLevel > 4)
1879
                 analysis->frameRecordSize += (depthBytes * 2);
1880
 
1881
-            if (m_param->analysisReuseLevel == 10)
1882
+            if (m_param->analysisSaveReuseLevel == 10)
1883
             {
1884
                 /* Add Size of interDir, mvpIdx, refIdx, mv, luma and chroma modes */
1885
                 analysis->frameRecordSize += depthBytes;
1886
@@ -4657,7 +5537,7 @@
1887
     if (analysis->sliceType > X265_TYPE_I)
1888
         X265_FWRITE((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileOut);
1889
 
1890
-    if (m_param->analysisReuseLevel < 2)
1891
+    if (m_param->analysisSaveReuseLevel < 2)
1892
         return;
1893
 
1894
     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
1895
@@ -4675,11 +5555,11 @@
1896
         X265_FWRITE((analysis->interData)->modes, sizeof(uint8_t), depthBytes, m_analysisFileOut);
1897
         if (m_param->rc.cuTree)
1898
             X265_FWRITE((analysis->interData)->cuQPOff, sizeof(int8_t), depthBytes, m_analysisFileOut);
1899
-        if (m_param->analysisReuseLevel > 4)
1900
+        if (m_param->analysisSaveReuseLevel > 4)
1901
         {
1902
             X265_FWRITE((analysis->interData)->partSize, sizeof(uint8_t), depthBytes, m_analysisFileOut);
1903
             X265_FWRITE((analysis->interData)->mergeFlag, sizeof(uint8_t), depthBytes, m_analysisFileOut);
1904
-            if (m_param->analysisReuseLevel == 10)
1905
+            if (m_param->analysisSaveReuseLevel == 10)
1906
             {
1907
                 X265_FWRITE((analysis->interData)->interDir, sizeof(uint8_t), depthBytes, m_analysisFileOut);
1908
                 if (bIntraInInter) X265_FWRITE((analysis->intraData)->chromaModes, sizeof(uint8_t), depthBytes, m_analysisFileOut);
1909
@@ -4693,7 +5573,7 @@
1910
                     X265_FWRITE((analysis->intraData)->modes, sizeof(uint8_t), analysis->numCUsInFrame * analysis->numPartitions, m_analysisFileOut);
1911
             }
1912
         }
1913
-        if (m_param->analysisReuseLevel != 10)
1914
+        if (m_param->analysisSaveReuseLevel != 10)
1915
             X265_FWRITE((analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFileOut);
1916
 
1917
     }
1918
x265_3.2.1.tar.gz/source/encoder/encoder.h -> x265_3.3.tar.gz/source/encoder/encoder.h Changed
141
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -88,6 +88,9 @@
9
 };
10
 
11
 #define MAX_NUM_REF_IDX 64
12
+#define DUP_BUFFER 2
13
+#define doubling 7
14
+#define tripling 8
15
 
16
 struct RefIdxLastGOP
17
 {
18
@@ -141,6 +144,17 @@
19
     }
20
 };
21
 
22
+struct AdaptiveFrameDuplication
23
+{
24
+    x265_picture* dupPic;
25
+    char* dupPlane;
26
+
27
+    //Flag to denote the availability of the picture buffer.
28
+    bool bOccupied;
29
+
30
+    //Flag to check whether the picture has duplicated.
31
+    bool bDup;
32
+};
33
 
34
 class FrameEncoder;
35
 class DPB;
36
@@ -149,6 +163,9 @@
37
 class ThreadPool;
38
 class FrameData;
39
 
40
+#define MAX_SCENECUT_THRESHOLD 2.0
41
+#define SCENECUT_STRENGTH_FACTOR 2.0
42
+
43
 class Encoder : public x265_encoder
44
 {
45
 public:
46
@@ -189,6 +206,10 @@
47
     x265_param*        m_latestParam;     // Holds latest param during a reconfigure
48
     RateControl*       m_rateControl;
49
     Lookahead*         m_lookahead;
50
+    AdaptiveFrameDuplication* m_dupBuffer[DUP_BUFFER];      // picture buffer of size 2
51
+    /*Frame duplication: Two pictures used to compute PSNR */
52
+    pixel*             m_dupPicOne[3];
53
+    pixel*             m_dupPicTwo[3];
54
 
55
     bool               m_externalFlush;
56
     /* Collect statistics globally */
57
@@ -209,7 +230,7 @@
58
     bool               m_reconfigureRc;
59
     bool               m_reconfigureZone;
60
 
61
-    int               m_saveCtuDistortionLevel;
62
+    int                m_saveCtuDistortionLevel;
63
 
64
     /* Begin intra refresh when one not in progress or else begin one as soon as the current 
65
      * one is done. Requires bIntraRefresh to be set.*/
66
@@ -226,11 +247,25 @@
67
     Lock               m_rpsInSpsLock;
68
     int                m_rpsInSpsCount;
69
     /* For HDR*/
70
-    double                m_cB;
71
-    double                m_cR;
72
-
73
-    int                     m_bToneMap; // Enables tone-mapping
74
-    int                     m_enableNal;
75
+    double             m_cB;
76
+    double             m_cR;
77
+
78
+    int                m_bToneMap; // Enables tone-mapping
79
+    int                m_enableNal;
80
+
81
+    /* For histogram based scene-cut detection */
82
+    pixel*             m_edgePic;
83
+    pixel*             m_inputPic[3];
84
+    int32_t            m_curUVHist[2][HISTOGRAM_BINS];
85
+    int32_t            m_curMaxUVHist[HISTOGRAM_BINS];
86
+    int32_t            m_prevMaxUVHist[HISTOGRAM_BINS];
87
+    int32_t            m_curEdgeHist[2];
88
+    int32_t            m_prevEdgeHist[2];
89
+    uint32_t           m_planeSizes[3];
90
+    double             m_edgeHistThreshold;
91
+    double             m_chromaHistThreshold;
92
+    double             m_scaledEdgeThreshold;
93
+    double             m_scaledChromaThreshold;
94
 
95
 #ifdef ENABLE_HDR10_PLUS
96
     const hdr10plus_api     *m_hdr10plus_api;
97
@@ -244,6 +279,8 @@
98
 
99
     x265_sei_payload        m_prevTonemapPayload;
100
 
101
+    int                     m_zoneIndex;
102
+
103
     /* Collect frame level feature data */
104
     uint64_t*               m_rdCost;
105
     uint64_t*               m_variance;
106
@@ -253,6 +290,10 @@
107
 
108
     bool                    m_saveCTUSize;
109
 
110
+
111
+    ThreadSafeInteger* zoneReadCount;
112
+    ThreadSafeInteger* zoneWriteCount;
113
+
114
     Encoder();
115
     ~Encoder()
116
     {
117
@@ -318,12 +359,22 @@
118
 
119
     void finishFrameStats(Frame* pic, FrameEncoder *curEncoder, x265_frame_stats* frameStats, int inPoc);
120
 
121
-    int validateAnalysisData(x265_analysis_data* analysis, int readWriteFlag);
122
+    int validateAnalysisData(x265_analysis_validate* param, int readWriteFlag);
123
 
124
     void readUserSeiFile(x265_sei_payload& seiMsg, int poc);
125
 
126
     void calcRefreshInterval(Frame* frameEnc);
127
 
128
+    uint64_t computeSSD(pixel *fenc, pixel *rec, intptr_t stride, uint32_t width, uint32_t height, x265_param *param);
129
+
130
+    double ComputePSNR(x265_picture *firstPic, x265_picture *secPic, x265_param *param);
131
+
132
+    void copyPicture(x265_picture *dest, const x265_picture *src);
133
+
134
+    bool computeHistograms(x265_picture *pic);
135
+    void computeHistogramSAD(double *maxUVNormalizedSAD, double *edgeNormalizedSAD, int curPoc);
136
+    void findSceneCuts(x265_picture *pic, bool& bDup, double m_maxUVSADVal, double m_edgeSADVal);
137
+
138
     void initRefIdx();
139
     void analyseRefIdx(int *numRefIdx);
140
     void updateRefIdx();
141
x265_3.2.1.tar.gz/source/encoder/entropy.cpp -> x265_3.3.tar.gz/source/encoder/entropy.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/entropy.h -> x265_3.3.tar.gz/source/encoder/entropy.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/frameencoder.cpp -> x265_3.3.tar.gz/source/encoder/frameencoder.cpp Changed
26
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Chung Shin Yee <shinyee@multicorewareinc.com>
7
  *          Min Chen <chenm003@163.com>
8
@@ -591,7 +591,7 @@
9
 
10
     /* Clip slice QP to 0-51 spec range before encoding */
11
     slice->m_sliceQp = x265_clip3(-QP_BD_OFFSET, QP_MAX_SPEC, qp);
12
-    if (m_param->bHDROpt)
13
+    if (m_param->bHDR10Opt)
14
     {
15
         int qpCb = x265_clip3(-12, 0, (int)floor((m_top->m_cB * ((-.46) * qp + 9.26)) + 0.5 ));
16
         int qpCr = x265_clip3(-12, 0, (int)floor((m_top->m_cR * ((-.46) * qp + 9.26)) + 0.5 ));
17
@@ -713,6 +713,8 @@
18
                         sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top */;
19
                 }
20
             }
21
+            else if (m_param->bEnableFrameDuplication)
22
+                sei->m_picStruct = m_frame->m_picStruct;
23
             else
24
                 sei->m_picStruct = m_param->pictureStructure;
25
 
26
x265_3.2.1.tar.gz/source/encoder/frameencoder.h -> x265_3.3.tar.gz/source/encoder/frameencoder.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Shin Yee <shinyee@multicorewareinc.com>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/framefilter.cpp -> x265_3.3.tar.gz/source/encoder/framefilter.cpp Changed
108
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Chung Shin Yee <shinyee@multicorewareinc.com>
7
  *          Min Chen <chenm003@163.com>
8
@@ -32,7 +32,6 @@
9
 
10
 using namespace X265_NS;
11
 
12
-static uint64_t computeSSD(pixel *fenc, pixel *rec, intptr_t stride, uint32_t width, uint32_t height);
13
 static float calculateSSIM(pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, uint32_t width, uint32_t height, void *buf, uint32_t& cnt);
14
 
15
 namespace X265_NS
16
@@ -673,7 +672,7 @@
17
         uint32_t width  = reconPic->m_picWidth - m_pad[0];
18
         uint32_t height = m_parallelFilter[row].getCUHeight();
19
 
20
-        uint64_t ssdY = computeSSD(fencPic->getLumaAddr(cuAddr), reconPic->getLumaAddr(cuAddr), stride, width, height);
21
+        uint64_t ssdY = m_frameEncoder->m_top->computeSSD(fencPic->getLumaAddr(cuAddr), reconPic->getLumaAddr(cuAddr), stride, width, height, m_param);
22
         m_frameEncoder->m_SSDY += ssdY;
23
 
24
         if (m_param->internalCsp != X265_CSP_I400)
25
@@ -682,8 +681,8 @@
26
             width >>= m_hChromaShift;
27
             stride = reconPic->m_strideC;
28
 
29
-            uint64_t ssdU = computeSSD(fencPic->getCbAddr(cuAddr), reconPic->getCbAddr(cuAddr), stride, width, height);
30
-            uint64_t ssdV = computeSSD(fencPic->getCrAddr(cuAddr), reconPic->getCrAddr(cuAddr), stride, width, height);
31
+            uint64_t ssdU = m_frameEncoder->m_top->computeSSD(fencPic->getCbAddr(cuAddr), reconPic->getCbAddr(cuAddr), stride, width, height, m_param);
32
+            uint64_t ssdV = m_frameEncoder->m_top->computeSSD(fencPic->getCrAddr(cuAddr), reconPic->getCrAddr(cuAddr), stride, width, height, m_param);
33
 
34
             m_frameEncoder->m_SSDU += ssdU;
35
             m_frameEncoder->m_SSDV += ssdV;
36
@@ -825,71 +824,6 @@
37
     }
38
 }
39
 
40
-static uint64_t computeSSD(pixel *fenc, pixel *rec, intptr_t stride, uint32_t width, uint32_t height)
41
-{
42
-    uint64_t ssd = 0;
43
-
44
-    if ((width | height) & 3)
45
-    {
46
-        /* Slow Path */
47
-        for (uint32_t y = 0; y < height; y++)
48
-        {
49
-            for (uint32_t x = 0; x < width; x++)
50
-            {
51
-                int diff = (int)(fenc[x] - rec[x]);
52
-                ssd += diff * diff;
53
-            }
54
-
55
-            fenc += stride;
56
-            rec += stride;
57
-        }
58
-
59
-        return ssd;
60
-    }
61
-
62
-    uint32_t y = 0;
63
-
64
-    /* Consume rows in ever narrower chunks of height */
65
-    for (int size = BLOCK_64x64; size >= BLOCK_4x4 && y < height; size--)
66
-    {
67
-        uint32_t rowHeight = 1 << (size + 2);
68
-
69
-        for (; y + rowHeight <= height; y += rowHeight)
70
-        {
71
-            uint32_t y1, x = 0;
72
-
73
-            /* Consume each row using the largest square blocks possible */
74
-            if (size == BLOCK_64x64 && !(stride & 31))
75
-                for (; x + 64 <= width; x += 64)
76
-                    ssd += primitives.cu[BLOCK_64x64].sse_pp(fenc + x, stride, rec + x, stride);
77
-
78
-            if (size >= BLOCK_32x32 && !(stride & 15))
79
-                for (; x + 32 <= width; x += 32)
80
-                    for (y1 = 0; y1 + 32 <= rowHeight; y1 += 32)
81
-                        ssd += primitives.cu[BLOCK_32x32].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
82
-
83
-            if (size >= BLOCK_16x16)
84
-                for (; x + 16 <= width; x += 16)
85
-                    for (y1 = 0; y1 + 16 <= rowHeight; y1 += 16)
86
-                        ssd += primitives.cu[BLOCK_16x16].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
87
-
88
-            if (size >= BLOCK_8x8)
89
-                for (; x + 8 <= width; x += 8)
90
-                    for (y1 = 0; y1 + 8 <= rowHeight; y1 += 8)
91
-                        ssd += primitives.cu[BLOCK_8x8].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
92
-
93
-            for (; x + 4 <= width; x += 4)
94
-                for (y1 = 0; y1 + 4 <= rowHeight; y1 += 4)
95
-                    ssd += primitives.cu[BLOCK_4x4].sse_pp(fenc + y1 * stride + x, stride, rec + y1 * stride + x, stride);
96
-
97
-            fenc += stride * rowHeight;
98
-            rec += stride * rowHeight;
99
-        }
100
-    }
101
-
102
-    return ssd;
103
-}
104
-
105
 /* Function to calculate SSIM for each row */
106
 static float calculateSSIM(pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, uint32_t width, uint32_t height, void *buf, uint32_t& cnt)
107
 {
108
x265_3.2.1.tar.gz/source/encoder/framefilter.h -> x265_3.3.tar.gz/source/encoder/framefilter.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Chung Shin Yee <shinyee@multicorewareinc.com>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/level.cpp -> x265_3.3.tar.gz/source/encoder/level.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/level.h -> x265_3.3.tar.gz/source/encoder/level.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/encoder/motion.cpp -> x265_3.3.tar.gz/source/encoder/motion.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/motion.h -> x265_3.3.tar.gz/source/encoder/motion.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/nal.cpp -> x265_3.3.tar.gz/source/encoder/nal.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/nal.h -> x265_3.3.tar.gz/source/encoder/nal.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *
8
x265_3.2.1.tar.gz/source/encoder/ratecontrol.cpp -> x265_3.3.tar.gz/source/encoder/ratecontrol.cpp Changed
340
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Sumalatha Polureddy <sumalatha@multicorewareinc.com>
7
  *          Aarthi Priya Thirumalai <aarthi@multicorewareinc.com>
8
@@ -53,7 +53,7 @@
9
 {\
10
     bErr = 0;\
11
     p = strstr(opts, opt "=");\
12
-    char* q = strstr(opts, "no-" opt);\
13
+    char* q = strstr(opts, "no-" opt " ");\
14
     if (p && sscanf(p, opt "=%d" , &i) && param_val != i)\
15
         bErr = 1;\
16
     else if (!param_val && !q && !p)\
17
@@ -146,9 +146,10 @@
18
     return NULL;
19
 }
20
 
21
-RateControl::RateControl(x265_param& p)
22
+RateControl::RateControl(x265_param& p, Encoder *top)
23
 {
24
     m_param = &p;
25
+    m_top = top;
26
     int lowresCuWidth = ((m_param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
27
     int lowresCuHeight = ((m_param->sourceHeight / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
28
     m_ncu = lowresCuWidth * lowresCuHeight;
29
@@ -156,6 +157,7 @@
30
     m_qCompress = (m_param->rc.cuTree && !m_param->rc.hevcAq) ? 1 : m_param->rc.qCompress;
31
 
32
     // validate for param->rc, maybe it is need to add a function like x265_parameters_valiate()
33
+    m_zoneBufferIdx = 0;
34
     m_residualFrames = 0;
35
     m_partialResidualFrames = 0;
36
     m_residualCost = 0;
37
@@ -171,6 +173,8 @@
38
     m_lastPredictorReset = 0;
39
     m_avgPFrameQp = 0;
40
     m_isFirstMiniGop = false;
41
+    m_lastScenecut = -1;
42
+    m_lastScenecutAwareIFrame = -1;
43
     if (m_param->rc.rateControlMode == X265_RC_CRF)
44
     {
45
         m_param->rc.qp = (int)m_param->rc.rfConstant;
46
@@ -210,6 +214,7 @@
47
     m_lastBsliceSatdCost = 0;
48
     m_movingAvgSum = 0.0;
49
     m_isNextGop = false;
50
+    m_relativeComplexity = NULL;
51
 
52
     // vbv initialization
53
     m_param->rc.vbvBufferSize = x265_clip3(0, 2000000, m_param->rc.vbvBufferSize);
54
@@ -354,6 +359,16 @@
55
         m_initVbv = true;
56
     }
57
 
58
+    if (!m_param->bResetZoneConfig && (m_relativeComplexity == NULL))
59
+    {
60
+        m_relativeComplexity = X265_MALLOC(double, m_param->reconfigWindowSize);
61
+        if (m_relativeComplexity == NULL)
62
+        {
63
+            x265_log(m_param, X265_LOG_ERROR, "Failed to allocate memory for m_relativeComplexity\n");
64
+            return false;
65
+        }
66
+    }
67
+
68
     m_totalBits = 0;
69
     m_encodedBits = 0;
70
     m_framesDone = 0;
71
@@ -699,6 +714,8 @@
72
     {
73
         m_param->rc.vbvBufferSize = x265_clip3(0, 2000000, m_param->rc.vbvBufferSize);
74
         m_param->rc.vbvMaxBitrate = x265_clip3(0, 2000000, m_param->rc.vbvMaxBitrate);
75
+        if (m_param->reconfigWindowSize)
76
+            m_param->rc.vbvMaxBitrate = (int)(m_param->rc.vbvMaxBitrate * (double)(m_fps / m_param->reconfigWindowSize));
77
         if (m_param->rc.vbvMaxBitrate < m_param->rc.bitrate &&
78
             m_param->rc.rateControlMode == X265_RC_ABR)
79
         {
80
@@ -753,7 +770,7 @@
81
             m_qpConstant[P_SLICE] = m_qpConstant[I_SLICE] = m_qpConstant[B_SLICE] = m_qp;
82
         }
83
     }
84
-    m_bitrate = m_param->rc.bitrate * 1000;
85
+    m_bitrate = (double)m_param->rc.bitrate * 1000;
86
 }
87
 
88
 void RateControl::initHRD(SPS& sps)
89
@@ -1183,6 +1200,7 @@
90
             m_param->rc.bStatRead = 0;
91
             m_param->bFrameAdaptive = 0;
92
             m_param->scenecutThreshold = 0;
93
+            m_param->bHistBasedSceneCut = 0;
94
             m_param->rc.cuTree = 0;
95
             if (m_param->bframes > 1)
96
                 m_param->bframes = 1;
97
@@ -1244,16 +1262,43 @@
98
     m_predType = getPredictorType(curFrame->m_lowres.sliceType, m_sliceType);
99
     rce->poc = m_curSlice->m_poc;
100
 
101
-    /* change ratecontrol stats for next zone if specified */
102
-    for (int i = 0; i < m_param->rc.zonefileCount; i++)
103
+    if (!m_param->bResetZoneConfig && (rce->encodeOrder % m_param->reconfigWindowSize == 0))
104
     {
105
-        if (m_param->rc.zones[i].startFrame == curFrame->m_encodeOrder)
106
+        int index = m_zoneBufferIdx % m_param->rc.zonefileCount;
107
+        int read = m_top->zoneReadCount[index].get();
108
+        int write = m_top->zoneWriteCount[index].get();
109
+        if (write <= read)
110
+            write = m_top->zoneWriteCount[index].waitForChange(write);
111
+        m_zoneBufferIdx++;
112
+
113
+        for (int i = 0; i < m_param->rc.zonefileCount; i++)
114
+        {
115
+            if (m_param->rc.zones[i].startFrame == rce->encodeOrder)
116
+            {
117
+                m_param->rc.bitrate = m_param->rc.zones[i].zoneParam->rc.bitrate;
118
+                m_param->rc.vbvMaxBitrate = m_param->rc.zones[i].zoneParam->rc.vbvMaxBitrate;
119
+                memcpy(m_relativeComplexity, m_param->rc.zones[i].relativeComplexity, sizeof(double) * m_param->reconfigWindowSize);
120
+                reconfigureRC();
121
+                m_top->zoneReadCount[i].incr();
122
+            }
123
+        }
124
+    }
125
+    
126
+    
127
+    if (m_param->bResetZoneConfig)
128
+    {
129
+        /* change ratecontrol stats for next zone if specified */
130
+        for (int i = 0; i < m_param->rc.zonefileCount; i++)
131
         {
132
-            m_param = m_param->rc.zones[i].zoneParam;
133
-            reconfigureRC();
134
-            init(*m_curSlice->m_sps);
135
+            if (m_param->rc.zones[i].startFrame == curFrame->m_encodeOrder)
136
+            {
137
+                m_param = m_param->rc.zones[i].zoneParam;
138
+                reconfigureRC();
139
+                init(*m_curSlice->m_sps);
140
+            }
141
         }
142
     }
143
+
144
     if (m_param->rc.bStatRead)
145
     {
146
         X265_CHECK(rce->poc >= 0 && rce->poc < m_numEntries, "bad encode ordinal\n");
147
@@ -1648,6 +1693,31 @@
148
     return qScale;
149
 }
150
 
151
+double RateControl::tuneQScaleForZone(RateControlEntry *rce, double qScale)
152
+{
153
+    rce->frameSizePlanned = predictSize(&m_pred[m_predType], qScale, (double)m_currentSatd);
154
+    int loop = 0;
155
+
156
+    double availableBits = (double)m_param->rc.bitrate * 1000 * m_relativeComplexity[rce->encodeOrder % m_param->reconfigWindowSize];
157
+
158
+    // Tune qScale to adhere to the available frame bits.
159
+    for (int i = 0; i < 1000 && loop != 3; i++)
160
+    {
161
+        if (rce->frameSizePlanned < availableBits)
162
+        {
163
+            qScale = qScale / 1.01;
164
+            loop = loop | 1;
165
+        }
166
+        else if (rce->frameSizePlanned > availableBits)
167
+        {
168
+            qScale = qScale * 1.01;
169
+            loop = loop | 2;
170
+        }
171
+        rce->frameSizePlanned = predictSize(&m_pred[m_predType], qScale, (double)m_currentSatd);
172
+    }
173
+    return qScale;
174
+}
175
+
176
 double RateControl::tuneQScaleForGrain(double rcOverflow)
177
 {
178
     double qpstep = rcOverflow > 1.1 ? rcOverflow : m_lstep;
179
@@ -1776,6 +1846,16 @@
180
             }
181
             rce->qpNoVbv = q;
182
         }
183
+        /* Scenecut Aware QP offsets*/
184
+        if (m_param->bEnableSceneCutAwareQp)
185
+        {
186
+            double lqmin = m_lmin[m_sliceType];
187
+            double lqmax = m_lmax[m_sliceType];
188
+            qScale = scenecutAwareQp(curFrame, qScale);
189
+            qScale = x265_clip3(lqmin, lqmax, qScale);
190
+            q = x265_qScale2qp(qScale);
191
+            rce->qpNoVbv = q;
192
+        }
193
         if (m_isVbv)
194
         {
195
             lmin = m_lastQScaleFor[P_SLICE] / m_lstep;
196
@@ -1788,11 +1868,21 @@
197
                     qScale = x265_clip3(lmin, lmax, qScale);
198
                 q = x265_qScale2qp(qScale);
199
             }
200
+
201
+            if (!m_param->bResetZoneConfig)
202
+            {
203
+                double lqmin = m_lmin[m_sliceType];
204
+                double lqmax = m_lmax[m_sliceType];
205
+                qScale = tuneQScaleForZone(rce, qScale);
206
+                qScale = x265_clip3(lqmin, lqmax, qScale);
207
+            }
208
+
209
             if (!m_2pass)
210
             {
211
-                qScale = clipQscale(curFrame, rce, qScale);
212
                 /* clip qp to permissible range after vbv-lookahead estimation to avoid possible 
213
                  * mispredictions by initial frame size predictors */
214
+                qScale = clipQscale(curFrame, rce, qScale);
215
+
216
                 if (m_pred[m_predType].count == 1)
217
                     qScale = x265_clip3(lmin, lmax, qScale);
218
                 m_lastQScaleFor[m_sliceType] = qScale;
219
@@ -2014,7 +2104,29 @@
220
                 m_avgPFrameQp = m_avgPFrameQp == 0 ? rce->qpNoVbv : m_avgPFrameQp;
221
                 m_avgPFrameQp = (m_avgPFrameQp + rce->qpNoVbv) / 2;
222
             }
223
+
224
+            if (!m_param->bResetZoneConfig)
225
+            {
226
+                q = tuneQScaleForZone(rce, q);
227
+                q = x265_clip3(lqmin, lqmax, q);
228
+            }
229
+            /* Scenecut Aware QP offsets*/
230
+            if (m_param->bEnableSceneCutAwareQp)
231
+            {
232
+                double qmin = m_lmin[m_sliceType];
233
+                double qmax = m_lmax[m_sliceType];
234
+                q = scenecutAwareQp(curFrame, q);
235
+                q = x265_clip3(qmin, qmax, q);
236
+                rce->qpNoVbv = x265_qScale2qp(q);
237
+            }
238
             q = clipQscale(curFrame, rce, q);
239
+
240
+
241
+            if (m_2pass)
242
+                rce->frameSizePlanned = qScale2bits(rce, q);
243
+            else
244
+                rce->frameSizePlanned = predictSize(&m_pred[m_predType], q, (double)m_currentSatd);
245
+
246
             /*  clip qp to permissible range after vbv-lookahead estimation to avoid possible
247
              * mispredictions by initial frame size predictors, after each scenecut */
248
             bool isFrameAfterScenecut = m_sliceType!= I_SLICE && m_curSlice->m_refFrameList[0][0]->m_lowres.bScenecut;
249
@@ -2173,7 +2285,7 @@
250
     if (m_isVbv && m_currentSatd > 0 && curFrame)
251
     {
252
         if (m_param->lookaheadDepth || m_param->rc.cuTree ||
253
-            m_param->scenecutThreshold ||
254
+            (m_param->scenecutThreshold || m_param->bHistBasedSceneCut) ||
255
             (m_param->bFrameAdaptive && m_param->bframes))
256
         {
257
            /* Lookahead VBV: If lookahead is done, raise the quantizer as necessary
258
@@ -2193,7 +2305,8 @@
259
                 frameQ[B_SLICE] = frameQ[P_SLICE] * m_param->rc.pbFactor;
260
                 frameQ[I_SLICE] = frameQ[P_SLICE] / m_param->rc.ipFactor;
261
                 /* Loop over the planned future frames. */
262
-                for (int j = 0; bufferFillCur >= 0; j++)
263
+                bool iter = true;
264
+                for (int j = 0; bufferFillCur >= 0 && iter ; j++)
265
                 {
266
                     int type = curFrame->m_lowres.plannedType[j];
267
                     if (type == X265_TYPE_AUTO || totalDuration >= 1.0)
268
@@ -2207,6 +2320,8 @@
269
                     int predType = getPredictorType(curFrame->m_lowres.plannedType[j], type);
270
                     curBits = predictSize(&m_pred[predType], frameQ[type], (double)satd);
271
                     bufferFillCur -= curBits;
272
+                    if (!m_param->bResetZoneConfig && ((uint64_t)j == (m_param->reconfigWindowSize - 1)))
273
+                        iter = false;
274
                 }
275
                 if (rce->vbvEndAdj)
276
                 {
277
@@ -2976,6 +3091,9 @@
278
     X265_FREE(m_encOrder);
279
     for (int i = 0; i < 2; i++)
280
         X265_FREE(m_cuTreeStats.qpBuffer[i]);
281
+    
282
+    if (m_relativeComplexity)
283
+        X265_FREE(m_relativeComplexity);
284
 
285
 }
286
 
287
@@ -3024,3 +3142,52 @@
288
         buf = strstr(src, "~");
289
     }
290
 }
291
+
292
+double RateControl::scenecutAwareQp(Frame* curFrame, double q)
293
+{
294
+    uint32_t maxWindowSize = uint32_t((m_param->scenecutWindow / 1000.0) * (m_param->fpsNum / m_param->fpsDenom) + 0.5);
295
+    uint32_t windowSize = maxWindowSize / 3;
296
+    int lastScenecut = m_top->m_rateControl->m_lastScenecut;
297
+    int lastIFrame = m_top->m_rateControl->m_lastScenecutAwareIFrame;
298
+    double maxQpDelta = x265_qp2qScale(double(m_param->maxQpDelta));
299
+    double iSliceDelta = x265_qp2qScale(double(I_SLICE_DELTA));
300
+    double sliceTypeDelta = SLICE_TYPE_DELTA * maxQpDelta;
301
+    double window2Delta = WINDOW2_DELTA * maxQpDelta;
302
+    double window3Delta = WINDOW3_DELTA * maxQpDelta;
303
+
304
+    bool isFrameInsideWindow = curFrame->m_poc > lastScenecut && curFrame->m_poc <= (lastScenecut + int(maxWindowSize));
305
+
306
+    if (isFrameInsideWindow && IS_X265_TYPE_I(curFrame->m_lowres.sliceType))
307
+    {
308
+        m_top->m_rateControl->m_lastScenecutAwareIFrame = curFrame->m_poc;
309
+    }
310
+    else if (isFrameInsideWindow && (curFrame->m_lowres.sliceType == X265_TYPE_P))
311
+    {
312
+        if (!(lastIFrame > lastScenecut && lastIFrame <= (lastScenecut + int(maxWindowSize))
313
+            && curFrame->m_poc > lastIFrame))
314
+        {
315
+            q += maxQpDelta - sliceTypeDelta;
316
+            if (((curFrame->m_poc) > (lastScenecut + int(windowSize))) && ((curFrame->m_poc) <= (lastScenecut + 2 * int(windowSize))))
317
+                q -= window2Delta;
318
+            else if (curFrame->m_poc > lastScenecut + 2 * int(windowSize))
319
+                q -= window3Delta;
320
+        }
321
+    }
322
+    else if (isFrameInsideWindow && IS_X265_TYPE_B(curFrame->m_lowres.sliceType))
323
+    {
324
+        if (!(lastIFrame > lastScenecut && lastIFrame <= (lastScenecut + int(maxWindowSize))
325
+            && curFrame->m_poc > lastIFrame))
326
+        {
327
+            q += maxQpDelta;
328
+            if (curFrame->m_lowres.sliceType == X265_TYPE_B)
329
+                q += sliceTypeDelta;
330
+            if (((curFrame->m_poc) > (lastScenecut + int(windowSize))) && ((curFrame->m_poc) <= (lastScenecut + 2 * int(windowSize))))
331
+                q -= window2Delta;
332
+            else if (curFrame->m_poc > lastScenecut + 2 * int(windowSize))
333
+                q -= window3Delta;
334
+        }
335
+    }
336
+    if (IS_X265_TYPE_I(curFrame->m_lowres.sliceType) && curFrame->m_lowres.bScenecut)
337
+        q = q - iSliceDelta;
338
+    return q;
339
+}
340
x265_3.2.1.tar.gz/source/encoder/ratecontrol.h -> x265_3.3.tar.gz/source/encoder/ratecontrol.h Changed
77
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Sumalatha Polureddy <sumalatha@multicorewareinc.com>
7
  *          Aarthi Priya Thirumalai <aarthi@multicorewareinc.com>
8
@@ -46,6 +46,13 @@
9
 #define MIN_AMORTIZE_FRACTION 0.2
10
 #define CLIP_DURATION(f) x265_clip3(MIN_FRAME_DURATION, MAX_FRAME_DURATION, f)
11
 
12
+/*Scenecut Aware QP*/
13
+#define I_SLICE_DELTA           2   /* Subtracted from base QP for the scenecut I frames*/
14
+#define SLICE_TYPE_DELTA        0.3 /* The offset decremented or incremented for P-frames or b-frames respectively*/
15
+#define WINDOW1_DELTA           0   /* The offset for the frames coming in the window-1*/
16
+#define WINDOW2_DELTA           0.3 /* The offset for the frames coming in the window-2*/
17
+#define WINDOW3_DELTA           0.6 /* The offset for the frames coming in the window-3*/
18
+
19
 struct Predictor
20
 {
21
     double coeffMin;
22
@@ -128,6 +135,10 @@
23
     int         m_ncu;           /* number of CUs in a frame */
24
     int         m_qp;            /* updated qp for current frame */
25
 
26
+    /*Zone reconfiguration*/
27
+    double*     m_relativeComplexity;
28
+    int         m_zoneBufferIdx;
29
+
30
     bool   m_isAbr;
31
     bool   m_isVbv;
32
     bool   m_isCbr;
33
@@ -138,6 +149,8 @@
34
     bool   m_initVbv;
35
     int    m_lastAbrResetPoc;
36
 
37
+    int    m_lastScenecut;
38
+    int    m_lastScenecutAwareIFrame;
39
     double m_rateTolerance;
40
     double m_frameDuration;     /* current frame duration in seconds */
41
     double m_bitrate;
42
@@ -228,6 +241,8 @@
43
     int64_t m_predictedBits;
44
     int     *m_encOrder;
45
     RateControlEntry* m_rce2Pass;
46
+    Encoder* m_top;
47
+
48
     struct
49
     {
50
         uint16_t *qpBuffer[2]; /* Global buffers for converting MB-tree quantizer data. */
51
@@ -235,7 +250,7 @@
52
                                 * This value is the current position (0 or 1). */
53
     } m_cuTreeStats;
54
 
55
-    RateControl(x265_param& p);
56
+    RateControl(x265_param& p, Encoder *enc);
57
     bool init(const SPS& sps);
58
     void initHRD(SPS& sps);
59
     void reconfigureRC();
60
@@ -255,6 +270,8 @@
61
     int writeRateControlFrameStats(Frame* curFrame, RateControlEntry* rce);
62
     bool   initPass2();
63
 
64
+    double scenecutAwareQp(Frame* curFrame, double q);
65
+
66
 protected:
67
 
68
     static const int   s_slidingWindowFrames;
69
@@ -271,6 +288,7 @@
70
     double getQScale(RateControlEntry *rce, double rateFactor);
71
     double rateEstimateQscale(Frame* pic, RateControlEntry *rce); // main logic for calculating QP based on ABR
72
     double tuneAbrQScaleFromFeedback(double qScale);
73
+    double tuneQScaleForZone(RateControlEntry *rce, double qScale); // Tune qScale to adhere to zone budget
74
     void   accumPQpUpdate();
75
 
76
     int    getPredictorType(int lowresSliceType, int sliceType);
77
x265_3.2.1.tar.gz/source/encoder/rdcost.h -> x265_3.3.tar.gz/source/encoder/rdcost.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/reference.cpp -> x265_3.3.tar.gz/source/encoder/reference.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Deepthi Devaki <deepthidevaki@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/encoder/reference.h -> x265_3.3.tar.gz/source/encoder/reference.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/sao.cpp -> x265_3.3.tar.gz/source/encoder/sao.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/sao.h -> x265_3.3.tar.gz/source/encoder/sao.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/search.cpp -> x265_3.3.tar.gz/source/encoder/search.cpp Changed
26
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
@@ -2208,7 +2208,7 @@
9
         x265_analysis_inter_data* interDataCTU = NULL;
10
         int cuIdx;
11
         cuIdx = (interMode.cu.m_cuAddr * m_param->num4x4Partitions) + cuGeom.absPartIdx;
12
-        if (m_param->analysisReuseLevel == 10 && m_param->interRefine > 1)
13
+        if (m_param->analysisLoadReuseLevel == 10 && m_param->interRefine > 1)
14
         {
15
             interDataCTU = m_frame->m_analysisData.interData;
16
             if ((cu.m_predMode[pu.puAbsPartIdx] == interDataCTU->modes[cuIdx + pu.puAbsPartIdx])
17
@@ -2227,7 +2227,7 @@
18
 
19
         cu.getNeighbourMV(puIdx, pu.puAbsPartIdx, interMode.interNeighbours);
20
         /* Uni-directional prediction */
21
-        if ((m_param->analysisLoad && m_param->analysisReuseLevel > 1 && m_param->analysisReuseLevel != 10)
22
+        if ((m_param->analysisLoadReuseLevel > 1 && m_param->analysisLoadReuseLevel != 10)
23
             || (m_param->analysisMultiPassRefine && m_param->rc.bStatRead) || (m_param->bAnalysisType == AVC_INFO) || (useAsMVP))
24
         {
25
             for (int list = 0; list < numPredDir; list++)
26
x265_3.2.1.tar.gz/source/encoder/search.h -> x265_3.3.tar.gz/source/encoder/search.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/encoder/sei.cpp -> x265_3.3.tar.gz/source/encoder/sei.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *
8
x265_3.2.1.tar.gz/source/encoder/sei.h -> x265_3.3.tar.gz/source/encoder/sei.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
-* Copyright (C) 2013-2017 MulticoreWare, Inc
4
+* Copyright (C) 2013-2020 MulticoreWare, Inc
5
 *
6
 * Authors: Steve Borho <steve@borho.org>
7
 *
8
x265_3.2.1.tar.gz/source/encoder/slicetype.cpp -> x265_3.3.tar.gz/source/encoder/slicetype.cpp Changed
333
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
7
  *          Steve Borho <steve@borho.org>
8
@@ -85,6 +85,69 @@
9
 
10
 } // end anonymous namespace
11
 
12
+namespace X265_NS {
13
+
14
+bool computeEdge(pixel *edgePic, pixel *refPic, pixel *edgeTheta, intptr_t stride, int height, int width, bool bcalcTheta)
15
+{
16
+    intptr_t rowOne = 0, rowTwo = 0, rowThree = 0, colOne = 0, colTwo = 0, colThree = 0;
17
+    intptr_t middle = 0, topLeft = 0, topRight = 0, bottomLeft = 0, bottomRight = 0;
18
+
19
+    const int startIndex = 1;
20
+
21
+    if (!edgePic || !refPic || (!edgeTheta && bcalcTheta))
22
+    {
23
+        return false;
24
+    }
25
+    else
26
+    {
27
+        float gradientH = 0, gradientV = 0, radians = 0, theta = 0;
28
+        float gradientMagnitude = 0;
29
+        pixel blackPixel = 0;
30
+
31
+        //Applying Sobel filter expect for border pixels
32
+        height = height - startIndex;
33
+        width = width - startIndex;
34
+        for (int rowNum = startIndex; rowNum < height; rowNum++)
35
+        {
36
+            rowTwo = rowNum * stride;
37
+            rowOne = rowTwo - stride;
38
+            rowThree = rowTwo + stride;
39
+
40
+            for (int colNum = startIndex; colNum < width; colNum++)
41
+            {
42
+
43
+                 /*  Horizontal and vertical gradients
44
+                     [ -3   0   3 ]        [-3   -10  -3 ]
45
+                 gH =[ -10  0   10]   gV = [ 0    0    0 ]
46
+                     [ -3   0   3 ]        [ 3    10   3 ] */
47
+
48
+                colTwo = colNum;
49
+                colOne = colTwo - startIndex;
50
+                colThree = colTwo + startIndex;
51
+                middle = rowTwo + colTwo;
52
+                topLeft = rowOne + colOne;
53
+                topRight = rowOne + colThree;
54
+                bottomLeft = rowThree + colOne;
55
+                bottomRight = rowThree + colThree;
56
+                gradientH = (float)(-3 * refPic[topLeft] + 3 * refPic[topRight] - 10 * refPic[rowTwo + colOne] + 10 * refPic[rowTwo + colThree] - 3 * refPic[bottomLeft] + 3 * refPic[bottomRight]);
57
+                gradientV = (float)(-3 * refPic[topLeft] - 10 * refPic[rowOne + colTwo] - 3 * refPic[topRight] + 3 * refPic[bottomLeft] + 10 * refPic[rowThree + colTwo] + 3 * refPic[bottomRight]);
58
+                gradientMagnitude = sqrtf(gradientH * gradientH + gradientV * gradientV);
59
+                if(bcalcTheta) 
60
+                {
61
+                    edgeTheta[middle] = 0;
62
+                    radians = atan2(gradientV, gradientH);
63
+                    theta = (float)((radians * 180) / PI);
64
+                    if (theta < 0)
65
+                       theta = 180 + theta;
66
+                    edgeTheta[middle] = (pixel)theta;
67
+                }
68
+                edgePic[middle] = (pixel)(gradientMagnitude >= edgeThreshold ? edgeThreshold : blackPixel);
69
+            }
70
+        }
71
+        return true;
72
+    }
73
+}
74
+
75
 void edgeFilter(Frame *curFrame, x265_param* param)
76
 {
77
     int height = curFrame->m_fencPic->m_picHeight;
78
@@ -114,6 +177,7 @@
79
     //Applying Gaussian filter on the picture
80
     src = (pixel*)curFrame->m_fencPic->m_picOrg[0];
81
     refPic = curFrame->m_gaussianPic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
82
+    edgePic = curFrame->m_edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
83
     pixel pixelValue = 0;
84
 
85
     for (int rowNum = 0; rowNum < height; rowNum++)
86
@@ -146,51 +210,8 @@
87
         }
88
     }
89
 
90
-#if HIGH_BIT_DEPTH //10-bit build
91
-    float threshold = 1023;
92
-    pixel whitePixel = 1023;
93
-#else
94
-    float threshold = 255;
95
-    pixel whitePixel = 255;
96
-#endif
97
-#define PI 3.14159265 
98
-
99
-    float gradientH = 0, gradientV = 0, radians = 0, theta = 0;
100
-    float gradientMagnitude = 0;
101
-    pixel blackPixel = 0;
102
-    edgePic = curFrame->m_edgePic + curFrame->m_fencPic->m_lumaMarginY * stride + curFrame->m_fencPic->m_lumaMarginX;
103
-    //Applying Sobel filter on the gaussian filtered picture
104
-    for (int rowNum = 0; rowNum < height; rowNum++)
105
-    {
106
-        for (int colNum = 0; colNum < width; colNum++)
107
-        {
108
-            edgeTheta[(rowNum*stride) + colNum] = 0;
109
-            if ((rowNum != 0) && (colNum != 0) && (rowNum != height - 1) && (colNum != width - 1)) //Ignoring the border pixels of the picture
110
-            {
111
-                /*Horizontal and vertical gradients
112
-                       [ -3   0   3 ]        [-3   -10  -3 ]
113
-                  gH = [ -10  0   10]   gV = [ 0    0    0 ]
114
-                       [ -3   0   3 ]        [ 3    10   3 ]*/
115
-
116
-                const intptr_t rowOne = (rowNum - 1)*stride, colOne = colNum -1;
117
-                const intptr_t rowTwo = rowNum * stride, colTwo = colNum;
118
-                const intptr_t rowThree = (rowNum + 1)*stride, colThree = colNum + 1;
119
-                const intptr_t index = (rowNum*stride) + colNum;
120
-
121
-                gradientH = (float)(-3 * refPic[rowOne + colOne] + 3 * refPic[rowOne + colThree] - 10 * refPic[rowTwo + colOne] + 10 * refPic[rowTwo + colThree] - 3 * refPic[rowThree + colOne] + 3 * refPic[rowThree + colThree]);
122
-                gradientV = (float)(-3 * refPic[rowOne + colOne] - 10 * refPic[rowOne + colTwo] - 3 * refPic[rowOne + colThree] + 3 * refPic[rowThree + colOne] + 10 * refPic[rowThree + colTwo] + 3 * refPic[rowThree + colThree]);
123
-
124
-                gradientMagnitude = sqrtf(gradientH * gradientH + gradientV * gradientV);
125
-                radians = atan2(gradientV, gradientH);
126
-                theta = (float)((radians * 180) / PI);
127
-                if (theta < 0)
128
-                    theta = 180 + theta;
129
-                edgeTheta[(rowNum*stride) + colNum] = (pixel)theta;
130
-
131
-                edgePic[index] = gradientMagnitude >= threshold ? whitePixel : blackPixel;
132
-            }
133
-        }
134
-    }
135
+    if(!computeEdge(edgePic, refPic, edgeTheta, stride, height, width, true))
136
+        x265_log(NULL, X265_LOG_ERROR, "Failed edge computation!");
137
 }
138
 
139
 //Find the angle of a block by averaging the pixel angles 
140
@@ -572,7 +593,7 @@
141
                             qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8)));
142
                         }
143
 
144
-                        if (param->bHDROpt)
145
+                        if (param->bHDR10Opt)
146
                         {
147
                             uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);
148
                             uint32_t lumaAvg = sum / (loopIncr * loopIncr);
149
@@ -1471,7 +1492,7 @@
150
 
151
     if (m_lastNonB && !m_param->rc.bStatRead &&
152
         ((m_param->bFrameAdaptive && m_param->bframes) ||
153
-         m_param->rc.cuTree || m_param->scenecutThreshold ||
154
+         m_param->rc.cuTree || m_param->scenecutThreshold || m_param->bHistBasedSceneCut ||
155
          (m_param->lookaheadDepth && m_param->rc.vbvBufferSize)))
156
     {
157
         slicetypeAnalyse(frames, false);
158
@@ -1531,12 +1552,15 @@
159
             if (frm.bIsFadeEnd){
160
                 frm.sliceType = m_param->bOpenGOP && m_lastKeyframe >= 0 ? X265_TYPE_I : X265_TYPE_IDR;
161
             }
162
-            for (int i = 0; i < m_param->rc.zonefileCount; i++)
163
+            if (m_param->bResetZoneConfig)
164
             {
165
-                int curZoneStart = m_param->rc.zones[i].startFrame;
166
-                curZoneStart += curZoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
167
-                if (curZoneStart == frm.frameNum)
168
-                    frm.sliceType = X265_TYPE_IDR;
169
+                for (int i = 0; i < m_param->rc.zonefileCount; i++)
170
+                {
171
+                    int curZoneStart = m_param->rc.zones[i].startFrame;
172
+                    curZoneStart += curZoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
173
+                    if (curZoneStart == frm.frameNum)
174
+                        frm.sliceType = X265_TYPE_IDR;
175
+                }
176
             }
177
             if ((frm.sliceType == X265_TYPE_I && frm.frameNum - m_lastKeyframe >= m_param->keyframeMin) || (frm.frameNum == (m_param->chunkStart - 1)) || (frm.frameNum == m_param->chunkEnd))
178
             {
179
@@ -1554,16 +1578,19 @@
180
                 m_lastKeyframe = frm.frameNum;
181
                 frm.bKeyframe = true;
182
                 int zoneRadl = 0;
183
-                for (int i = 0; i < m_param->rc.zonefileCount; i++)
184
+                if (m_param->bResetZoneConfig)
185
                 {
186
-                    int zoneStart = m_param->rc.zones[i].startFrame;
187
-                    zoneStart += zoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
188
-                    if (zoneStart == frm.frameNum)
189
+                    for (int i = 0; i < m_param->rc.zonefileCount; i++)
190
                     {
191
-                        zoneRadl = m_param->rc.zones[i].zoneParam->radl;
192
-                        m_param->radl = 0;
193
-                        m_param->rc.zones->zoneParam->radl = i < m_param->rc.zonefileCount - 1? m_param->rc.zones[i + 1].zoneParam->radl : 0;
194
-                        break;
195
+                        int zoneStart = m_param->rc.zones[i].startFrame;
196
+                        zoneStart += zoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
197
+                        if (zoneStart == frm.frameNum)
198
+                        {
199
+                            zoneRadl = m_param->rc.zones[i].zoneParam->radl;
200
+                            m_param->radl = 0;
201
+                            m_param->rc.zones->zoneParam->radl = i < m_param->rc.zonefileCount - 1 ? m_param->rc.zones[i + 1].zoneParam->radl : 0;
202
+                            break;
203
+                        }
204
                     }
205
                 }
206
                 if (bframes > 0 && !m_param->radl && !zoneRadl)
207
@@ -1748,7 +1775,7 @@
208
     if (m_param->bBPyramid && curNonB - prevNonB > 1)
209
         curBRef = (prevNonB + curNonB + 1) / 2;
210
     int miniGopEnd = keyframe ? prevNonB : curNonB;
211
-    while (curNonB < numFrames + !keyframe)
212
+    while (curNonB <= numFrames)
213
     {
214
         /* P/I cost: This shouldn't include the cost of nextNonB */
215
         if (nextNonB != curNonB)
216
@@ -1854,13 +1881,16 @@
217
     }
218
     frames[framecnt + 1] = NULL;
219
 
220
-    for (int i = 0; i < m_param->rc.zonefileCount; i++)
221
+    if (m_param->bResetZoneConfig)
222
     {
223
-        int curZoneStart = m_param->rc.zones[i].startFrame, nextZoneStart = 0;
224
-        curZoneStart += curZoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
225
-        nextZoneStart += (i + 1 < m_param->rc.zonefileCount) ? m_param->rc.zones[i + 1].startFrame + m_param->rc.zones[i + 1].zoneParam->radl : m_param->totalFrames;
226
-        if (curZoneStart <= frames[0]->frameNum && nextZoneStart > frames[0]->frameNum)
227
-            m_param->keyframeMax = nextZoneStart - curZoneStart;
228
+        for (int i = 0; i < m_param->rc.zonefileCount; i++)
229
+        {
230
+            int curZoneStart = m_param->rc.zones[i].startFrame, nextZoneStart = 0;
231
+            curZoneStart += curZoneStart ? m_param->rc.zones[i].zoneParam->radl : 0;
232
+            nextZoneStart += (i + 1 < m_param->rc.zonefileCount) ? m_param->rc.zones[i + 1].startFrame + m_param->rc.zones[i + 1].zoneParam->radl : m_param->totalFrames;
233
+            if (curZoneStart <= frames[0]->frameNum && nextZoneStart > frames[0]->frameNum)
234
+                m_param->keyframeMax = nextZoneStart - curZoneStart;
235
+        }
236
     }
237
     int keylimit = m_param->keyframeMax;
238
     if (frames[0]->frameNum < m_param->chunkEnd)
239
@@ -1962,10 +1992,15 @@
240
 
241
     int numBFrames = 0;
242
     int numAnalyzed = numFrames;
243
-    bool isScenecut = scenecut(frames, 0, 1, true, origNumFrames);
244
+    bool isScenecut = false;
245
 
246
     /* When scenecut threshold is set, use scenecut detection for I frame placements */
247
-    if (m_param->scenecutThreshold && isScenecut)
248
+    if (m_param->bHistBasedSceneCut)
249
+        isScenecut = frames[1]->bScenecut;
250
+    else
251
+        isScenecut = scenecut(frames, 0, 1, true, origNumFrames);
252
+
253
+    if (isScenecut && (m_param->bHistBasedSceneCut || m_param->scenecutThreshold))
254
     {
255
         frames[1]->sliceType = X265_TYPE_I;
256
         return;
257
@@ -1976,14 +2011,17 @@
258
         m_extendGopBoundary = false;
259
         for (int i = m_param->bframes + 1; i < origNumFrames; i += m_param->bframes + 1)
260
         {
261
-            scenecut(frames, i, i + 1, true, origNumFrames);
262
+            if (!m_param->bHistBasedSceneCut)
263
+                scenecut(frames, i, i + 1, true, origNumFrames);
264
+
265
             for (int j = i + 1; j <= X265_MIN(i + m_param->bframes + 1, origNumFrames); j++)
266
             {
267
-                if (frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true) )
268
-                {
269
-                    m_extendGopBoundary = true;
270
-                    break;
271
-                }
272
+                if ((!m_param->bHistBasedSceneCut && frames[j]->bScenecut && scenecutInternal(frames, j - 1, j, true)) || 
273
+                    (m_param->bHistBasedSceneCut && frames[j]->bScenecut))
274
+                    {
275
+                        m_extendGopBoundary = true;
276
+                        break;
277
+                    }
278
             }
279
             if (m_extendGopBoundary)
280
                 break;
281
@@ -2071,7 +2109,7 @@
282
             frames[numFrames]->sliceType = X265_TYPE_P;
283
         }
284
 
285
-        int zoneRadl = m_param->rc.zonefileCount ? m_param->rc.zones->zoneParam->radl : 0;
286
+        int zoneRadl = m_param->rc.zonefileCount && m_param->bResetZoneConfig ? m_param->rc.zones->zoneParam->radl : 0;
287
         bool bForceRADL = (m_param->radl || zoneRadl) && !m_param->bOpenGOP;
288
         bool bLastMiniGop = (framecnt >= m_param->bframes + 1) ? false : true;
289
         int radl = m_param->radl ? m_param->radl : zoneRadl;
290
@@ -2088,13 +2126,14 @@
291
         {
292
             for (int j = 1; j < numBFrames + 1; j++)
293
             {
294
-                if (scenecut(frames, j, j + 1, false, origNumFrames) || 
295
+                if ((!m_param->bHistBasedSceneCut && scenecut(frames, j, j + 1, false, origNumFrames)) ||
296
+                    (m_param->bHistBasedSceneCut && frames[j + 1]->bScenecut) ||
297
                     (bForceRADL && (frames[j]->frameNum == preRADL)))
298
-                {
299
-                    frames[j]->sliceType = X265_TYPE_P;
300
-                    numAnalyzed = j;
301
-                    break;
302
-                }
303
+                    {
304
+                        frames[j]->sliceType = X265_TYPE_P;
305
+                        numAnalyzed = j;
306
+                        break;
307
+                    }
308
             }
309
         }
310
         resetStart = bKeyframe ? 1 : X265_MIN(numBFrames + 2, numAnalyzed + 1);
311
@@ -3201,12 +3240,13 @@
312
             }
313
         }
314
 
315
+        int searchRange = m_lookahead.m_param->bEnableHME ? (hme ? m_lookahead.m_param->hmeRange[0] : m_lookahead.m_param->hmeRange[1]) : s_merange;
316
         /* ME will never return a cost larger than the cost @MVP, so we do not
317
          * have to check that ME cost is more than the estimated merge cost */
318
         if(!hme)
319
-            fencCost = tld.me.motionEstimate(fref, mvmin, mvmax, mvp, 0, NULL, s_merange, *fencMV, m_lookahead.m_param->maxSlices);
320
+            fencCost = tld.me.motionEstimate(fref, mvmin, mvmax, mvp, 0, NULL, searchRange, *fencMV, m_lookahead.m_param->maxSlices);
321
         else
322
-            fencCost = tld.me.motionEstimate(fref, mvmin, mvmax, mvp, 0, NULL, s_merange, *fencMV, m_lookahead.m_param->maxSlices, fref->lowerResPlane[0]);
323
+            fencCost = tld.me.motionEstimate(fref, mvmin, mvmax, mvp, 0, NULL, searchRange, *fencMV, m_lookahead.m_param->maxSlices, fref->lowerResPlane[0]);
324
         if (skipCost < 64 && skipCost < fencCost && bBidir)
325
         {
326
             fencCost = skipCost;
327
@@ -3280,3 +3320,5 @@
328
     fenc->rowSatds[b - p0][p1 - b][cuY] += bcostAq;
329
     fenc->lowresCosts[b - p0][p1 - b][cuXY] = (uint16_t)(X265_MIN(bcost, LOWRES_COST_MASK) | (listused << LOWRES_COST_SHIFT));
330
 }
331
+
332
+}
333
x265_3.2.1.tar.gz/source/encoder/slicetype.h -> x265_3.3.tar.gz/source/encoder/slicetype.h Changed
31
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
@@ -43,6 +43,13 @@
9
 #define AQ_EDGE_BIAS 0.5
10
 #define EDGE_INCLINATION 45
11
 
12
+#if HIGH_BIT_DEPTH
13
+#define edgeThreshold 1023.0
14
+#else
15
+#define edgeThreshold 255.0
16
+#endif
17
+#define PI 3.14159265
18
+
19
 /* Thread local data for lookahead tasks */
20
 struct LookaheadTLD
21
 {
22
@@ -258,6 +265,7 @@
23
     CostEstimateGroup& operator=(const CostEstimateGroup&);
24
 };
25
 
26
-}
27
+bool computeEdge(pixel *edgePic, pixel *refPic, pixel *edgeTheta, intptr_t stride, int height, int width, bool bcalcTheta);
28
 
29
+}
30
 #endif // ifndef X265_SLICETYPE_H
31
x265_3.2.1.tar.gz/source/encoder/svt.h -> x265_3.3.tar.gz/source/encoder/svt.h Changed
25
 
1
@@ -29,7 +29,6 @@
2
 
3
 #include "EbApi.h"
4
 #include "EbErrorCodes.h"
5
-#include "EbTime.h"
6
 
7
 namespace X265_NS {
8
 
9
@@ -41,7 +40,7 @@
10
 #define EB_OUTPUTSTREAMBUFFERSIZE_MACRO(ResolutionSize)    ((ResolutionSize) < (INPUT_SIZE_1080i_TH) ? 0x1E8480 : (ResolutionSize) < (INPUT_SIZE_1080p_TH) ? 0x2DC6C0 : (ResolutionSize) < (INPUT_SIZE_4K_TH) ? 0x2DC6C0 : 0x2DC6C0)
11
 
12
 void svt_param_default(x265_param* param);
13
-int svt_set_preset_tune(x265_param* param, const char* preset, const char* tune);
14
+int svt_set_preset(x265_param* param, const char* preset);
15
 int svt_param_parse(x265_param* param, const char* name, const char* value);
16
 void svt_initialise_app_context(x265_encoder *enc);
17
 int svt_initialise_input_buffer(x265_encoder *enc);
18
@@ -49,4 +48,4 @@
19
 
20
 #endif // ifdef SVT_HEVC
21
 
22
-#endif // ifndef SVT_H
23
\ No newline at end of file
24
+#endif // ifndef SVT_H
25
x265_3.2.1.tar.gz/source/encoder/weightPrediction.cpp -> x265_3.3.tar.gz/source/encoder/weightPrediction.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Author: Shazeb Nawaz Khan <shazeb@multicorewareinc.com>
7
  *         Steve Borho <steve@borho.org>
8
x265_3.2.1.tar.gz/source/input/input.cpp -> x265_3.3.tar.gz/source/input/input.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/input/input.h -> x265_3.3.tar.gz/source/input/input.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/input/y4m.cpp -> x265_3.3.tar.gz/source/input/y4m.cpp Changed
16
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -388,6 +388,7 @@
9
         pic.bitDepth = depth;
10
         pic.framesize = framesize;
11
         pic.height = height;
12
+        pic.width = width;
13
         pic.colorSpace = colorSpace;
14
         pic.stride[0] = width * pixelbytes;
15
         pic.stride[1] = pic.stride[0] >> x265_cli_csps[colorSpace].width[1];
16
x265_3.2.1.tar.gz/source/input/y4m.h -> x265_3.3.tar.gz/source/input/y4m.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/input/yuv.cpp -> x265_3.3.tar.gz/source/input/yuv.cpp Changed
16
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -204,6 +204,7 @@
9
         pic.bitDepth = depth;
10
         pic.framesize = framesize;
11
         pic.height = height;
12
+        pic.width = width;
13
         pic.stride[0] = width * pixelbytes;
14
         pic.stride[1] = pic.stride[0] >> x265_cli_csps[colorSpace].width[1];
15
         pic.stride[2] = pic.stride[0] >> x265_cli_csps[colorSpace].width[2];
16
x265_3.2.1.tar.gz/source/input/yuv.h -> x265_3.3.tar.gz/source/input/yuv.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/output/output.cpp -> x265_3.3.tar.gz/source/output/output.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Xinyue Lu <i@7086.in>
8
x265_3.2.1.tar.gz/source/output/output.h -> x265_3.3.tar.gz/source/output/output.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Xinyue Lu <i@7086.in>
8
x265_3.2.1.tar.gz/source/output/raw.cpp -> x265_3.3.tar.gz/source/output/raw.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Xinyue Lu <i@7086.in>
8
x265_3.2.1.tar.gz/source/output/raw.h -> x265_3.3.tar.gz/source/output/raw.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Xinyue Lu <i@7086.in>
8
x265_3.2.1.tar.gz/source/output/reconplay.cpp -> x265_3.3.tar.gz/source/output/reconplay.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Peixuan Zhang <zhangpeixuancn@gmail.com>
7
  *          Chunli Zhang <chunli@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/output/reconplay.h -> x265_3.3.tar.gz/source/output/reconplay.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Peixuan Zhang <zhangpeixuancn@gmail.com>
7
  *          Chunli Zhang <chunli@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/output/y4m.cpp -> x265_3.3.tar.gz/source/output/y4m.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/output/y4m.h -> x265_3.3.tar.gz/source/output/y4m.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/output/yuv.cpp -> x265_3.3.tar.gz/source/output/yuv.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/output/yuv.h -> x265_3.3.tar.gz/source/output/yuv.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/profile/PPA/ppa.cpp -> x265_3.3.tar.gz/source/profile/PPA/ppa.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/profile/PPA/ppa.h -> x265_3.3.tar.gz/source/profile/PPA/ppa.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/profile/PPA/ppaApi.h -> x265_3.3.tar.gz/source/profile/PPA/ppaApi.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/profile/vtune/vtune.cpp -> x265_3.3.tar.gz/source/profile/vtune/vtune.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/profile/vtune/vtune.h -> x265_3.3.tar.gz/source/profile/vtune/vtune.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/test/checkasm-a.asm -> x265_3.3.tar.gz/source/test/checkasm-a.asm Changed
10
 
1
@@ -2,7 +2,7 @@
2
 ;* checkasm-a.asm: assembly check tool
3
 ;*****************************************************************************
4
 ;* Copyright (C) 2003-2013 x264 project
5
-;* Copyright (C) 2013-2017 MulticoreWare, Inc
6
+;* Copyright (C) 2013-2020 MulticoreWare, Inc
7
 ;*
8
 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
9
 ;*          Henrik Gramner <henrik@gramner.com>
10
x265_3.2.1.tar.gz/source/test/checkasm-arm.S -> x265_3.3.tar.gz/source/test/checkasm-arm.S Changed
10
 
1
@@ -1,7 +1,7 @@
2
 /****************************************************************************
3
  * checkasm-arm.S: assembly check tool
4
  *****************************************************************************
5
- * Copyright (C) 2013-2017 MulticoreWare, Inc
6
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
7
  *
8
  * Authors: Martin Storsjo <martin@martin.st>
9
  *          Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
10
x265_3.2.1.tar.gz/source/test/intrapredharness.cpp -> x265_3.3.tar.gz/source/test/intrapredharness.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <chenm003@163.com>
7
  *
8
x265_3.2.1.tar.gz/source/test/intrapredharness.h -> x265_3.3.tar.gz/source/test/intrapredharness.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Min Chen <chenm003@163.com>
7
  *
8
x265_3.2.1.tar.gz/source/test/ipfilterharness.cpp -> x265_3.3.tar.gz/source/test/ipfilterharness.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>,
7
  *          Rajesh Paulraj <rajesh@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/test/ipfilterharness.h -> x265_3.3.tar.gz/source/test/ipfilterharness.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Deepthi Devaki <deepthidevaki@multicorewareinc.com>,
7
  *          Rajesh Paulraj <rajesh@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/test/mbdstharness.cpp -> x265_3.3.tar.gz/source/test/mbdstharness.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/test/mbdstharness.h -> x265_3.3.tar.gz/source/test/mbdstharness.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <min.chen@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/test/pixelharness.cpp -> x265_3.3.tar.gz/source/test/pixelharness.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/test/pixelharness.h -> x265_3.3.tar.gz/source/test/pixelharness.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/test/regression-tests.txt -> x265_3.3.tar.gz/source/test/regression-tests.txt Changed
88
 
1
@@ -18,17 +18,17 @@
2
 BasketballDrive_1920x1080_50.y4m,--preset faster --aq-strength 2 --merange 190 --slices 3
3
 BasketballDrive_1920x1080_50.y4m,--preset medium --ctu 16 --max-tu-size 8 --subme 7 --qg-size 16 --cu-lossless --tu-inter-depth 3 --limit-tu 1
4
 BasketballDrive_1920x1080_50.y4m,--preset medium --keyint -1 --nr-inter 100 -F4 --no-sao
5
-BasketballDrive_1920x1080_50.y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes::--preset medium --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 7000 --limit-modes
6
+BasketballDrive_1920x1080_50.y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 2 --bitrate 7000 --limit-modes::--preset medium --no-cutree --analysis-load x265_analysis.dat --analysis-load-reuse-level 2 --bitrate 7000 --limit-modes
7
 BasketballDrive_1920x1080_50.y4m,--preset slow --nr-intra 100 -F4 --aq-strength 3 --qg-size 16 --limit-refs 1
8
 BasketballDrive_1920x1080_50.y4m,--preset slower --lossless --chromaloc 3 --subme 0 --limit-tu 4
9
-BasketballDrive_1920x1080_50.y4m,--preset slower --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0::--preset slower --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 10 --bitrate 7000 --limit-tu 0
10
+BasketballDrive_1920x1080_50.y4m,--preset slower --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 10 --bitrate 7000 --limit-tu 0::--preset slower --no-cutree --analysis-load x265_analysis.dat --analysis-load-reuse-level 10 --bitrate 7000 --limit-tu 0
11
 BasketballDrive_1920x1080_50.y4m,--preset veryslow --crf 4 --cu-lossless --pmode --limit-refs 1 --aq-mode 3 --limit-tu 3
12
-BasketballDrive_1920x1080_50.y4m,--preset veryslow --no-cutree --analysis-save x265_analysis.dat --crf 18 --tskip-fast --limit-tu 2::--preset veryslow --no-cutree --analysis-load x265_analysis.dat --crf 18 --tskip-fast --limit-tu 2
13
+BasketballDrive_1920x1080_50.y4m,--preset veryslow --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 5 --crf 18 --tskip-fast --limit-tu 2::--preset veryslow --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 5 --crf 18 --tskip-fast --limit-tu 2
14
 BasketballDrive_1920x1080_50.y4m,--preset veryslow --recon-y4m-exec "ffplay -i pipe:0 -autoexit"
15
 Coastguard-4k.y4m,--preset ultrafast --recon-y4m-exec "ffplay -i pipe:0 -autoexit"
16
 Coastguard-4k.y4m,--preset superfast --tune grain --overscan=crop
17
 Coastguard-4k.y4m,--preset superfast --tune grain --pme --aq-strength 2 --merange 190
18
-Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 1 --qp 35::--preset veryfast --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 1 --qp 35
19
+Coastguard-4k.y4m,--preset veryfast --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 1 --qp 35::--preset veryfast --no-cutree --analysis-load x265_analysis.dat --analysis-load-reuse-level 1 --qp 35
20
 Coastguard-4k.y4m,--preset medium --rdoq-level 1 --tune ssim --no-signhide --me umh --slices 2
21
 Coastguard-4k.y4m,--preset slow --tune psnr --cbqpoffs -1 --crqpoffs 1 --limit-refs 1
22
 CrowdRun_1920x1080_50_10bit_422.yuv,--preset ultrafast --weightp --tune zerolatency --qg-size 16
23
@@ -53,7 +53,7 @@
24
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset veryfast --weightp --nr-intra 1000 -F4
25
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset medium --nr-inter 500 -F4 --no-psy-rdoq
26
 DucksAndLegs_1920x1080_60_10bit_444.yuv,--preset slower --no-weightp --rdoq-level 0 --limit-refs 3 --tu-inter-depth 4 --limit-tu 3
27
-DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset fast --no-cutree --analysis-save x265_analysis.dat --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1::--preset fast --no-cutree --analysis-load x265_analysis.dat --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1
28
+DucksAndLegs_1920x1080_60_10bit_422.yuv,--preset fast --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 5 --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1::--preset fast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 5 --bitrate 3000 --early-skip --tu-inter-depth 3 --limit-tu 1
29
 FourPeople_1280x720_60.y4m,--preset superfast --no-wpp --lookahead-slices 2
30
 FourPeople_1280x720_60.y4m,--preset veryfast --aq-mode 2 --aq-strength 1.5 --qg-size 8
31
 FourPeople_1280x720_60.y4m,--preset medium --qp 38 --no-psy-rd
32
@@ -70,8 +70,8 @@
33
 KristenAndSara_1280x720_60.y4m,--preset slower --pmode --max-tu-size 8 --limit-refs 0 --limit-modes --limit-tu 1
34
 NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset superfast --tune psnr
35
 NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset medium --tune grain --limit-refs 2
36
-NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset slow --no-cutree --analysis-save x265_analysis.dat --rd 5 --analysis-reuse-level 10 --bitrate 9000 --vbv-maxrate 9000 --vbv-bufsize 9000::--preset slow --no-cutree --analysis-load x265_analysis.dat --rd 5 --analysis-reuse-level 10 --bitrate 9000 --vbv-maxrate 9000 --vbv-bufsize 9000
37
-News-4k.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000::--preset ultrafast --no-cutree --analysis-load x265_analysis.dat --analysis-reuse-level 2 --bitrate 15000
38
+NebutaFestival_2560x1600_60_10bit_crop.yuv,--preset slow --no-cutree --analysis-save x265_analysis.dat --rd 5 --analysis-save-reuse-level 10 --bitrate 9000 --vbv-maxrate 9000 --vbv-bufsize 9000::--preset slow --no-cutree --analysis-load x265_analysis.dat --rd 5 --analysis-load-reuse-level 10 --bitrate 9000 --vbv-maxrate 9000 --vbv-bufsize 9000
39
+News-4k.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 2 --bitrate 15000::--preset ultrafast --no-cutree --analysis-load x265_analysis.dat --analysis-load-reuse-level 2 --bitrate 15000
40
 News-4k.y4m,--preset superfast --lookahead-slices 6 --aq-mode 0
41
 News-4k.y4m,--preset superfast --slices 4 --aq-mode 0 
42
 News-4k.y4m,--preset medium --tune ssim --no-sao --qg-size 16
43
@@ -125,7 +125,7 @@
44
 old_town_cross_444_720p50.y4m,--preset superfast --weightp --min-cu 16 --limit-modes
45
 old_town_cross_444_720p50.y4m,--preset veryfast --qp 1 --tune ssim
46
 old_town_cross_444_720p50.y4m,--preset faster --rd 1 --tune zero-latency
47
-old_town_cross_444_720p50.y4m,--preset fast --no-cutree --analysis-save pass1_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass1_analysis.dat --analysis-save pass2_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass2_analysis.dat --analysis-reuse-level 1 --bitrate 3000 --early-skip
48
+old_town_cross_444_720p50.y4m,--preset fast --no-cutree --analysis-save pass1_analysis.dat --analysis-save-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass1_analysis.dat --analysis-save pass2_analysis.dat --analysis-load-reuse-level 1 --analysis-save-reuse-level 1 --bitrate 3000 --early-skip::--preset fast --no-cutree --analysis-load pass2_analysis.dat --analysis-load-reuse-level 1 --bitrate 3000 --early-skip
49
 old_town_cross_444_720p50.y4m,--preset medium --keyint -1 --no-weightp --ref 6
50
 old_town_cross_444_720p50.y4m,--preset slow --rdoq-level 1 --early-skip --ref 7 --no-b-pyramid
51
 old_town_cross_444_720p50.y4m,--preset slower --crf 4 --cu-lossless
52
@@ -156,7 +156,12 @@
53
 720p50_parkrun_ter.y4m,--preset medium --bitrate 400 --hme
54
 ducks_take_off_420_720p50.y4m,--preset medium --aq-mode 4 --crf 22 --no-cutree
55
 ducks_take_off_420_1_720p50.y4m,--preset medium --selective-sao 4 --sao --crf 20
56
+Traffic_4096x2048_30p.y4m, --preset medium --frame-dup --dup-threshold 60 --hrd --bitrate 10000 --vbv-bufsize 15000 --vbv-maxrate 12000
57
 Kimono1_1920x1080_24_400.yuv,--preset superfast --qp 28 --zones 0,139,q=32
58
+Island_960x540_24.yuv,--no-cutree --aq-mode 0 --bitrate 6000 --scenecut-aware-qp
59
+sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02 --frame-dup --dup-threshold 60 --hrd --bitrate 10000 --vbv-bufsize 15000 --vbv-maxrate 12000
60
+sintel_trailer_2k_1920x1080_24.yuv, --preset medium --hist-scenecut --hist-threshold 0.02
61
+sintel_trailer_2k_1920x1080_24.yuv, --preset ultrafast --hist-scenecut --hist-threshold 0.02
62
 
63
 # Main12 intraCost overflow bug test
64
 720p50_parkrun_ter.y4m,--preset medium
65
@@ -173,15 +178,14 @@
66
 720p50_parkrun_ter.y4m,--preset medium --lowpass-dct
67
 
68
 #scaled save/load test
69
-crowd_run_1080p50.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 8000 --vbv-bufsize 8000::crowd_run_2160p50.y4m, --preset ultrafast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 12000 --vbv-bufsize 12000 
70
-crowd_run_1080p50.y4m,--preset superfast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 5000 --vbv-bufsize 5000::crowd_run_2160p50.y4m, --preset superfast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 10000 --vbv-bufsize 10000 
71
-crowd_run_1080p50.y4m,--preset fast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 5 --scale-factor 2 --qp 18::crowd_run_2160p50.y4m, --preset fast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 5 --scale-factor 2 --qp 18
72
-crowd_run_1080p50.y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 5000  --vbv-maxrate 5000 --vbv-bufsize 5000 --early-skip --tu-inter-depth 3::crowd_run_2160p50.y4m, --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 4 --dynamic-refine::crowd_run_2160p50.y4m, --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 3 --refine-inter 3
73
-RaceHorses_416x240_30.y4m,--preset slow --no-cutree --ctu 16 --analysis-save x265_analysis.dat --analysis-reuse-level 10 --scale-factor 2 --crf 22  --vbv-maxrate 1000 --vbv-bufsize 1000::RaceHorses_832x480_30.y4m, --preset slow --no-cutree --ctu 32 --analysis-load x265_analysis.dat  --analysis-save x265_analysis_2.dat --analysis-reuse-level 10 --scale-factor 2 --crf 16 --vbv-maxrate 4000 --vbv-bufsize 4000 --refine-intra 0 --refine-inter 1::RaceHorses_1664x960_30.y4m,--preset slow --no-cutree --ctu 64 --analysis-load x265_analysis_2.dat  --analysis-reuse-level 10 --scale-factor 2 --crf 12 --vbv-maxrate 7000 --vbv-bufsize 7000 --refine-intra 2 --refine-inter 2
74
-ElFunete_960x540_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune psnr --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500 --analysis-reuse-level 10 --analysis-save elfuente_960x540.dat --scale-factor 2::ElFunete_1920x1080_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune psnr --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500 --analysis-reuse-level 10 --analysis-save elfuente_1920x1080.dat --limit-tu 0 --scale-factor 2 --analysis-load elfuente_960x540.dat --refine-intra 4 --refine-inter 2::ElFuente_3840x2160_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune=psnr --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000 --analysis-reuse-level 10 --limit-tu 0 --scale-factor 2 --analysis-load elfuente_1920x1080.dat --refine-intra 4 --refine-inter 2
75
+crowd_run_1080p50.y4m,--preset ultrafast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 8000 --vbv-bufsize 8000::crowd_run_2160p50.y4m, --preset ultrafast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 12000 --vbv-bufsize 12000 
76
+crowd_run_1080p50.y4m,--preset superfast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 5000 --vbv-bufsize 5000::crowd_run_2160p50.y4m, --preset superfast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 10000 --vbv-bufsize 10000 
77
+crowd_run_1080p50.y4m,--preset fast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 5 --scale-factor 2 --qp 18::crowd_run_2160p50.y4m, --preset fast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 5 --scale-factor 2 --qp 18
78
+crowd_run_1080p50.y4m,--preset medium --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 5000  --vbv-maxrate 5000 --vbv-bufsize 5000 --early-skip --tu-inter-depth 3::crowd_run_2160p50.y4m, --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 4 --dynamic-refine::crowd_run_2160p50.y4m, --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 3 --refine-inter 3
79
+RaceHorses_416x240_30.y4m,--preset slow --no-cutree --ctu 16 --analysis-save x265_analysis.dat --analysis-save-reuse-level 10 --scale-factor 2 --crf 22  --vbv-maxrate 1000 --vbv-bufsize 1000::RaceHorses_832x480_30.y4m, --preset slow --no-cutree --ctu 32 --analysis-load x265_analysis.dat  --analysis-save x265_analysis_2.dat --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --crf 16 --vbv-maxrate 4000 --vbv-bufsize 4000 --refine-intra 0 --refine-inter 1::RaceHorses_1664x960_30.y4m,--preset slow --no-cutree --ctu 64 --analysis-load x265_analysis_2.dat  --analysis-load-reuse-level 10 --scale-factor 2 --crf 12 --vbv-maxrate 7000 --vbv-bufsize 7000 --refine-intra 2 --refine-inter 2
80
+ElFunete_960x540_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune psnr --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500 --analysis-save-reuse-level 10 --analysis-save elfuente_960x540.dat --scale-factor 2::ElFunete_1920x1080_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune psnr --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500 --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --analysis-save elfuente_1920x1080.dat --limit-tu 0 --scale-factor 2 --analysis-load elfuente_960x540.dat --refine-intra 4 --refine-inter 2::ElFuente_3840x2160_60.yuv,--colorprim bt709 --transfer bt709 --chromaloc 2 --aud --repeat-headers --no-opt-qp-pps --no-opt-ref-list-length-pps --wpp --no-interlace --sar 1:1 --min-keyint 60 --no-open-gop --rc-lookahead 180 --bframes 5 --b-intra --ref 4 --cbqpoffs -2 --crqpoffs -2 --lookahead-threads 0 --weightb --qg-size 8 --me star --preset veryslow --frame-threads 1 --b-adapt 2 --aq-mode 3 --rd 6 --pools 15 --colormatrix bt709 --keyint 120 --high-tier --ctu 64 --tune=psnr --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000 --analysis-load-reuse-level 10 --limit-tu 0 --scale-factor 2 --analysis-load elfuente_1920x1080.dat --refine-intra 4 --refine-inter 2
81
 #save/load with ctu distortion refinement
82
-CrowdRun_1920x1080_50_10bit_422.yuv,--no-cutree --analysis-save x265_analysis.dat --refine-ctu-distortion 1 --bitrate 7000::--no-cutree --analysis-load x265_analysis.dat --refine-ctu-distortion 1 --bitrate 7000
83
-
84
+CrowdRun_1920x1080_50_10bit_422.yuv,--no-cutree --analysis-save x265_analysis.dat --analysis-save-reuse-level 5 --refine-ctu-distortion 1 --bitrate 7000::--no-cutree --analysis-load x265_analysis.dat --refine-ctu-distortion 1 --bitrate 7000 --analysis-load-reuse-level 5
85
 #segment encoding
86
 BasketballDrive_1920x1080_50.y4m, --preset ultrafast --no-open-gop --chunk-start 100 --chunk-end 200
87
 
88
x265_3.2.1.tar.gz/source/test/save-load-tests.txt -> x265_3.3.tar.gz/source/test/save-load-tests.txt Changed
20
 
1
@@ -10,10 +10,11 @@
2
 # outputs for different frame encoder counts. In order for outputs to be
3
 # consistent across many machines, you must force a certain -FN so it is
4
 # not auto-detected.
5
-crowd_run_1080p50.y4m, --preset ultrafast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 8000 --vbv-bufsize 8000::crowd_run_2160p50.y4m, --preset ultrafast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 12000 --vbv-bufsize 12000
6
-crowd_run_1080p50.y4m, --preset superfast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 5000 --vbv-bufsize 5000::crowd_run_2160p50.y4m,   --preset superfast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 10000 --vbv-bufsize 10000
7
-crowd_run_1080p50.y4m,  --preset fast --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 5 --scale-factor 2 --qp 18::crowd_run_2160p50.y4m,   --preset fast --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 5 --scale-factor 2 --qp 18
8
-crowd_run_1080p50.y4m,   --preset medium --no-cutree --analysis-save x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 5000  --vbv-maxrate 5000 --vbv-bufsize 5000 --early-skip --tu-inter-depth 3::crowd_run_2160p50.y4m,    --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 4 --dynamic-refine::crowd_run_2160p50.y4m,    --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 3 --refine-inter 3
9
-RaceHorses_416x240_30.y4m,   --preset slow --no-cutree --ctu 16 --analysis-save x265_analysis.dat --analysis-reuse-level 10 --scale-factor 2 --crf 22  --vbv-maxrate 1000 --vbv-bufsize 1000::RaceHorses_832x480_30.y4m,    --preset slow --no-cutree --ctu 32 --analysis-load x265_analysis.dat  --analysis-save x265_analysis_2.dat --analysis-reuse-level 10 --scale-factor 2 --crf 16 --vbv-maxrate 4000 --vbv-bufsize 4000 --refine-intra 0 --refine-inter 1::RaceHorses_1664x960_30.y4m,   --preset slow --no-cutree --ctu 64 --analysis-load x265_analysis_2.dat  --analysis-reuse-level 10 --scale-factor 2 --crf 12 --vbv-maxrate 7000 --vbv-bufsize 7000 --refine-intra 2 --refine-inter 2
10
-crowd_run_540p50.y4m,   --preset veryslow --no-cutree --analysis-save x265_analysis_540.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 5000 --vbv-bufsize 15000 --vbv-maxrate 9000::crowd_run_1080p50.y4m,   --preset veryslow --no-cutree --analysis-save x265_analysis_1080.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_1080p50.y4m,  --preset veryslow --no-cutree --analysis-save x265_analysis_1080.dat --analysis-load x265_analysis_540.dat --refine-intra 4 --dynamic-refine --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_2160p50.y4m,  --preset veryslow --no-cutree --analysis-save x265_analysis_2160.dat --analysis-load x265_analysis_1080.dat --refine-intra 3 --dynamic-refine --analysis-reuse-level 10 --scale-factor 2 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000::crowd_run_2160p50.y4m,  --preset veryslow --no-cutree --analysis-load x265_analysis_2160.dat --refine-intra 2 --dynamic-refine --analysis-reuse-level 10 --scale-factor 1 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000
11
-crowd_run_540p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_540.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 5000 --vbv-bufsize 15000 --vbv-maxrate 9000::crowd_run_1080p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_1080.dat  --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_1080p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_1080.dat --analysis-load x265_analysis_540.dat --refine-intra 4 --dynamic-refine --analysis-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_2160p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_2160.dat --analysis-load x265_analysis_1080.dat --refine-intra 3 --dynamic-refine --analysis-reuse-level 10 --scale-factor 2 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000::crowd_run_2160p50.y4m,  --preset medium --no-cutree --analysis-load x265_analysis_2160.dat --refine-intra 2 --dynamic-refine --analysis-reuse-level 10 --scale-factor 1 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000
12
+crowd_run_1080p50.y4m, --preset ultrafast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 8000 --vbv-bufsize 8000::crowd_run_2160p50.y4m, --preset ultrafast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 1 --scale-factor 2 --crf 26 --vbv-maxrate 12000 --vbv-bufsize 12000
13
+crowd_run_540p50.y4m, --preset ultrafast --no-cutree --analysis-save x265_analysis.dat --scale-factor 2 --crf 26 --vbv-maxrate 8000 --vbv-bufsize 8000::crowd_run_1080p50.y4m, --preset ultrafast --no-cutree --analysis-load x265_analysis.dat --scale-factor 2 --crf 26 --vbv-maxrate 12000 --vbv-bufsize 12000
14
+crowd_run_1080p50.y4m, --preset superfast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 5000 --vbv-bufsize 5000::crowd_run_2160p50.y4m,   --preset superfast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 2 --scale-factor 2 --crf 22 --vbv-maxrate 10000 --vbv-bufsize 10000
15
+crowd_run_1080p50.y4m,  --preset fast --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 5 --scale-factor 2 --qp 18::crowd_run_2160p50.y4m,   --preset fast --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 5 --scale-factor 2 --qp 18
16
+crowd_run_1080p50.y4m,   --preset medium --no-cutree --analysis-save x265_analysis.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 5000  --vbv-maxrate 5000 --vbv-bufsize 5000 --early-skip --tu-inter-depth 3::crowd_run_2160p50.y4m,    --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 4 --dynamic-refine::crowd_run_2160p50.y4m,    --preset medium --no-cutree --analysis-load x265_analysis.dat  --analysis-load-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-maxrate 10000 --vbv-bufsize 10000 --early-skip --tu-inter-depth 3 --refine-intra 3 --refine-inter 3
17
+RaceHorses_416x240_30.y4m,   --preset slow --no-cutree --ctu 16 --analysis-save x265_analysis.dat --analysis-save-reuse-level 10 --scale-factor 2 --crf 22  --vbv-maxrate 1000 --vbv-bufsize 1000::RaceHorses_832x480_30.y4m,    --preset slow --no-cutree --ctu 32 --analysis-load x265_analysis.dat  --analysis-save x265_analysis_2.dat --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --crf 16 --vbv-maxrate 4000 --vbv-bufsize 4000 --refine-intra 0 --refine-inter 1::RaceHorses_1664x960_30.y4m,   --preset slow --no-cutree --ctu 64 --analysis-load x265_analysis_2.dat  --analysis-load-reuse-level 10 --scale-factor 2 --crf 12 --vbv-maxrate 7000 --vbv-bufsize 7000 --refine-intra 2 --refine-inter 2
18
+crowd_run_540p50.y4m,   --preset veryslow --no-cutree --analysis-save x265_analysis_540.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 5000 --vbv-bufsize 15000 --vbv-maxrate 9000::crowd_run_1080p50.y4m,   --preset veryslow --no-cutree --analysis-save x265_analysis_1080.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_1080p50.y4m,  --preset veryslow --no-cutree --analysis-save x265_analysis_1080.dat --analysis-load x265_analysis_540.dat --refine-intra 4 --dynamic-refine --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_2160p50.y4m,  --preset veryslow --no-cutree --analysis-save x265_analysis_2160.dat --analysis-load x265_analysis_1080.dat --refine-intra 3 --dynamic-refine --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000::crowd_run_2160p50.y4m,  --preset veryslow --no-cutree --analysis-load x265_analysis_2160.dat --refine-intra 2 --dynamic-refine --analysis-load-reuse-level 10 --scale-factor 1 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000
19
+crowd_run_540p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_540.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 5000 --vbv-bufsize 15000 --vbv-maxrate 9000::crowd_run_1080p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_1080.dat  --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_1080p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_1080.dat --analysis-load x265_analysis_540.dat --refine-intra 4 --dynamic-refine --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 10000 --vbv-bufsize 30000 --vbv-maxrate 17500::crowd_run_2160p50.y4m,  --preset medium --no-cutree --analysis-save x265_analysis_2160.dat --analysis-load x265_analysis_1080.dat --refine-intra 3 --dynamic-refine --analysis-load-reuse-level 10 --analysis-save-reuse-level 10 --scale-factor 2 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000::crowd_run_2160p50.y4m,  --preset medium --no-cutree --analysis-load x265_analysis_2160.dat --refine-intra 2 --dynamic-refine --analysis-load-reuse-level 10 --scale-factor 1 --bitrate 24000 --vbv-bufsize 84000 --vbv-maxrate 49000
20
x265_3.2.1.tar.gz/source/test/testbench.cpp -> x265_3.3.tar.gz/source/test/testbench.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Gopu Govindaswamy <gopu@govindaswamy.org>
7
  *          Mandar Gurav <mandar@multicorewareinc.com>
8
x265_3.2.1.tar.gz/source/test/testharness.h -> x265_3.3.tar.gz/source/test/testharness.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
x265_3.2.1.tar.gz/source/x265.cpp -> x265_3.3.tar.gz/source/x265.cpp Changed
21
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
@@ -541,10 +541,11 @@
9
         return true;
10
     }
11
 
12
-    /* Unconditionally accept height/width/csp from file info */
13
+    /* Unconditionally accept height/width/csp/bitDepth from file info */
14
     param->sourceWidth = info.width;
15
     param->sourceHeight = info.height;
16
     param->internalCsp = info.csp;
17
+    param->sourceBitDepth = info.depth;
18
 
19
     /* Accept fps and sar from file info if not specified by user */
20
     if (param->fpsDenom == 0 || param->fpsNum == 0)
21
x265_3.2.1.tar.gz/source/x265.h -> x265_3.3.tar.gz/source/x265.h Changed
237
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
@@ -132,6 +132,8 @@
9
     int     chunkEnd;
10
     int     cuTree;
11
     int     ctuDistortionRefine;
12
+    int     rightOffset;
13
+    int     bottomOffset;
14
 }x265_analysis_validate;
15
 
16
 /* Stores intra analysis data for a single frame. This struct needs better packing */
17
@@ -200,6 +202,7 @@
18
 
19
 }x265_analysis_distortion_data;
20
 
21
+#define MAX_NUM_REF 16
22
 /* Stores all analysis data for a single frame */
23
 typedef struct x265_analysis_data
24
 {
25
@@ -219,6 +222,10 @@
26
     uint8_t*                          modeFlag[2];
27
     x265_analysis_validate            saveParam;
28
     x265_analysis_distortion_data*    distortionData;
29
+    uint64_t                          frameBits;
30
+    int                               list0POC[MAX_NUM_REF];
31
+    int                               list1POC[MAX_NUM_REF];
32
+    double                            totalIntraPercent;
33
 } x265_analysis_data;
34
 
35
 /* cu statistics */
36
@@ -274,8 +281,8 @@
37
     int              encoderOrder;
38
     int              poc;
39
     int              countRowBlocks;
40
-    int              list0POC[16];
41
-    int              list1POC[16];
42
+    int              list0POC[MAX_NUM_REF];
43
+    int              list1POC[MAX_NUM_REF];
44
     uint16_t         maxLumaLevel;
45
     uint16_t         minLumaLevel;
46
 
47
@@ -315,7 +322,7 @@
48
 
49
 typedef enum
50
 {
51
-    NO_INFO = 0,
52
+    DEFAULT = 0,
53
     AVC_INFO = 1,
54
     HEVC_INFO = 2,
55
 }AnalysisRefineType;
56
@@ -455,7 +462,7 @@
57
      * multi pass ratecontrol mode. */
58
     void*  rcData;
59
 
60
-    uint64_t framesize;
61
+    size_t framesize;
62
 
63
     int    height;
64
 
65
@@ -464,8 +471,13 @@
66
 
67
     //Dolby Vision RPU metadata
68
     x265_dolby_vision_rpu rpu;
69
- 
70
+
71
     int fieldNum;
72
+
73
+    //SEI picture structure message
74
+    uint32_t picStruct;
75
+
76
+    int    width;
77
 } x265_picture;
78
 
79
 typedef enum
80
@@ -674,6 +686,7 @@
81
     int   qp;
82
     float bitrateFactor;
83
     struct x265_param* zoneParam;
84
+    double* relativeComplexity;
85
 } x265_zone;
86
     
87
 /* data to calculate aggregate VMAF score */
88
@@ -1013,7 +1026,8 @@
89
     int       lookaheadSlices;
90
 
91
     /* An arbitrary threshold which determines how aggressively the lookahead
92
-     * should detect scene cuts. The default (40) is recommended. */
93
+     * should detect scene cuts for cost based scenecut detection. 
94
+     * The default (40) is recommended. */
95
     int       scenecutThreshold;
96
 
97
     /* Replace keyframes by using a column of intra blocks that move across the video
98
@@ -1635,16 +1649,16 @@
99
 
100
     /* Enables the emitting of HDR SEI packets which contains HDR-specific params.
101
      * Auto-enabled when max-cll, max-fall, or mastering display info is specified.
102
-     * Default is disabled */
103
+     * Default is disabled. Now deprecated.*/
104
     int       bEmitHDRSEI;
105
 
106
     /* Enable luma and chroma offsets for HDR/WCG content.
107
-     * Default is disabled */
108
+     * Default is disabled. Now deprecated.*/
109
     int       bHDROpt;
110
 
111
     /* A value between 1 and 10 (both inclusive) determines the level of
112
     * information stored/reused in analysis save/load. Higher the refine
113
-    * level higher the information stored/reused. Default is 5 */
114
+    * level higher the information stored/reused. Default is 5. Now deprecated. */
115
     int       analysisReuseLevel;
116
 
117
      /* Limit Sample Adaptive Offset filter computation by early terminating SAO
118
@@ -1798,7 +1812,97 @@
119
 
120
     /*Emit content light level info SEI*/
121
     int         bEmitCLL;
122
+
123
+    /*
124
+    * Signals picture structure SEI timing message for every frame
125
+    * picture structure 7 is signalled for frame doubling
126
+    * picture structure 8 is signalled for frame tripling
127
+    * */
128
+    int       bEnableFrameDuplication;
129
+
130
+    /*
131
+    * For adaptive frame duplication, a threshold is set above which the frames are similar.
132
+    * User can set a variable threshold. Default 70.
133
+    * */
134
+    int       dupThreshold;
135
+
136
+    /*Input sequence bit depth. It can be either 8bit, 10bit or 12bit.*/
137
+    int       sourceBitDepth;
138
+
139
+    /*Size of the zone to be reconfigured in frames. Default 0. API only. */
140
+    uint32_t  reconfigWindowSize;
141
+
142
+    /*Flag to indicate if rate-control history has to be reset during zone reconfiguration.
143
+      Default 1 (Enabled). API only. */
144
+    int       bResetZoneConfig;
145
+
146
+    /* Enables a ratecontrol algorithm for reducing the bits spent on the inter-frames
147
+     * within the scenecutWindow after a scenecut by increasing their QP without
148
+     * any deterioration in visual quality. It also increases the quality of scenecut I-Frames by reducing their QP.
149
+     * Default is disabled. */
150
+    int       bEnableSceneCutAwareQp;
151
+
152
+    /* The duration(in milliseconds) for which there is a reduction in the bits spent on the inter-frames after a scenecut
153
+     * by increasing their QP, when bEnableSceneCutAwareQp is set. Default is 500ms.*/
154
+    int       scenecutWindow;
155
+
156
+    /* The offset by which QP is incremented for inter-frames when bEnableSceneCutAwareQp is set.
157
+     * Default is +5. */
158
+    int       maxQpDelta;
159
+
160
+    /* A genuine threshold used for histogram based scene cut detection.
161
+     * This threshold determines whether a frame is a scenecut or not
162
+     * when compared against the edge and chroma histogram sad values.
163
+     * Default 0.01. Range: Real number in the interval (0,2). */
164
+    double    edgeTransitionThreshold;
165
+
166
+    /* Enables histogram based scenecut detection algorithm to detect scenecuts. Default disabled */
167
+    int      bHistBasedSceneCut;
168
+
169
+    /* Enable HME search ranges for L0, L1 and L2 respectively. */
170
+    int       hmeRange[3];
171
+
172
+    /* Block-level QP optimization for HDR10 content. Default is disabled.*/
173
+    int       bHDR10Opt;
174
+
175
+    /* Enables the emitting of HDR10 SEI packets which contains HDR10-specific params.
176
+    * Auto-enabled when max-cll, max-fall, or mastering display info is specified.
177
+    * Default is disabled */
178
+    int       bEmitHDR10SEI;
179
+
180
+    /* A value between 1 and 10 (both inclusive) determines the level of
181
+    * analysis information stored in analysis-save. Higher the refine level higher
182
+    * the information stored. Default is 5 */
183
+    int       analysisSaveReuseLevel;
184
+    
185
+    /* A value between 1 and 10 (both inclusive) determines the level of
186
+    * analysis information reused in analysis-load. Higher the refine level higher
187
+    * the information reused. Default is 5 */
188
+    int       analysisLoadReuseLevel;
189
+
190
+    /* Conformance window right offset specifies the padding offset to the
191
+    * right side of the internal copy of the input pictures in the library.
192
+    * The decoded picture will be cropped based on conformance window right offset
193
+    * signaled in the SPS before output. Default is 0.
194
+    * Recommended to set this during non-file based analysis-load.
195
+    * This is to inform the encoder about the conformace window right offset 
196
+    * to be added to match the number of CUs across the width for which analysis
197
+    * info is available from the corresponding analysis-save. */
198
+
199
+    int       confWinRightOffset;
200
+
201
+    /* Conformance window bottom offset specifies the padding offset to the
202
+    * bottom side of the internal copy of the input pictures in the library.
203
+    * The decoded picture will be cropped based on conformance window bottom offset
204
+    * signaled in the SPS before output. Default is 0. 
205
+    * Recommended to set this during non-file based analysis-load.
206
+    * This is to inform the encoder about the conformace window bottom offset
207
+    * to be added to match the number of CUs across the height for which analysis
208
+    * info is available from the corresponding analysis-save. */
209
+
210
+    int      confWinBottomOffset;
211
 } x265_param;
212
+
213
 /* x265_param_alloc:
214
  *  Allocates an x265_param instance. The returned param structure is not
215
  *  special in any way, but using this method together with x265_param_free()
216
@@ -1974,6 +2078,12 @@
217
  *      parameters to take this into account. */
218
 int x265_encoder_reconfig(x265_encoder *, x265_param *);
219
 
220
+/* x265_encoder_reconfig_zone:
221
+*       zone settings are copied to the encoder's param.
222
+*       Properties of the zone will be used only to re-configure rate-control settings
223
+*       of the zone mid-encode. Returns 0 on success on successful copy, negative on failure.*/
224
+int x265_encoder_reconfig_zone(x265_encoder *, x265_zone *);
225
+
226
 /* x265_encoder_get_stats:
227
  *       returns encoder statistics */
228
 void x265_encoder_get_stats(x265_encoder *encoder, x265_stats *, uint32_t statsSizeBytes);
229
@@ -2102,6 +2212,7 @@
230
     x265_encoder* (*encoder_open)(x265_param*);
231
     void          (*encoder_parameters)(x265_encoder*, x265_param*);
232
     int           (*encoder_reconfig)(x265_encoder*, x265_param*);
233
+    int           (*encoder_reconfig_zone)(x265_encoder*, x265_zone*);
234
     int           (*encoder_headers)(x265_encoder*, x265_nal**, uint32_t*);
235
     int           (*encoder_encode)(x265_encoder*, x265_nal**, uint32_t*, x265_picture*, x265_picture*);
236
     void          (*encoder_get_stats)(x265_encoder*, x265_stats*, uint32_t);
237
x265_3.2.1.tar.gz/source/x265_config.h.in -> x265_3.3.tar.gz/source/x265_config.h.in Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *
8
x265_3.2.1.tar.gz/source/x265cli.h -> x265_3.3.tar.gz/source/x265cli.h Changed
122
 
1
@@ -1,5 +1,5 @@
2
 /*****************************************************************************
3
- * Copyright (C) 2013-2017 MulticoreWare, Inc
4
+ * Copyright (C) 2013-2020 MulticoreWare, Inc
5
  *
6
  * Authors: Steve Borho <steve@borho.org>
7
  *          Min Chen <chenm003@163.com>
8
@@ -129,8 +129,15 @@
9
     { "scenecut",       required_argument, NULL, 0 },
10
     { "no-scenecut",          no_argument, NULL, 0 },
11
     { "scenecut-bias",  required_argument, NULL, 0 },
12
+    { "hist-scenecut",        no_argument, NULL, 0},
13
+    { "no-hist-scenecut",     no_argument, NULL, 0},
14
+    { "hist-threshold", required_argument, NULL, 0},
15
     { "fades",                no_argument, NULL, 0 },
16
     { "no-fades",             no_argument, NULL, 0 },
17
+    { "scenecut-aware-qp",    no_argument, NULL, 0 },
18
+    { "no-scenecut-aware-qp", no_argument, NULL, 0 },
19
+    { "scenecut-window",required_argument, NULL, 0 },
20
+    { "max-qp-delta",   required_argument, NULL, 0 },
21
     { "radl",           required_argument, NULL, 0 },
22
     { "ctu-info",       required_argument, NULL, 0 },
23
     { "intra-refresh",        no_argument, NULL, 0 },
24
@@ -268,7 +275,9 @@
25
     { "no-multi-pass-opt-rps", no_argument, NULL, 0 },
26
     { "analysis-reuse-mode", required_argument, NULL, 0 }, /* DEPRECATED */
27
     { "analysis-reuse-file", required_argument, NULL, 0 },
28
-    { "analysis-reuse-level", required_argument, NULL, 0 },
29
+    { "analysis-reuse-level", required_argument, NULL, 0 }, /* DEPRECATED */
30
+    { "analysis-save-reuse-level", required_argument, NULL, 0 },
31
+    { "analysis-load-reuse-level", required_argument, NULL, 0 },
32
     { "analysis-save",  required_argument, NULL, 0 },
33
     { "analysis-load",  required_argument, NULL, 0 },
34
     { "scale-factor",   required_argument, NULL, 0 },
35
@@ -290,8 +299,12 @@
36
     { "no-ssim-rd",           no_argument, NULL, 0 },
37
     { "hdr",                  no_argument, NULL, 0 },
38
     { "no-hdr",               no_argument, NULL, 0 },
39
+    { "hdr10",                no_argument, NULL, 0 },
40
+    { "no-hdr10",             no_argument, NULL, 0 },
41
     { "hdr-opt",              no_argument, NULL, 0 },
42
     { "no-hdr-opt",           no_argument, NULL, 0 },
43
+    { "hdr10-opt",            no_argument, NULL, 0 },
44
+    { "no-hdr10-opt",         no_argument, NULL, 0 },
45
     { "limit-sao",            no_argument, NULL, 0 },
46
     { "no-limit-sao",         no_argument, NULL, 0 },
47
     { "dhdr10-info",    required_argument, NULL, 0 },
48
@@ -321,6 +334,9 @@
49
     { "hevc-aq", no_argument, NULL, 0 },
50
     { "no-hevc-aq", no_argument, NULL, 0 },
51
     { "qp-adaptation-range", required_argument, NULL, 0 },
52
+    { "frame-dup",            no_argument, NULL, 0 },
53
+    { "no-frame-dup", no_argument, NULL, 0 },
54
+    { "dup-threshold", required_argument, NULL, 0 },
55
 #ifdef SVT_HEVC
56
     { "svt",     no_argument, NULL, 0 },
57
     { "no-svt",  no_argument, NULL, 0 },
58
@@ -341,6 +357,7 @@
59
 #endif
60
     { "cll", no_argument, NULL, 0 },
61
     { "no-cll", no_argument, NULL, 0 },
62
+    { "hme-range", required_argument, NULL, 0 },
63
     { 0, 0, 0, 0 },
64
     { 0, 0, 0, 0 },
65
     { 0, 0, 0, 0 },
66
@@ -469,6 +486,7 @@
67
     H1("   --[no-]temporal-mvp           Enable temporal MV predictors. Default %s\n", OPT(param->bEnableTemporalMvp));
68
     H1("   --[no-]hme                    Enable Hierarchical Motion Estimation. Default %s\n", OPT(param->bEnableHME));
69
     H1("   --hme-search <string>         Motion search-method for HME L0,L1 and L2. Default(L0,L1,L2) is %d,%d,%d\n", param->hmeSearchMethod[0], param->hmeSearchMethod[1], param->hmeSearchMethod[2]);
70
+    H1("   --hme-range <int>,<int>,<int> Motion search-range for HME L0,L1 and L2. Default(L0,L1,L2) is %d,%d,%d\n", param->hmeRange[0], param->hmeRange[1], param->hmeRange[2]);
71
     H0("\nSpatial / intra options:\n");
72
     H0("   --[no-]strong-intra-smoothing Enable strong intra smoothing for 32x32 blocks. Default %s\n", OPT(param->bEnableStrongIntraSmoothing));
73
     H0("   --[no-]constrained-intra      Constrained intra prediction (use only intra coded reference pixels) Default %s\n", OPT(param->bEnableConstrainedIntra));
74
@@ -482,8 +500,14 @@
75
     H0("   --gop-lookahead <integer>     Extends gop boundary if a scenecut is found within this from keyint boundary. Default 0\n");
76
     H0("   --no-scenecut                 Disable adaptive I-frame decision\n");
77
     H0("   --scenecut <integer>          How aggressively to insert extra I-frames. Default %d\n", param->scenecutThreshold);
78
-    H1("   --scenecut-bias <0..100.0>    Bias for scenecut detection. Default %.2f\n", param->scenecutBias);
79
+    H1("   --scenecut-bias <0..100.0>    Bias for scenecut detection. Default %.2f\n", param->scenecutBias); 
80
+    H0("   --hist-scenecut               Enables histogram based scene-cut detection using histogram based algorithm.\n");
81
+    H0("   --no-hist-scenecut            Disables histogram based scene-cut detection using histogram based algorithm.\n");
82
+    H1("   --hist-threshold <0.0..2.0>   Luma Edge histogram's Normalized SAD threshold for histogram based scenecut detection Default %.2f\n", param->edgeTransitionThreshold);
83
     H0("   --[no-]fades                  Enable detection and handling of fade-in regions. Default %s\n", OPT(param->bEnableFades));
84
+    H1("   --[no-]scenecut-aware-qp      Enable increasing QP for frames inside the scenecut window after scenecut. Default %s\n", OPT(param->bEnableSceneCutAwareQp));
85
+    H1("   --scenecut-window <0..1000>   QP incremental duration(in milliseconds) when scenecut-aware-qp is enabled. Default %d\n", param->scenecutWindow);
86
+    H1("   --max-qp-delta <0..10>        QP offset to increment with base QP for inter-frames. Default %d\n", param->maxQpDelta);
87
     H0("   --radl <integer>              Number of RADL pictures allowed in front of IDR. Default %d\n", param->radl);
88
     H0("   --intra-refresh               Use Periodic Intra Refresh instead of IDR frames\n");
89
     H0("   --rc-lookahead <integer>      Number of frames for frame-type lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);
90
@@ -531,7 +555,9 @@
91
     H0("   --analysis-save <filename>    Dump analysis info into the specified file. Default Disabled\n");
92
     H0("   --analysis-load <filename>    Load analysis buffers from the file specified. Default Disabled\n");
93
     H0("   --analysis-reuse-file <filename>    Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");
94
-    H0("   --analysis-reuse-level <1..10>      Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Default %d\n", param->analysisReuseLevel);
95
+    H0("   --analysis-reuse-level <1..10>      Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Now deprecated. Default %d\n", param->analysisReuseLevel);
96
+    H0("   --analysis-save-reuse-level <1..10> Indicates the amount of analysis info stored in save mode, 1:least..10:most. Default %d\n", param->analysisSaveReuseLevel);
97
+    H0("   --analysis-load-reuse-level <1..10> Indicates the amount of analysis info reused in load mode, 1:least..10:most. Default %d\n", param->analysisLoadReuseLevel);
98
     H0("   --refine-analysis-type <string>     Reuse anlaysis information received through API call. Supported options are avc and hevc. Default disabled - %d\n", param->bAnalysisType);
99
     H0("   --scale-factor <int>          Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);
100
     H0("   --refine-intra <0..4>         Enable intra refinement for encode that uses analysis-load.\n"
101
@@ -612,8 +638,9 @@
102
     H0("                                    format: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\n");
103
     H0("   --max-cll <string>            Specify content light level info SEI as \"cll,fall\" (HDR).\n");
104
     H0("   --[no-]cll                    Emit content light level info SEI. Default %s\n", OPT(param->bEmitCLL));
105
-    H0("   --[no-]hdr                    Control dumping of HDR SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDRSEI));
106
-    H0("   --[no-]hdr-opt                Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt));
107
+    H0("   --[no-]hdr10                  Control dumping of HDR10 SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDR10SEI));
108
+    H0("   --[no-]hdr-opt                Add luma and chroma offsets for HDR/WCG content. Default %s. Now deprecated.\n", OPT(param->bHDROpt));
109
+    H0("   --[no-]hdr10-opt              Block-level QP optimization for HDR10 content. Default %s.\n", OPT(param->bHDR10Opt));
110
     H0("   --min-luma <integer>          Minimum luma plane value of input source picture\n");
111
     H0("   --max-luma <integer>          Maximum luma plane value of input source picture\n");
112
     H0("\nBitstream options:\n");
113
@@ -638,6 +665,8 @@
114
     H1("   --recon-depth <integer>       Bit-depth of reconstructed raw image file. Defaults to input bit depth, or 8 if Y4M\n");
115
     H1("   --recon-y4m-exec <string>     pipe reconstructed frames to Y4M viewer, ex:\"ffplay -i pipe:0 -autoexit\"\n");
116
     H0("   --lowpass-dct                 Use low-pass subband dct approximation. Default %s\n", OPT(param->bLowPassDct));
117
+    H0("   --[no-]frame-dup              Enable Frame duplication. Default %s\n", OPT(param->bEnableFrameDuplication));
118
+    H0("   --dup-threshold <integer>     PSNR threshold for Frame duplication. Default %d\n", param->dupThreshold);
119
 #ifdef SVT_HEVC
120
     H0("   --[no]svt                     Enable SVT HEVC encoder %s\n", OPT(param->bEnableSvtHevc));
121
     H0("   --[no-]svt-hme                Enable Hierarchial motion estimation(HME) in SVT HEVC encoder \n");
122
Refresh
Refresh


Request History
Olaf Hering's avatar

olh created request about 5 years ago

- Update to version 3.3
New features:
* Adaptive frame duplication** to identify and skip encoding
of near-identical frames and signal the duplication info to the
decoder via pic_struct SEI. :option:`frame-dup` to enable frame
duplication and :option:`--dup-threshold` to set the threshold
for frame similarity (optional).
* Boundary aware quantization** to cut off bits from frames
following scene-cut. This leverages the inability of HVS to
perceive fine details during scene changes and saves bits.
:option:`--scenecut-aware-qp` , :option:`--scenecut-window` and
:option:`--max-qp-delta` to enable boundary aware frame
quantization, to set window size (optional) and to set QP offset
(optional).
* Improved scene-cut detection** using edge and chroma
histograms. :option:`--hist-scenecut` to enable the feature and
:option:`--hist-threshold` (optional) to provide threshold for
determining scene cuts.
Enhancements to existing features:
* :option:`--hme-range` to modify search range for HME levels
L0, L1, and L2.
* Improved performance of AQ mode 4 by reducing memory foot
print.
* Introduced :option:`--analysis-save-reuse-level` and
:option:`--analysis-load-reuse-level` to de-couple reuse levels
of :option:`--analysis-save` and :option:`--analysis-load`.
Turnaround time of ABR encoding can be reduced by properly
leveraging these options.
Encoder enhancements:
* Improved VBV lookahead to eliminate blocky artifacts in


Olaf Hering's avatar

olh accepted request about 5 years ago