We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 32
x265.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Thu Jul 18 13:17:22 UTC 2019 - enzokiel@kabelmail.de
4
+
5
+- Update to version 3.1.1
6
+ - No changelog available.
7
+
8
+- Version 3.1
9
+ New features
10
+ * x265 can invoke SVT-HEVC library for encoding through --svt.
11
+ * x265 can now accept interlaced inputs directly (no need to
12
+ separate fields), and sends it to the encoder with proper fps
13
+ and frame-size through --field.
14
+ * --fades can detect and handle fade-in regions. This option will
15
+ force I-slice and initialize RC history for the brightest frame
16
+ after fade-in.
17
+ API changes
18
+ * A new flag to signal MasterDisplayParams and maxCll/Fall
19
+ separately
20
+ Encoder enhancements
21
+ * Improved the performance of inter-refine level 1 by skipping
22
+ the evaluation of smaller CUs when the current block is decided
23
+ as “skip” by the save mode.
24
+ * New AVX2 primitives to improve the performance of encodes that
25
+ enable --ssim-rd.
26
+ * Improved performance in medium preset with negligible loss in
27
+ quality.
28
+ Bug fixes
29
+ * Bug fixes for zones.
30
+ * Fixed wrap-around from MV structure overflow occurred around 8K
31
+ pixels or over.
32
+ * Fixed issues in configuring cbQpOffset and crQpOffset for 444
33
+ input
34
+ * Fixed cutree offset computation in 2nd pass encodes.
35
+ Known issues
36
+ * AVX512 main12 asm disabling.
37
+ * Inconsistent output with 2-pass due to cutree offset sharing.
38
+
39
+-------------------------------------------------------------------
40
Fri Feb 1 00:32:50 UTC 2019 - antonio.larrosa@gmail.com
41
42
- Support 10 and 12 bit color depths
43
x265.spec
Changed
14
1
2
# based on the spec file from https://build.opensuse.org/package/view_file/home:Simmphonie/libx265/
3
4
Name: x265
5
-%define soname 169
6
+%define soname 176
7
%define libname lib%{name}
8
%define libsoname %{libname}-%{soname}
9
-Version: 3.0
10
+Version: 3.1.1
11
Release: 0
12
License: GPL-2.0+
13
Summary: A free h265/HEVC encoder - encoder binary
14
baselibs.conf
Changed
4
1
2
-libx265-169
3
+libx265-176
4
x265_3.0.tar.gz/.hg_archival.txt -> x265_3.1.1.tar.gz/.hg_archival.txt
Changed
10
1
2
repo: 09fe40627f03a0f9c3e6ac78b22ac93da23f9fdf
3
-node: 72188bd2f03447e71e789a5fd2f10364bb232c2c
4
-branch: stable
5
-tag: 3.0
6
+node: 04b37fdfd2dcde24da4d47ced91dddc10ffe0cbf
7
+branch: Release_3.1
8
+latesttag: 3.1.1
9
+latesttagdistance: 1
10
x265_3.0.tar.gz/.hgtags -> x265_3.1.1.tar.gz/.hgtags
Changed
10
1
2
bad4e598cac7cdd3df4623c68c91299c620471bd 3.0-rc
3
0000000000000000000000000000000000000000 3.0-rc
4
1307fd7b2b9984f45179db01432305a416713049 3.0_RC
5
+72188bd2f03447e71e789a5fd2f10364bb232c2c 3.0
6
+113518629fa54ffb491dd479e15c1f00dd39d376 3.1_RC1
7
+b4e38ce16d7c4b37a6482dc7ae61fd31071b6ff1 3.1_RC2
8
+acce27790559b68f93319cd21b588f90aa93c0b1 3.1
9
+6f7c2ae0d5bd46506b7a772abebd7eff3fa3bbcb 3.1.1
10
x265_3.0.tar.gz/doc/reST/cli.rst -> x265_3.1.1.tar.gz/doc/reST/cli.rst
Changed
156
1
2
This feature can be enabled only in closed GOP structures.
3
Default 0 (disabled).
4
5
+.. option:: --field, --no-field
6
+
7
+ Enable or disable field coding. Default disabled.
8
+
9
Profile, Level, Tier
10
====================
11
12
13
judder is happening, and allow the encoder to use some blur in these
14
areas of high motion.
15
16
+In 444, chroma gets twice as much resolution, so halve the quality when psy-rd is enabled.
17
+So when psy-rd is enabled for 444 videos, cbQpOffset and crQpOffset are set to value 6,
18
+if they are not explicitly set.
19
+
20
.. option:: --psy-rd <float>
21
22
Influence rate distortion optimizated mode decision to preserve the
23
24
slicetype decision may change with this option.
25
2 - flush the slicetype decided frames only.
26
27
+.. option:: --fades, --no-fades
28
+
29
+ Detect and handle fade-in regions. Default disabled.
30
+
31
Quality, rate control and rate distortion options
32
=================================================
33
34
35
Note that this string value will need to be escaped or quoted to
36
protect against shell expansion on many platforms. No default.
37
38
+.. option:: --cll, --no-cll
39
+
40
+ Emit content light level SEI. Enabled automatically when :option:`--dolby-vision-profile` 8.1
41
+ is specified. When enabled, signals max-cll and max-fall as 0 if :option:`max-cll` is unspecified.
42
+ Default enabled.
43
+
44
.. option:: --hdr, --no-hdr
45
46
Force signalling of HDR parameters in SEI packets. Enabled
47
48
49
**CLI ONLY**
50
51
+SVT-HEVC Encoder Options
52
+========================
53
+This section lists options which are SVT-HEVC encoder specific.
54
+See section :ref:`svthevc <SvtHevc>` for more details.
55
+
56
+.. option:: --svt, --no-svt
57
+
58
+ Enable SVT-HEVC encoder if x265 is built with SVT-HEVC library. Default
59
+ disabled.
60
+
61
+.. option:: --svt-hme, --no-svt-hme
62
+
63
+ Enable Hierarchical Motion Estimation(HME) in SVT-HEVC. Default enabled.
64
+
65
+ **CLI_ONLY**
66
+
67
+.. option:: --svt-search-width <integer>
68
+
69
+ Search Area Width used during motion estimation. It depends on input resolution.
70
+ Values: [1-256]
71
+
72
+ **CLI_ONLY**
73
+
74
+.. option:: --svt-search-height <integer>
75
+
76
+ Search Area Height used during motion estimation. It depends on input resolution.
77
+ Values: [1-256]
78
+
79
+ **CLI_ONLY**
80
+
81
+.. option:: --svt-compressed-ten-bit-format, --no-svt-compressed-ten-bit-format
82
+
83
+ In order to reduce the size of input YUV and to increase channel density,
84
+ SVT-HEVC accetps inputs in compressed-ten-bit-format. The conversion between
85
+ yuv420p10le and compressed ten bit format is a lossless operation. For more
86
+ details about the conversion refer
87
+ `here<https://github.com/intel/SVT-HEVC/blob/master/Docs/SVT-HEVC_Encoder_User_Guide.pdf>'_.
88
+
89
+ **CLI_ONLY**
90
+
91
+.. option:: --svt-speed-control, --no-svt-speed-control
92
+
93
+ Enable speed control functionality to achieve real time encoding speed defined
94
+ by :option:`--fps`. Default disabled.
95
+
96
+ **CLI_ONLY**
97
+
98
+.. option:: --svt-preset-tuner <integer>
99
+
100
+ SVT-HEVC exposes 13 presets. Presets [3-12] of SVT-HEVC is mapped to x265's
101
+ presets [placebo-ultrafast]. Ultrafast is mapped to preset(12) of SVT-HEVC,
102
+ superfast to preset(11), placebo to preset(3) and so on. svt-preset-tuner works
103
+ only on top of placebo preset and maps to presets (0-2) of SVT-HEVC.
104
+
105
+ Values: [0-2]
106
+
107
+ **CLI_ONLY**
108
+
109
+.. option:: --svt-hierarchical-level <integer>
110
+
111
+ Enables multiple hierarchical levels in SVT-HEVC. Accepts values in the range [0-3].
112
+ 0 - Flat
113
+ 1 - 2-Level Hierarchy
114
+ 2 - 3-Level Hierarchy
115
+ 3 - 4-Level Hierarchy
116
+
117
+ Default: 3
118
+
119
+ **CLI_ONLY**
120
+
121
+.. option:: --svt-base-layer-switch-mode <integer>
122
+
123
+ Choose type of slices to be in base layer. Accepts values 0,1.
124
+ 0 - Use B-frames in the base layer
125
+ 1 - Use P-frames in the base layer
126
+
127
+ Default: 0
128
+
129
+ **CLI_ONLY**
130
+
131
+.. option:: --svt-pred-struct <integer>
132
+
133
+ Prediction structure forms the basis in deciding the GOP structure. SVT-HEVC
134
+ supports Low delay(P/B) and random access prediction structure. In a low delay
135
+ structure, pictures within a mini-gop can only refer to the previous pictures
136
+ in display order. In other words, picture with display order N can only refer
137
+ to pictures of display order lower than N. In random acccess method, pictures
138
+ can be referenced from both the directions. It accepts values in the range
139
+ [0-2]
140
+
141
+ 0 - Low Delay P
142
+ 1 - Low Delay B
143
+ 2 - Random Access
144
+
145
+ Default: 2
146
+
147
+ **CLI_ONLY**
148
+
149
+.. option:: --svt-fps-in-vps, --no-svt-fps-in-vps
150
+
151
+ Enable sending timing info in VPS. Default disabled.
152
+
153
+ **CLI_ONLY**
154
+
155
.. vim: noet
156
x265_3.0.tar.gz/doc/reST/index.rst -> x265_3.1.1.tar.gz/doc/reST/index.rst
Changed
7
1
2
threading
3
presets
4
lossless
5
+ svthevc
6
releasenotes
7
x265_3.0.tar.gz/doc/reST/releasenotes.rst -> x265_3.1.1.tar.gz/doc/reST/releasenotes.rst
Changed
42
1
2
*************
3
Release Notes
4
*************
5
+
6
+Version 3.1
7
+===========
8
+
9
+Release date - 18th June, 2019.
10
+
11
+New features
12
+----------------
13
+1. x265 can invoke SVT-HEVC library for encoding through :option:`--svt`.
14
+2. x265 can now accept interlaced inputs directly (no need to separate fields), and sends it to the encoder with proper fps and frame-size through :option:`--field`.
15
+3. :option:`--fades` can detect and handle fade-in regions. This option will force I-slice and initialize RC history for the brightest frame after fade-in.
16
+
17
+API changes
18
+-----------
19
+1. A new flag to signal MasterDisplayParams and maxCll/Fall separately
20
+
21
+Encoder enhancements
22
+--------------------
23
+1. Improved the performance of inter-refine level 1 by skipping the evaluation of smaller CUs when the current block is decided as "skip" by the save mode.
24
+2. New AVX2 primitives to improve the performance of encodes that enable :option:`--ssim-rd`.
25
+3. Improved performance in medium preset with negligible loss in quality.
26
+
27
+Bug fixes
28
+---------
29
+1. Bug fixes for zones.
30
+2. Fixed wrap-around from MV structure overflow occurred around 8K pixels or over.
31
+3. Fixed issues in configuring cbQpOffset and crQpOffset for 444 input
32
+4. Fixed cutree offset computation in 2nd pass encodes.
33
+
34
+Known issues
35
+------------
36
+1. AVX512 main12 asm disabling.
37
+2. Inconsistent output with 2-pass due to cutree offset sharing.
38
+
39
Version 3.0
40
===========
41
42
x265_3.1.1.tar.gz/doc/reST/svthevc.rst
Added
201
1
2
+SVT-HEVC
3
+--------
4
+
5
+.. _SvtHevc:
6
+
7
+x265 has support for open source HEVC encoder `SVT-HEVC <https://01.org/svt>`_
8
+and can generate SVT-HEVC compliant bitstreams. SVT-HEVC encoder can be enabled at run time
9
+using :option:`--svt`. Since SVT-HEVC params/CLI are not exposed outside, it has to be
10
+configured only via x265 CLI options. The API's of SVT-HEVC are accessed through x265's API
11
+so even library users of x265 can avail this feature, under the condition that x265_param_parse()
12
+API should be used for all param assignment. Params assigned outside of x265_param_parse() API
13
+wont't be mapped to SVT-HEVC. This document describes the steps needed to compile x265
14
+with SVT-HEVC and CLI options mapping between x265 and SVT-HEVC.
15
+
16
+Build Steps
17
+===========
18
+This section describes the build steps to be followed to link SVT-HEVC with x265.
19
+
20
+**SVT-HEVC**
21
+
22
+1. Clone `SVT-HEVC <https://github.com/intel/SVT-HEVC>`_ (say at path "/home/app/") and build it (follow the build steps in its README file)
23
+2. Once build is successful, binaries can be found inside the *Bin* folder at its root directory ("/home/app/SVT-HEVC/Bin/Release/")
24
+
25
+**x265**
26
+
27
+1. Set environmental variables SVT_HEVC_INCLUDE_DIR and SVT_HEVC_LIBRARY_DIR to help x265 locate SVT-HEVC. For example:
28
+ * export SVT_HEVC_INCLUDE_DIR = /home/app/SVT-HEVC/Source/API/
29
+ * export SVT_HEVC_LIBRARY_DIR = /home/app/SVT-HEVC/Bin/Release/
30
+2. Enable the cmake option ENABLE_SVT_HEVC and continue the normal build process
31
+
32
+CLI options Mapping
33
+===================
34
+Once x265 is compiled with SVT-HEVC, SVT-HEVC encoder can be invoked at run time using
35
+:option:`--svt`. :option:`--svt` can be added anywhere in the command line, x265 application will automatically
36
+parse it first and maps all other x265 CLI's present in the command line to SVT-HEVC encoder options
37
+internally and configures the same. Below table shows the actual mapping of x265 CLI options to
38
+SVT-HEVC encoder options (Name as shown in SVT-HEVC's sample configuration file)
39
+
40
++-------------------------------------------+------------------------------+------------------------------+
41
+| x265 CLI option | SVT-HEVC Encoder Option | Range |
42
++===========================================+==============================+==============================+
43
+| :option:`--input` | InputFile | Any String |
44
++-------------------------------------------+------------------------------+------------------------------+
45
+| :option:`--output` | StreamFile | Any String |
46
++-------------------------------------------+------------------------------+------------------------------+
47
+| :option:`--input-depth` | EncoderBitDepth | [8, 10] |
48
++-------------------------------------------+------------------------------+------------------------------+
49
+| | SourceWidth | [64 - 8192] |
50
+| :option:`--input-res` +------------------------------+------------------------------+
51
+| | SourceHeight | [64 - 8192] |
52
++-------------------------------------------+------------------------------+------------------------------+
53
+| :option:`--frames` | FrameToBeEncoded | Any Positive Integer |
54
++-------------------------------------------+------------------------------+------------------------------+
55
+| | FrameRateNumerator | Any Positive Integer |
56
+| :option:`--fps` +------------------------------+------------------------------+
57
+| | FrameRateDenominator | Any Positive Integer |
58
++-------------------------------------------+------------------------------+------------------------------+
59
+| :option:`--profile` | Profile | [main, main10] |
60
++-------------------------------------------+------------------------------+------------------------------+
61
+| :option:`--level-idc` | Level | [1, 2, 2.1, 3, 3.1, 4, 4.1, |
62
+| | | 5, 5.1, 5.2, 6, 6.1, 6.2] |
63
++-------------------------------------------+------------------------------+------------------------------+
64
+| :option:`--high-tier` | Tier | |
65
++-------------------------------------------+------------------------------+------------------------------+
66
+| :option:`--qpmin` | MinQpAllowed | [0 - 50] |
67
++-------------------------------------------+------------------------------+------------------------------+
68
+| :option:`--qpmax` | MaxQpAllowed | [0 - 51] |
69
++-------------------------------------------+------------------------------+------------------------------+
70
+| :option:`--rc-lookahead` | LookAheadDistance | [0 - 250] |
71
++-------------------------------------------+------------------------------+------------------------------+
72
+| :option:`--scenecut` | SceneChangeDetection | Any Positive Integer |
73
++-------------------------------------------+------------------------------+------------------------------+
74
+| :option:`--open-gop` | IntraRefreshType | |
75
++-------------------------------------------+------------------------------+------------------------------+
76
+| :option:`--deblock` | LoopFilterDisable | Any Integer |
77
++-------------------------------------------+------------------------------+------------------------------+
78
+| :option:`--sao` | SAO | |
79
++-------------------------------------------+------------------------------+------------------------------+
80
+| :option:`--keyint` | IntraPeriod | [(-2) - 255] |
81
++-------------------------------------------+------------------------------+------------------------------+
82
+| :option:`--constrained-intra` | ConstrainedIntra | |
83
++-------------------------------------------+------------------------------+------------------------------+
84
+| :option:`--vui-timing-info` | VideoUsabilityInfo | |
85
++-------------------------------------------+------------------------------+------------------------------+
86
+| :option:`--hdr` | HighDynamicRangeInput | |
87
++-------------------------------------------+------------------------------+------------------------------+
88
+| :option:`--aud` | AccessUnitDelimeter | |
89
++-------------------------------------------+------------------------------+------------------------------+
90
+| | RateControlMode | RateControlMode = 0 |
91
+| :option:`--qp` +------------------------------+------------------------------+
92
+| | QP | [0 - 51] |
93
++-------------------------------------------+------------------------------+------------------------------+
94
+| | RateControlMode | RateControlMode = 1 |
95
+| :option:`--bitrate` +------------------------------+------------------------------+
96
+| | TargetBitrate | Any Positive Integer |
97
++-------------------------------------------+------------------------------+------------------------------+
98
+| :option:`--interlace` | InterlacedVideo | [0 - 2] |
99
++-------------------------------------------+------------------------------+------------------------------+
100
+| :option:`--pools` | TargetSocket, | Maximum NUMA Nodes = 2 |
101
+| | LogicalProcessors | |
102
++-------------------------------------------+------------------------------+------------------------------+
103
+| :option:`--master-display` | MasteringDisplayColorVolume | Any String |
104
++-------------------------------------------+------------------------------+------------------------------+
105
+| :option:`--max-cll` | maxCLL, maxFALL | Any Positve Integer |
106
++-------------------------------------------+------------------------------+------------------------------+
107
+| :option:`--dolby-vision-profile` | DolbyVisionProfile | [8.1] |
108
++-------------------------------------------+------------------------------+------------------------------+
109
+| :option:`--dolby-vision-rpu` | DolbyVisionRpuFile | Any String |
110
++-------------------------------------------+------------------------------+------------------------------+
111
+| :option:`--nalu-file` | NaluFile | Any String |
112
++-------------------------------------------+------------------------------+------------------------------+
113
+| :option:`--tune` zerolatency | LatencyMode | |
114
++-------------------------------------------+------------------------------+------------------------------+
115
+| :option:`--svt-search-width` | SearchAreaWidth | [1 - 256] |
116
++-------------------------------------------+------------------------------+------------------------------+
117
+| :option:`--svt-search-height` | SearchAreaHeight | [1 - 256] |
118
++-------------------------------------------+------------------------------+------------------------------+
119
+| :option:`--svt-hierarchical-level` | HierarchicalLevels | [0 - 3] |
120
++-------------------------------------------+------------------------------+------------------------------+
121
+| :option:`--svt-base-layer-switch-mode` | BaseLayerSwitchMode | [0, 1] |
122
+| | | |
123
++-------------------------------------------+------------------------------+------------------------------+
124
+| :option:`--svt-pred-struct` | PredStructure | [0 - 2] |
125
++-------------------------------------------+------------------------------+------------------------------+
126
+| :option:`--svt-hme` | HME, UseDefaultMeHme | |
127
++-------------------------------------------+------------------------------+------------------------------+
128
+| :option:`--svt-compressed-ten-bit-format` | CompressedTenBitFormat | |
129
+| | | |
130
++-------------------------------------------+------------------------------+------------------------------+
131
+| :option:`--svt-speed-control` | SpeedControlFlag | |
132
++-------------------------------------------+------------------------------+------------------------------+
133
+| :option:`--svt-fps-in-vps` | FpsInVps | |
134
++-------------------------------------------+------------------------------+------------------------------+
135
+
136
+x265 CLI options which are not present in the above table will have no effect if SVT-HEVC is enabled
137
+and would be ignored silently with a warning. If SVT-HEVC is enabled, accepted input range of x265 CLI
138
+options will change, because it follows SVT-HEVC encoder's specs, which are mentioned in the Range
139
+section in the above table. Options starting with prefix "--svt-" are newly added to
140
+fecilitate access to the features of SVT-HEVC which couldn't be mapped to the existing x265 CLI's.
141
+So these options will have effect only if SVT-HEVC is enabled and would be ignored with default x265 encode.
142
+
143
+Preset & Tune Options Mapping
144
+=============================
145
+x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 13 presets. Use :option:`--svt-preset-tuner`
146
+with Placebo preset to access the additional 3 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be
147
+used only if SVT-HEVC is enabled and only with Placebo preset, would be ignored otherwise.
148
+Below table shows the actual mapping of presets,
149
+
150
++----------------------------------------+------------------------------+
151
+| x265 Preset | SVT-HEVC Preset |
152
++========================================+==============================+
153
+| Ultrafast | 12 |
154
++----------------------------------------+------------------------------+
155
+| Superfast | 11 |
156
++----------------------------------------+------------------------------+
157
+| Veryfast | 10 |
158
++----------------------------------------+------------------------------+
159
+| Faster | 9 |
160
++----------------------------------------+------------------------------+
161
+| Fast | 8 |
162
++----------------------------------------+------------------------------+
163
+| Medium | 7 |
164
++----------------------------------------+------------------------------+
165
+| Slow | 6 |
166
++----------------------------------------+------------------------------+
167
+| Slower | 5 |
168
++----------------------------------------+------------------------------+
169
+| Veryslow | 4 |
170
++----------------------------------------+------------------------------+
171
+| Placebo | 3 |
172
++----------------------------------------+------------------------------+
173
+| Placebo :option:`--svt-preset-tuner` 0 | 0 |
174
++----------------------------------------+------------------------------+
175
+| Placebo :option:`--svt-preset-tuner` 1 | 1 |
176
++----------------------------------------+------------------------------+
177
+| Placebo :option:`--svt-preset-tuner` 2 | 2 |
178
++----------------------------------------+------------------------------+
179
+
180
+x265 has 5 tune modes (psnr, ssim, grain, zero-latency, animation) whereas SVT-HEVC
181
+has only 3 tune modes (0 - visual quality, 1 - PSNR / SSIM and 2 - VMAF). Below
182
+table shows the mapping of tune modes,
183
+
184
++-----------------------+---------------------------+
185
+| x265 Tune Modes | SVT-HEVC Tune Modes |
186
++=======================+===========================+
187
+| vmaf | 2 |
188
++-----------------------+---------------------------+
189
+| psnr | 1 |
190
++-----------------------+---------------------------+
191
+| ssim | 1 |
192
++-----------------------+---------------------------+
193
+| grain | 0 |
194
++-----------------------+---------------------------+
195
+| fastdecode | 0 |
196
++-----------------------+---------------------------+
197
+| zerolatency | 0 |
198
++-----------------------+---------------------------+
199
+| animation | 0 |
200
++-----------------------+---------------------------+
201
x265_3.0.tar.gz/source/CMakeLists.txt -> x265_3.1.1.tar.gz/source/CMakeLists.txt
Changed
64
1
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 169)
6
+set(X265_BUILD 176)
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
11
add_subdirectory(dynamicHDR10)
12
add_definitions(-DENABLE_HDR10_PLUS)
13
endif(ENABLE_HDR10_PLUS)
14
+
15
+option(ENABLE_SVT_HEVC "Enable SVT HEVC Encoder" OFF)
16
+if(ENABLE_SVT_HEVC)
17
+ find_package(svthevc)
18
+ if(SVTHEVC_FOUND)
19
+ add_definitions(-DSVT_HEVC)
20
+ include_directories(${SVT_HEVC_INCLUDE_DIR})
21
+ endif(SVTHEVC_FOUND)
22
+endif(ENABLE_SVT_HEVC)
23
+
24
# this option can only be used when linking multiple libx265 libraries
25
# together, and some alternate API access method is implemented.
26
option(EXPORT_C_API "Implement public C programming interface" ON)
27
28
if(ENABLE_LIBVMAF)
29
target_link_libraries(x265-static ${VMAF})
30
endif()
31
+if(SVTHEVC_FOUND)
32
+ target_link_libraries(x265-static ${SVT_HEVC_LIBRARY})
33
+endif()
34
install(TARGETS x265-static
35
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
36
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
37
38
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
39
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
40
endif()
41
+
42
+if(SVTHEVC_FOUND)
43
+ install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
44
+ install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
45
+ install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include)
46
+ install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})
47
+endif()
48
+
49
install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
50
if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
51
if(MSVC_IDE)
52
53
if(EXTRA_LIB)
54
target_link_libraries(x265-shared ${EXTRA_LIB})
55
endif()
56
- target_link_libraries(x265-shared ${PLATFORM_LIBS})
57
+ target_link_libraries(x265-shared ${PLATFORM_LIBS})
58
+ if(SVTHEVC_FOUND)
59
+ target_link_libraries(x265-shared ${SVT_HEVC_LIBRARY})
60
+ endif(SVTHEVC_FOUND)
61
if(MSVC)
62
set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265)
63
else()
64
x265_3.1.1.tar.gz/source/cmake/Findsvthevc.cmake
Added
62
1
2
+# Module for locating SVT-HEVC Library
3
+#
4
+# SVT_HEVC_INCLUDE_DIR
5
+# Points to the SVT-HEVC include directory.
6
+#
7
+# SVT_HEVC_LIBRARY
8
+# Points to the SVT-HEVC library
9
+# Copyright (c) 2013-2018 MulticoreWare, Inc
10
+
11
+include(FindPackageHandleStandardArgs)
12
+
13
+if(UNIX)
14
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
15
+else()
16
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
17
+endif()
18
+
19
+set(SVT_VERSION_MAJOR_REQUIRED 1)
20
+set(SVT_VERSION_MINOR_REQUIRED 3)
21
+set(SVT_VERSION_PATCHLEVEL_REQUIRED 0)
22
+
23
+find_path(SVT_HEVC_INCLUDE_DIR
24
+ NAMES EbApi.h EbErrorCodes.h EbTime.h
25
+ HINTS $ENV{SVT_HEVC_INCLUDE_DIR}
26
+ PATHS ENV
27
+ DOC "SVT-HEVC include directory")
28
+
29
+if(SVT_HEVC_INCLUDE_DIR)
30
+file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version)
31
+
32
+string(REGEX MATCH "SVT_VERSION_MAJOR ([0-9]*)" _ ${version})
33
+set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})
34
+
35
+string(REGEX MATCH "SVT_VERSION_MINOR ([0-9]*)" _ ${version})
36
+set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})
37
+
38
+string(REGEX MATCH "SVT_VERSION_PATCHLEVEL ([0-9]*)" _ ${version})
39
+set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})
40
+
41
+if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0")
42
+ 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 ")
43
+else()
44
+ message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
45
+endif()
46
+
47
+endif()
48
+
49
+find_library(SVT_HEVC_LIBRARY
50
+if(UNIX)
51
+ NAMES SvtHevcEnc
52
+else()
53
+ NAMES SvtHevcEnc
54
+endif()
55
+ HINTS $ENV{SVT_HEVC_LIBRARY_DIR}
56
+ PATHS ENV
57
+ DOC "SVT-HEVC library")
58
+
59
+
60
+mark_as_advanced(SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR SVT_HEVC_LIBRARY_DIR)
61
+find_package_handle_standard_args(SVTHEVC REQUIRED_VARS SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR)
62
x265_3.0.tar.gz/source/common/cudata.cpp -> x265_3.1.1.tar.gz/source/common/cudata.cpp
Changed
26
1
2
int mvx = x265_clip3(-32768, 32767, (scale * mv.x + 127 + (scale * mv.x < 0)) >> 8);
3
int mvy = x265_clip3(-32768, 32767, (scale * mv.y + 127 + (scale * mv.y < 0)) >> 8);
4
5
- return MV((int16_t)mvx, (int16_t)mvy);
6
+ return MV((int32_t)mvx, (int32_t)mvy);
7
}
8
9
}
10
11
const uint32_t mvshift = 2;
12
uint32_t offset = 8;
13
14
- int16_t xmax = (int16_t)((m_slice->m_sps->picWidthInLumaSamples + offset - m_cuPelX - 1) << mvshift);
15
- int16_t xmin = -(int16_t)((m_encData->m_param->maxCUSize + offset + m_cuPelX - 1) << mvshift);
16
+ int32_t xmax = (int32_t)((m_slice->m_sps->picWidthInLumaSamples + offset - m_cuPelX - 1) << mvshift);
17
+ int32_t xmin = -(int32_t)((m_encData->m_param->maxCUSize + offset + m_cuPelX - 1) << mvshift);
18
19
- int16_t ymax = (int16_t)((m_slice->m_sps->picHeightInLumaSamples + offset - m_cuPelY - 1) << mvshift);
20
- int16_t ymin = -(int16_t)((m_encData->m_param->maxCUSize + offset + m_cuPelY - 1) << mvshift);
21
+ int32_t ymax = (int32_t)((m_slice->m_sps->picHeightInLumaSamples + offset - m_cuPelY - 1) << mvshift);
22
+ int32_t ymin = -(int32_t)((m_encData->m_param->maxCUSize + offset + m_cuPelY - 1) << mvshift);
23
24
outMV.x = X265_MIN(xmax, X265_MAX(xmin, outMV.x));
25
outMV.y = X265_MIN(ymax, X265_MAX(ymin, outMV.y));
26
x265_3.0.tar.gz/source/common/frame.cpp -> x265_3.1.1.tar.gz/source/common/frame.cpp
Changed
9
1
2
m_addOnCtuInfo = NULL;
3
m_addOnPrevChange = NULL;
4
m_classifyFrame = false;
5
+ m_fieldNum = 0;
6
}
7
8
bool Frame::create(x265_param *param, float* quantOffsets)
9
x265_3.0.tar.gz/source/common/frame.h -> x265_3.1.1.tar.gz/source/common/frame.h
Changed
9
1
2
uint32_t* m_classifyCount;
3
4
bool m_classifyFrame;
5
+ int m_fieldNum;
6
7
Frame();
8
9
x265_3.0.tar.gz/source/common/lowres.cpp -> x265_3.1.1.tar.gz/source/common/lowres.cpp
Changed
27
1
2
3
size_t planesize = lumaStride * (lines + 2 * origPic->m_lumaMarginY);
4
size_t padoffset = lumaStride * origPic->m_lumaMarginY + origPic->m_lumaMarginX;
5
- if (!!param->rc.aqMode || !!param->rc.hevcAq)
6
+ if (!!param->rc.aqMode || !!param->rc.hevcAq || !!param->bAQMotion)
7
{
8
CHECKED_MALLOC_ZERO(qpAqOffset, double, cuCountFullRes);
9
CHECKED_MALLOC_ZERO(invQscaleFactor, int, cuCountFullRes);
10
11
12
if (origPic->m_param->bAQMotion)
13
CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes);
14
- if (origPic->m_param->bDynamicRefine)
15
+ if (origPic->m_param->bDynamicRefine || origPic->m_param->bEnableFades)
16
CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes);
17
18
if (!!param->rc.hevcAq)
19
20
{
21
bLastMiniGopBFrame = false;
22
bKeyframe = false; // Not a keyframe unless identified by lookahead
23
+ bIsFadeEnd = false;
24
frameNum = poc;
25
leadingBframes = 0;
26
indB = 0;
27
x265_3.0.tar.gz/source/common/lowres.h -> x265_3.1.1.tar.gz/source/common/lowres.h
Changed
17
1
2
bool bScenecut; // Set to false if the frame cannot possibly be part of a real scenecut.
3
bool bKeyframe;
4
bool bLastMiniGopBFrame;
5
+ bool bIsFadeEnd;
6
7
double ipCostRatio;
8
9
10
uint32_t* blockVariance;
11
uint64_t wp_ssd[3]; // This is different than SSDY, this is sum(pixel^2) - sum(pixel)^2 for entire frame
12
uint64_t wp_sum[3];
13
+ double frameVariance;
14
15
/* cutree intermediate data */
16
PicQPAdaptationLayer* pAQLayer;
17
x265_3.0.tar.gz/source/common/mv.h -> x265_3.1.1.tar.gz/source/common/mv.h
Changed
41
1
2
public:
3
4
union {
5
- struct { int16_t x, y; };
6
+ struct { int32_t x, y; };
7
8
- int32_t word;
9
+ int64_t word;
10
};
11
12
MV() {}
13
- MV(int32_t w) : word(w) {}
14
- MV(int16_t _x, int16_t _y) : x(_x), y(_y) {}
15
+ MV(int64_t w) : word(w) {}
16
+ MV(int32_t _x, int32_t _y) : x(_x), y(_y) {}
17
18
- MV& operator =(uint32_t w) { word = w; return *this; }
19
+ MV& operator =(uint64_t w) { word = w; return *this; }
20
21
MV& operator +=(const MV& other) { x += other.x; y += other.y; return *this; }
22
23
24
25
MV operator >>(int i) const { return MV(x >> i, y >> i); }
26
27
- MV operator *(int16_t i) const { return MV(x * i, y * i); }
28
+ MV operator *(int32_t i) const { return MV(x * i, y * i); }
29
30
MV operator -(const MV& other) const { return MV(x - other.x, y - other.y); }
31
32
33
34
bool inline notZero() const { return this->word != 0; }
35
36
- bool inline isSubpel() const { return (this->word & 0x00030003) != 0; }
37
+ bool inline isSubpel() const { return (this->word & 0x0000000300000003ll) != 0; }
38
39
MV mvmin(const MV& m) const { return MV(x > m.x ? m.x : x, y > m.y ? m.y : y); }
40
41
x265_3.0.tar.gz/source/common/param.cpp -> x265_3.1.1.tar.gz/source/common/param.cpp
Changed
201
1
2
#include "param.h"
3
#include "cpu.h"
4
#include "x265.h"
5
+#include "svt.h"
6
7
#if _MSC_VER
8
#pragma warning(disable: 4996) // POSIX functions are just fine, thanks
9
10
11
x265_param *x265_param_alloc()
12
{
13
- return (x265_param*)x265_malloc(sizeof(x265_param));
14
+ x265_param* param = (x265_param*)x265_malloc(sizeof(x265_param));
15
+#ifdef SVT_HEVC
16
+ param->svtHevcParam = (EB_H265_ENC_CONFIGURATION*)x265_malloc(sizeof(EB_H265_ENC_CONFIGURATION));
17
+#endif
18
+ return param;
19
}
20
21
void x265_param_free(x265_param* p)
22
{
23
+ x265_zone_free(p);
24
+#ifdef SVT_HEVC
25
+ x265_free(p->svtHevcParam);
26
+#endif
27
x265_free(p);
28
}
29
30
void x265_param_default(x265_param* param)
31
{
32
+#ifdef SVT_HEVC
33
+ EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam;
34
+#endif
35
+
36
memset(param, 0, sizeof(x265_param));
37
38
/* Applying default values to all elements in the param structure */
39
40
param->uhdBluray = 0;
41
param->bHighTier = 1; //Allow high tier by default
42
param->interlaceMode = 0;
43
+ param->bField = 0;
44
param->bAnnexB = 1;
45
param->bRepeatHeaders = 0;
46
param->bEnableAccessUnitDelimiters = 0;
47
48
param->chunkStart = 0;
49
param->chunkEnd = 0;
50
param->bEnableHRDConcatFlag = 0;
51
+ param->bEnableFades = 0;
52
53
/* Intra Coding Tools */
54
param->bEnableConstrainedIntra = 0;
55
56
param->searchMethod = X265_HEX_SEARCH;
57
param->subpelRefine = 2;
58
param->searchRange = 57;
59
- param->maxNumMergeCand = 2;
60
- param->limitReferences = 3;
61
+ param->maxNumMergeCand = 3;
62
+ param->limitReferences = 1;
63
param->limitModes = 0;
64
param->bEnableWeightedPred = 1;
65
param->bEnableWeightedBiPred = 0;
66
- param->bEnableEarlySkip = 0;
67
+ param->bEnableEarlySkip = 1;
68
param->bEnableRecursionSkip = 1;
69
param->bEnableAMP = 0;
70
param->bEnableRectInter = 0;
71
72
param->analysisReuseFileName = NULL;
73
param->analysisSave = NULL;
74
param->analysisLoad = NULL;
75
- param->bIntraInBFrames = 0;
76
+ param->bIntraInBFrames = 1;
77
param->bLossless = 0;
78
param->bCULossless = 0;
79
param->bEnableTemporalSubLayers = 0;
80
81
/* SEI messages */
82
param->preferredTransferCharacteristics = -1;
83
param->pictureStructure = -1;
84
+ param->bEmitCLL = 1;
85
+
86
+ /* SVT Hevc Encoder specific params */
87
+ param->bEnableSvtHevc = 0;
88
+ param->svtHevcParam = NULL;
89
+
90
+#ifdef SVT_HEVC
91
+ param->svtHevcParam = svtParam;
92
+ svt_param_default(param);
93
+#endif
94
}
95
96
int x265_param_default_preset(x265_param* param, const char* preset, const char* tune)
97
98
99
if (!strcmp(preset, "ultrafast"))
100
{
101
+ param->maxNumMergeCand = 2;
102
+ param->bIntraInBFrames = 0;
103
param->lookaheadDepth = 5;
104
param->scenecutThreshold = 0; // disable lookahead
105
param->maxCUSize = 32;
106
107
param->bFrameAdaptive = 0;
108
param->subpelRefine = 0;
109
param->searchMethod = X265_DIA_SEARCH;
110
- param->bEnableEarlySkip = 1;
111
param->bEnableSAO = 0;
112
param->bEnableSignHiding = 0;
113
param->bEnableWeightedPred = 0;
114
115
}
116
else if (!strcmp(preset, "superfast"))
117
{
118
+ param->maxNumMergeCand = 2;
119
+ param->bIntraInBFrames = 0;
120
param->lookaheadDepth = 10;
121
param->maxCUSize = 32;
122
param->bframes = 3;
123
param->bFrameAdaptive = 0;
124
param->subpelRefine = 1;
125
- param->bEnableEarlySkip = 1;
126
param->bEnableWeightedPred = 0;
127
param->rdLevel = 2;
128
param->maxNumReferences = 1;
129
130
}
131
else if (!strcmp(preset, "veryfast"))
132
{
133
+ param->maxNumMergeCand = 2;
134
+ param->limitReferences = 3;
135
+ param->bIntraInBFrames = 0;
136
param->lookaheadDepth = 15;
137
param->bFrameAdaptive = 0;
138
param->subpelRefine = 1;
139
- param->bEnableEarlySkip = 1;
140
param->rdLevel = 2;
141
param->maxNumReferences = 2;
142
param->rc.qgSize = 32;
143
144
}
145
else if (!strcmp(preset, "faster"))
146
{
147
+ param->maxNumMergeCand = 2;
148
+ param->limitReferences = 3;
149
+ param->bIntraInBFrames = 0;
150
param->lookaheadDepth = 15;
151
param->bFrameAdaptive = 0;
152
- param->bEnableEarlySkip = 1;
153
param->rdLevel = 2;
154
param->maxNumReferences = 2;
155
param->bEnableFastIntra = 1;
156
}
157
else if (!strcmp(preset, "fast"))
158
{
159
+ param->maxNumMergeCand = 2;
160
+ param->limitReferences = 3;
161
+ param->bEnableEarlySkip = 0;
162
+ param->bIntraInBFrames = 0;
163
param->lookaheadDepth = 15;
164
param->bFrameAdaptive = 0;
165
param->rdLevel = 2;
166
167
}
168
else if (!strcmp(preset, "slow"))
169
{
170
+ param->limitReferences = 3;
171
+ param->bEnableEarlySkip = 0;
172
+ param->bIntraInBFrames = 0;
173
param->bEnableRectInter = 1;
174
param->lookaheadDepth = 25;
175
param->rdLevel = 4;
176
param->rdoqLevel = 2;
177
param->psyRdoq = 1.0;
178
param->subpelRefine = 3;
179
- param->maxNumMergeCand = 3;
180
param->searchMethod = X265_STAR_SEARCH;
181
param->maxNumReferences = 4;
182
param->limitModes = 1;
183
184
}
185
else if (!strcmp(preset, "slower"))
186
{
187
+ param->bEnableEarlySkip = 0;
188
param->bEnableWeightedBiPred = 1;
189
param->bEnableAMP = 1;
190
param->bEnableRectInter = 1;
191
192
param->maxNumMergeCand = 4;
193
param->searchMethod = X265_STAR_SEARCH;
194
param->maxNumReferences = 5;
195
- param->limitReferences = 1;
196
param->limitModes = 1;
197
- param->bIntraInBFrames = 1;
198
param->lookaheadSlices = 0; // disabled for best quality
199
param->limitTU = 4;
200
}
201
x265_3.0.tar.gz/source/common/param.h -> x265_3.1.1.tar.gz/source/common/param.h
Changed
9
1
2
void setParamAspectRatio(x265_param *p, int width, int height);
3
void getParamAspectRatio(x265_param *p, int& width, int& height);
4
bool parseLambdaFile(x265_param *param);
5
+void x265_copy_params(x265_param* dst, x265_param* src);
6
7
/* this table is kept internal to avoid confusion, since log level indices start at -1 */
8
static const char * const logLevelNames[] = { "none", "error", "warning", "info", "debug", "full", 0 };
9
x265_3.0.tar.gz/source/common/pixel.cpp -> x265_3.1.1.tar.gz/source/common/pixel.cpp
Changed
63
1
2
}
3
}
4
5
+template<int log2TrSize>
6
+static void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k)
7
+{
8
+ *ssBlock = 0;
9
+ int trSize = 1 << log2TrSize;
10
+ for (int y = 0; y < trSize; y++)
11
+ {
12
+ for (int x = 0; x < trSize; x++)
13
+ {
14
+ int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff
15
+ *ssBlock += temp * temp;
16
+ }
17
+ }
18
+
19
+ *ac_k = 0;
20
+ for (int block_yy = 0; block_yy < trSize; block_yy += 1)
21
+ {
22
+ for (int block_xx = 0; block_xx < trSize; block_xx += 1)
23
+ {
24
+ uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift;
25
+ *ac_k += temp * temp;
26
+ }
27
+ }
28
+}
29
+
30
+static void normFact_c(const pixel* src, uint32_t blockSize, int shift, uint64_t *z_k)
31
+{
32
+ *z_k = 0;
33
+ for (uint32_t block_yy = 0; block_yy < blockSize; block_yy += 1)
34
+ {
35
+ for (uint32_t block_xx = 0; block_xx < blockSize; block_xx += 1)
36
+ {
37
+ uint32_t temp = src[block_yy * blockSize + block_xx] >> shift;
38
+ *z_k += temp * temp;
39
+ }
40
+ }
41
+}
42
+
43
#if HIGH_BIT_DEPTH
44
static pixel planeClipAndMax_c(pixel *src, intptr_t stride, int width, int height, uint64_t *outsum,
45
const pixel minPix, const pixel maxPix)
46
47
p.propagateCost = estimateCUPropagateCost;
48
p.fix8Unpack = cuTreeFix8Unpack;
49
p.fix8Pack = cuTreeFix8Pack;
50
+
51
+ p.cu[BLOCK_4x4].ssimDist = ssimDist_c<2>;
52
+ p.cu[BLOCK_8x8].ssimDist = ssimDist_c<3>;
53
+ p.cu[BLOCK_16x16].ssimDist = ssimDist_c<4>;
54
+ p.cu[BLOCK_32x32].ssimDist = ssimDist_c<5>;
55
+ p.cu[BLOCK_64x64].ssimDist = ssimDist_c<6>;
56
+
57
+ p.cu[BLOCK_8x8].normFact = normFact_c;
58
+ p.cu[BLOCK_16x16].normFact = normFact_c;
59
+ p.cu[BLOCK_32x32].normFact = normFact_c;
60
+ p.cu[BLOCK_64x64].normFact = normFact_c;
61
}
62
}
63
x265_3.0.tar.gz/source/common/primitives.h -> x265_3.1.1.tar.gz/source/common/primitives.h
Changed
19
1
2
typedef void(*psyRdoQuant_t)(int16_t *m_resiDctCoeff, int16_t *m_fencDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost, int64_t *psyScale, uint32_t blkPos);
3
typedef void(*psyRdoQuant_t1)(int16_t *m_resiDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost,uint32_t blkPos);
4
typedef void(*psyRdoQuant_t2)(int16_t *m_resiDctCoeff, int16_t *m_fencDctCoeff, int64_t *costUncoded, int64_t *totalUncodedCost, int64_t *totalRdCost, int64_t *psyScale, uint32_t blkPos);
5
+typedef void(*ssimDistortion_t)(const pixel *fenc, uint32_t fStride, const pixel *recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k);
6
+typedef void(*normFactor_t)(const pixel *src, uint32_t blockSize, int shift, uint64_t *z_k);
7
/* Function pointers to optimized encoder primitives. Each pointer can reference
8
* either an assembly routine, a SIMD intrinsic primitive, or a C function */
9
struct EncoderPrimitives
10
11
psyRdoQuant_t psyRdoQuant;
12
psyRdoQuant_t1 psyRdoQuant_1p;
13
psyRdoQuant_t2 psyRdoQuant_2p;
14
+ ssimDistortion_t ssimDist;
15
+ normFactor_t normFact;
16
}
17
cu[NUM_CU_SIZES];
18
/* These remaining primitives work on either fixed block sizes or take
19
x265_3.0.tar.gz/source/common/quant.cpp -> x265_3.1.1.tar.gz/source/common/quant.cpp
Changed
35
1
2
3
// Calculation of (X(k) - Y(k)) * (X(k) - Y(k)), AC
4
ssBlock = 0;
5
- for (int y = 0; y < trSize; y++)
6
- {
7
- for (int x = 0; x < trSize; x++)
8
- {
9
- int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff
10
- ssBlock += temp * temp;
11
- }
12
- }
13
-
14
+ uint64_t ac_k = 0;
15
+ primitives.cu[log2TrSize - 2].ssimDist(fenc, fStride, recon, rstride, &ssBlock, shift, &ac_k);
16
ssAc = ssBlock - ssDc;
17
18
// 1. Calculation of fdc'
19
20
uint64_t fAc_num = 0;
21
22
// 2. Calculate ac component
23
- uint64_t ac_k = 0;
24
- for (int block_yy = 0; block_yy < trSize; block_yy += 1)
25
- {
26
- for (int block_xx = 0; block_xx < trSize; block_xx += 1)
27
- {
28
- uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift;
29
- ac_k += temp * temp;
30
- }
31
- }
32
ac_k -= dc_k;
33
34
double s = 1 + 0.005 * cu.m_qp[absPartIdx];
35
x265_3.0.tar.gz/source/common/slice.h -> x265_3.1.1.tar.gz/source/common/slice.h
Changed
17
1
2
int numRefIdxDefault[2];
3
int m_iNumRPSInSPS;
4
const x265_param *m_param;
5
+ int m_fieldNum;
6
7
Slice()
8
{
9
10
numRefIdxDefault[1] = 1;
11
m_rpsIdx = -1;
12
m_chromaQpOffset[0] = m_chromaQpOffset[1] = 0;
13
+ m_fieldNum = 0;
14
}
15
16
void disableWeights();
17
x265_3.0.tar.gz/source/common/x86/asm-primitives.cpp -> x265_3.1.1.tar.gz/source/common/x86/asm-primitives.cpp
Changed
46
1
2
p.cu[BLOCK_16x16].psyRdoQuant_1p = PFX(psyRdoQuant_1p16_avx2);
3
p.cu[BLOCK_32x32].psyRdoQuant_1p = PFX(psyRdoQuant_1p32_avx2);
4
5
+ p.cu[BLOCK_4x4].ssimDist = PFX(ssimDist4_avx2);
6
+ p.cu[BLOCK_8x8].ssimDist = PFX(ssimDist8_avx2);
7
+ p.cu[BLOCK_16x16].ssimDist = PFX(ssimDist16_avx2);
8
+ p.cu[BLOCK_32x32].ssimDist = PFX(ssimDist32_avx2);
9
+ p.cu[BLOCK_64x64].ssimDist = PFX(ssimDist64_avx2);
10
+
11
+ p.cu[BLOCK_8x8].normFact = PFX(normFact8_avx2);
12
+ p.cu[BLOCK_16x16].normFact = PFX(normFact16_avx2);
13
+ p.cu[BLOCK_32x32].normFact = PFX(normFact32_avx2);
14
+ p.cu[BLOCK_64x64].normFact = PFX(normFact64_avx2);
15
+
16
/* TODO: This kernel needs to be modified to work with HIGH_BIT_DEPTH only
17
p.planeClipAndMax = PFX(planeClipAndMax_avx2); */
18
19
20
p.pu[LUMA_32x24].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x24_avx512);
21
p.pu[LUMA_32x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x32_avx512);
22
p.pu[LUMA_32x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_32x64_avx512);
23
- p.pu[LUMA_48x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_48x64_avx512);
24
+ //p.pu[LUMA_48x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_48x64_avx512);
25
p.pu[LUMA_64x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x16_avx512);
26
p.pu[LUMA_64x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x32_avx512);
27
p.pu[LUMA_64x48].pixelavg_pp[ALIGNED] = PFX(pixel_avg_aligned_64x48_avx512);
28
29
p.cu[BLOCK_16x16].psyRdoQuant_1p = PFX(psyRdoQuant_1p16_avx2);
30
p.cu[BLOCK_32x32].psyRdoQuant_1p = PFX(psyRdoQuant_1p32_avx2);
31
32
+ p.cu[BLOCK_4x4].ssimDist = PFX(ssimDist4_avx2);
33
+ p.cu[BLOCK_8x8].ssimDist = PFX(ssimDist8_avx2);
34
+ p.cu[BLOCK_16x16].ssimDist = PFX(ssimDist16_avx2);
35
+ p.cu[BLOCK_32x32].ssimDist = PFX(ssimDist32_avx2);
36
+ p.cu[BLOCK_64x64].ssimDist = PFX(ssimDist64_avx2);
37
+
38
+ p.cu[BLOCK_8x8].normFact = PFX(normFact8_avx2);
39
+ p.cu[BLOCK_16x16].normFact = PFX(normFact16_avx2);
40
+ p.cu[BLOCK_32x32].normFact = PFX(normFact32_avx2);
41
+ p.cu[BLOCK_64x64].normFact = PFX(normFact64_avx2);
42
+
43
}
44
if (cpuMask & X265_CPU_AVX512)
45
{
46
x265_3.0.tar.gz/source/common/x86/pixel-a.asm -> x265_3.1.1.tar.gz/source/common/x86/pixel-a.asm
Changed
201
1
2
cextern pb_movemask_32
3
cextern pw_pixel_max
4
5
+%if BIT_DEPTH == 12
6
+ %define SSIMRD_SHIFT 4
7
+%elif BIT_DEPTH == 10
8
+ %define SSIMRD_SHIFT 2
9
+%elif BIT_DEPTH == 8
10
+ %define SSIMRD_SHIFT 0
11
+%else
12
+ %error Unsupported BIT_DEPTH!
13
+%endif
14
+
15
;=============================================================================
16
; SATD
17
;=============================================================================
18
19
RET
20
%endmacro
21
22
+%macro SSIM_DIST_HIGH 2
23
+ vpsrld m6, m0, SSIMRD_SHIFT
24
+ vpsubd m0, m1
25
+
26
+ vpmuldq m2, m0, m0
27
+ vpsrldq m0, m0, 4
28
+ vpmuldq m0, m0, m0
29
+ vpaddq m0, m2
30
+
31
+ vpmuldq m2, m6, m6
32
+ vpsrldq m6, m6, 4
33
+ vpmuldq m6, m6, m6
34
+ vpaddq m6, m2
35
+
36
+ vpaddq m4, m0
37
+ vpaddq m7, m6
38
+%endmacro
39
+
40
+%macro NORM_FACT_HIGH 1
41
+ vpsrld m1, m0, SSIMRD_SHIFT
42
+ vpmuldq m2, m1, m1
43
+ vpsrldq m1, m1, 4
44
+ vpmuldq m1, m1, m1
45
+
46
+ vpaddq m1, m2
47
+ vpaddq m3, m1
48
+%endmacro
49
+
50
+%macro SSIM_DIST_LOW 2
51
+ vpsrlw m6, m0, SSIMRD_SHIFT
52
+ vpsubw m0, m1
53
+
54
+ vpmaddwd m0, m0, m0
55
+ vpmaddwd m6, m6, m6
56
+
57
+ vpaddd m4, m0
58
+ vpaddd m7, m6
59
+%endmacro
60
+
61
+%macro NORM_FACT_LOW 1
62
+ vpsrlw m1, m0, SSIMRD_SHIFT
63
+ vpmaddwd m1, m1, m1
64
+ vpaddd m3, m1
65
+%endmacro
66
+
67
; FIXME avoid the spilling of regs to hold 3*stride.
68
; for small blocks on x86_32, modify pixel pointer instead.
69
70
71
RET
72
%endif
73
%endif ; HIGH_BIT_DEPTH == 1 && BIT_DEPTH == 10
74
+
75
+;template<int log2TrSize>
76
+;static void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k)
77
+;{
78
+; *ssBlock = 0;
79
+; const uint32_t trSize = 1 << log2TrSize;
80
+; for (int y = 0; y < trSize; y++)
81
+; {
82
+; for (int x = 0; x < trSize; x++)
83
+; {
84
+; int temp = fenc[y * fStride + x] - recon[y * rstride + x]; // copy of residual coeff
85
+; *ssBlock += temp * temp;
86
+; }
87
+; }
88
+;
89
+; *ac_k = 0;
90
+; for (int block_yy = 0; block_yy < trSize; block_yy += 1)
91
+; {
92
+; for (int block_xx = 0; block_xx < trSize; block_xx += 1)
93
+; {
94
+; uint32_t temp = fenc[block_yy * fStride + block_xx] >> shift;
95
+; *ac_k += temp * temp;
96
+; }
97
+; }
98
+;}
99
+;-----------------------------------------------------------------------------------------------------------------
100
+; void ssimDist_c(const pixel* fenc, uint32_t fStride, const pixel* recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k)
101
+;-----------------------------------------------------------------------------------------------------------------
102
+
103
+INIT_YMM avx2
104
+cglobal ssimDist4, 7, 8, 8
105
+ mov r5d, 4
106
+ vpxor m4, m4 ;ssBlock
107
+ vpxor m3, m3
108
+ vpxor m7, m7 ;ac_k
109
+.row:
110
+%if HIGH_BIT_DEPTH
111
+ vpmovzxwq m0, [r0] ;fenc
112
+ vpmovzxwq m1, [r2] ;recon
113
+%elif BIT_DEPTH == 8
114
+ vpmovzxbq m0, [r0]
115
+ vpmovzxbq m1, [r2]
116
+%else
117
+ %error Unsupported BIT_DEPTH!
118
+%endif
119
+ vpsrlq m6, m0, SSIMRD_SHIFT
120
+ vpsubq m0, m1
121
+ vpmuldq m0, m0, m0
122
+ vpmuldq m6, m6, m6
123
+ vpaddq m4, m0
124
+ vpaddq m7, m6
125
+
126
+%if HIGH_BIT_DEPTH
127
+ lea r0, [r0 + 2 * r1]
128
+ lea r2, [r2 + 2 * r3]
129
+%else
130
+ lea r0, [r0 + r1]
131
+ lea r2, [r2 + r3]
132
+%endif
133
+ dec r5d
134
+ jnz .row
135
+ vextracti128 xm5, m4, 1
136
+ vpaddq xm4, xm5
137
+ punpckhqdq xm2, xm4, xm3
138
+ paddq xm4, xm2
139
+
140
+ vextracti128 xm5, m7, 1
141
+ vpaddq xm7, xm5
142
+ punpckhqdq xm2, xm7, xm3
143
+ paddq xm7, xm2
144
+
145
+ movq [r4], xm4
146
+ movq [r6], xm7
147
+ RET
148
+
149
+
150
+INIT_YMM avx2
151
+cglobal ssimDist8, 7, 8, 8
152
+ mov r5d, 8
153
+ vpxor m4, m4 ;ssBlock
154
+ vpxor m3, m3
155
+ vpxor m7, m7 ;ac_k
156
+.row:
157
+%if HIGH_BIT_DEPTH
158
+ vpmovzxwd m0, [r0] ;fenc
159
+ vpmovzxwd m1, [r2] ;recon
160
+%elif BIT_DEPTH == 8
161
+ vpmovzxbd m0, [r0]
162
+ vpmovzxbd m1, [r2]
163
+%else
164
+ %error Unsupported BIT_DEPTH!
165
+%endif
166
+
167
+ SSIM_DIST_HIGH m0, m1
168
+
169
+%if HIGH_BIT_DEPTH
170
+ lea r0, [r0 + 2 * r1]
171
+ lea r2, [r2 + 2 * r3]
172
+%else
173
+ lea r0, [r0 + r1]
174
+ lea r2, [r2 + r3]
175
+%endif
176
+ dec r5d
177
+ jnz .row
178
+ vextracti128 xm5, m4, 1
179
+ vpaddq xm4, xm5
180
+ punpckhqdq xm2, xm4, xm3
181
+ paddq xm4, xm2
182
+
183
+ vextracti128 xm5, m7, 1
184
+ vpaddq xm7, xm5
185
+ punpckhqdq xm2, xm7, xm3
186
+ paddq xm7, xm2
187
+
188
+ movq [r4], xm4
189
+ movq [r6], xm7
190
+ RET
191
+
192
+
193
+INIT_YMM avx2
194
+cglobal ssimDist16, 7, 8, 8
195
+ mov r5d, 16
196
+ vpxor m4, m4 ;ssBlock
197
+ vpxor m3, m3
198
+ vpxor m7, m7 ;ac_k
199
+.row:
200
+%if HIGH_BIT_DEPTH
201
x265_3.0.tar.gz/source/common/x86/pixel.h -> x265_3.1.1.tar.gz/source/common/x86/pixel.h
Changed
12
1
2
FUNCDEF_TU_S(sse_t, pixel_ssd_s_aligned, cpu, const int16_t*, intptr_t); \
3
FUNCDEF_TU(uint64_t, pixel_var, cpu, const pixel*, intptr_t); \
4
FUNCDEF_TU(int, psyCost_pp, cpu, const pixel* source, intptr_t sstride, const pixel* recon, intptr_t rstride); \
5
- FUNCDEF_TU(int, psyCost_ss, cpu, const int16_t* source, intptr_t sstride, const int16_t* recon, intptr_t rstride)
6
+ FUNCDEF_TU(int, psyCost_ss, cpu, const int16_t* source, intptr_t sstride, const int16_t* recon, intptr_t rstride); \
7
+ FUNCDEF_TU_S2(void, ssimDist, cpu, const pixel *fenc, uint32_t fStride, const pixel *recon, intptr_t rstride, uint64_t *ssBlock, int shift, uint64_t *ac_k); \
8
+ FUNCDEF_TU_S2(void, normFact, cpu, const pixel *src, uint32_t blockSize, int shift, uint64_t *z_k)
9
10
DECL_PIXELS(mmx);
11
DECL_PIXELS(mmx2);
12
x265_3.0.tar.gz/source/dynamicHDR10/metadataFromJson.cpp -> x265_3.1.1.tar.gz/source/dynamicHDR10/metadataFromJson.cpp
Changed
15
1
2
const uint16_t terminalProviderCode = 0x003C;
3
const uint16_t terminalProviderOrientedCode = 0x0001;
4
const uint8_t applicationIdentifier = 4;
5
- const uint8_t applicationVersion = 1;
6
+ uint8_t applicationVersion = 0;
7
+
8
+ if (jsonType & LLC)
9
+ {
10
+ applicationVersion = 1;
11
+ }
12
13
mPimpl->appendBits(metadata, countryCode, 8);
14
mPimpl->appendBits(metadata, terminalProviderCode, 16);
15
x265_3.0.tar.gz/source/encoder/CMakeLists.txt -> x265_3.1.1.tar.gz/source/encoder/CMakeLists.txt
Changed
7
1
2
reference.cpp reference.h
3
encoder.cpp encoder.h
4
api.cpp
5
- weightPrediction.cpp)
6
+ weightPrediction.cpp svt.h)
7
x265_3.0.tar.gz/source/encoder/analysis.cpp -> x265_3.1.1.tar.gz/source/encoder/analysis.cpp
Changed
42
1
2
bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);
3
bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);
4
bool bDecidedDepth = parentCTU.m_cuDepth[cuGeom.absPartIdx] == depth;
5
+ int split = 0;
6
7
TrainingData td;
8
td.init(parentCTU, cuGeom);
9
10
m_refineLevel = m_param->interRefine;
11
else
12
m_refineLevel = m_frame->m_classifyFrame ? 1 : 3;
13
- int split = (m_param->scaleFactor && bDecidedDepth && (!mightNotSplit ||
14
- (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1))));
15
+
16
+ if (m_param->interRefine == 1)
17
+ split = (m_param->scaleFactor && bDecidedDepth && parentCTU.m_predMode[cuGeom.absPartIdx] == MODE_SKIP && (!mightNotSplit ||
18
+ (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1))));
19
+ else
20
+ split = (m_param->scaleFactor && bDecidedDepth && (!mightNotSplit ||
21
+ (m_refineLevel && cuGeom.log2CUSize == (uint32_t)(g_log2Size[m_param->minCUSize] + 1))));
22
td.split = split;
23
24
if ((bDecidedDepth && mightNotSplit) || (m_param->bAnalysisType == HEVC_INFO && parentCTU.m_cuDepth[cuGeom.absPartIdx] == 4))
25
26
27
// 2. Calculate ac component
28
uint64_t z_k = 0;
29
- for (uint32_t block_yy = 0; block_yy < blockSize; block_yy += 1)
30
- {
31
- for (uint32_t block_xx = 0; block_xx < blockSize; block_xx += 1)
32
- {
33
- uint32_t temp = src[block_yy * blockSize + block_xx] >> shift;
34
- z_k += temp * temp;
35
- }
36
- }
37
+ int block = (int)(((log(blockSize) / log(2)) - 2) + 0.5);
38
+ primitives.cu[block].normFact(src, blockSize, shift, &z_k);
39
40
// Remove the DC part
41
z_k -= z_o;
42
x265_3.0.tar.gz/source/encoder/api.cpp -> x265_3.1.1.tar.gz/source/encoder/api.cpp
Changed
201
1
2
#include "level.h"
3
#include "nal.h"
4
#include "bitcost.h"
5
+#include "svt.h"
6
7
#if ENABLE_LIBVMAF
8
#include "libvmaf.h"
9
10
x265_param* zoneParam = PARAM_NS::x265_param_alloc();
11
if (!param || !latestParam)
12
goto fail;
13
+ if (p->rc.zoneCount || p->rc.zonefileCount)
14
+ {
15
+ int zoneCount = p->rc.zonefileCount ? p->rc.zonefileCount : p->rc.zoneCount;
16
+ param->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
17
+ latestParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
18
+ }
19
20
- memcpy(param, p, sizeof(x265_param));
21
+ x265_copy_params(param, p);
22
x265_log(param, X265_LOG_INFO, "HEVC encoder version %s\n", PFX(version_str));
23
x265_log(param, X265_LOG_INFO, "build info %s\n", PFX(build_info_str));
24
25
+ encoder = new Encoder;
26
+
27
+#ifdef SVT_HEVC
28
+
29
+ if (param->bEnableSvtHevc)
30
+ {
31
+ EB_ERRORTYPE return_error = EB_ErrorNone;
32
+ int ret = 0;
33
+
34
+ svt_initialise_app_context(encoder);
35
+ ret = svt_initialise_input_buffer(encoder);
36
+ if (!ret)
37
+ {
38
+ x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Unable to allocate input buffer \n");
39
+ goto fail;
40
+ }
41
+
42
+ // Create Encoder Handle
43
+ return_error = EbInitHandle(&encoder->m_svtAppData->svtEncoderHandle, encoder->m_svtAppData, encoder->m_svtAppData->svtHevcParams);
44
+ if (return_error != EB_ErrorNone)
45
+ {
46
+ x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Unable to initialise encoder handle \n");
47
+ goto fail;
48
+ }
49
+
50
+ memcpy(encoder->m_svtAppData->svtHevcParams, param->svtHevcParam, sizeof(EB_H265_ENC_CONFIGURATION));
51
+
52
+ // Send over all configuration parameters
53
+ return_error = EbH265EncSetParameter(encoder->m_svtAppData->svtEncoderHandle, encoder->m_svtAppData->svtHevcParams);
54
+ if (return_error != EB_ErrorNone)
55
+ {
56
+ x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Error while configuring encoder parameters \n");
57
+ goto fail;
58
+ }
59
+
60
+ // Init Encoder
61
+ return_error = EbInitEncoder(encoder->m_svtAppData->svtEncoderHandle);
62
+ if (return_error != EB_ErrorNone)
63
+ {
64
+ x265_log(param, X265_LOG_ERROR, "SVT-HEVC Encoder: Encoder init failed \n");
65
+ goto fail;
66
+ }
67
+
68
+ memcpy(param->svtHevcParam, encoder->m_svtAppData->svtHevcParams, sizeof(EB_H265_ENC_CONFIGURATION));
69
+ encoder->m_param = param;
70
+ return encoder;
71
+ }
72
+#endif
73
+
74
x265_setup_primitives(param);
75
76
if (x265_check_params(param))
77
goto fail;
78
79
- encoder = new Encoder;
80
if (!param->rc.bEnableSlowFirstPass)
81
PARAM_NS::x265_param_apply_fastfirstpass(param);
82
83
84
}
85
86
encoder->m_latestParam = latestParam;
87
- memcpy(latestParam, param, sizeof(x265_param));
88
+ x265_copy_params(latestParam, param);
89
if (encoder->m_aborted)
90
goto fail;
91
92
93
if (pp_nal && enc)
94
{
95
Encoder *encoder = static_cast<Encoder*>(enc);
96
+#ifdef SVT_HEVC
97
+ if (encoder->m_param->bEnableSvtHevc)
98
+ {
99
+ EB_ERRORTYPE return_error;
100
+ EB_BUFFERHEADERTYPE* outputPtr;
101
+ return_error = EbH265EncStreamHeader(encoder->m_svtAppData->svtEncoderHandle, &outputPtr);
102
+ if (return_error != EB_ErrorNone)
103
+ {
104
+ x265_log(encoder->m_param, X265_LOG_ERROR, "SVT HEVC encoder: Error while generating stream headers \n");
105
+ encoder->m_aborted = true;
106
+ return -1;
107
+ }
108
+
109
+ //Copy data from output packet to NAL
110
+ encoder->m_nalList.m_nal[0].payload = outputPtr->pBuffer;
111
+ encoder->m_nalList.m_nal[0].sizeBytes = outputPtr->nFilledLen;
112
+ *pp_nal = &encoder->m_nalList.m_nal[0];
113
+ *pi_nal = 1;
114
+ encoder->m_svtAppData->byteCount += outputPtr->nFilledLen;
115
+
116
+ // Release the output buffer
117
+ EbH265ReleaseOutBuffer(&outputPtr);
118
+
119
+ return pp_nal[0]->sizeBytes;
120
+ }
121
+#endif
122
+
123
Entropy sbacCoder;
124
Bitstream bs;
125
if (encoder->m_param->rc.bStatRead && encoder->m_param->bMultiPassOptRPS)
126
127
if (enc && out)
128
{
129
Encoder *encoder = static_cast<Encoder*>(enc);
130
- memcpy(out, encoder->m_param, sizeof(x265_param));
131
+ x265_copy_params(out, encoder->m_param);
132
}
133
}
134
135
136
bool isReconfigureRc = encoder->isReconfigureRc(encoder->m_latestParam, param_in);
137
if ((encoder->m_reconfigure && !isReconfigureRc) || (encoder->m_reconfigureRc && isReconfigureRc)) /* Reconfigure in progress */
138
return 1;
139
- memcpy(&save, encoder->m_latestParam, sizeof(x265_param));
140
+ if (encoder->m_latestParam->rc.zoneCount || encoder->m_latestParam->rc.zonefileCount)
141
+ {
142
+ int zoneCount = encoder->m_latestParam->rc.zonefileCount ? encoder->m_latestParam->rc.zonefileCount : encoder->m_latestParam->rc.zoneCount;
143
+ save.rc.zones = x265_zone_alloc(zoneCount, !!encoder->m_latestParam->rc.zonefileCount);
144
+ }
145
+ x265_copy_params(&save, encoder->m_latestParam);
146
int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
147
if (ret)
148
{
149
/* reconfigure failed, recover saved param set */
150
- memcpy(encoder->m_latestParam, &save, sizeof(x265_param));
151
+ x265_copy_params(encoder->m_latestParam, &save);
152
ret = -1;
153
}
154
else
155
156
{
157
if (encoder->m_scalingList.parseScalingList(encoder->m_latestParam->scalingLists))
158
{
159
- memcpy(encoder->m_latestParam, &save, sizeof(x265_param));
160
+ x265_copy_params(encoder->m_latestParam, &save);
161
return -1;
162
}
163
encoder->m_scalingList.setupQuantMatrices(encoder->m_param->internalCsp);
164
165
else
166
{
167
x265_log(encoder->m_param, X265_LOG_ERROR, "Repeat headers is turned OFF, cannot reconfigure scalinglists\n");
168
- memcpy(encoder->m_latestParam, &save, sizeof(x265_param));
169
+ x265_copy_params(encoder->m_latestParam, &save);
170
return -1;
171
}
172
}
173
174
x265_log(encoder->m_param, X265_LOG_WARNING, "Profile/Level/Tier has changed from %d/%d/%s to %d/%d/%s.Cannot reconfigure rate-control.\n",
175
saveVPS.ptl.profileIdc, saveVPS.ptl.levelIdc, saveVPS.ptl.tierFlag ? "High" : "Main", encoder->m_vps.ptl.profileIdc,
176
encoder->m_vps.ptl.levelIdc, encoder->m_vps.ptl.tierFlag ? "High" : "Main");
177
- memcpy(encoder->m_latestParam, &save, sizeof(x265_param));
178
+ x265_copy_params(encoder->m_latestParam, &save);
179
memcpy(&encoder->m_vps.ptl, &saveVPS.ptl, sizeof(saveVPS.ptl));
180
encoder->m_reconfigureRc = false;
181
}
182
183
Encoder *encoder = static_cast<Encoder*>(enc);
184
int numEncoded;
185
186
+#ifdef SVT_HEVC
187
+ EB_ERRORTYPE return_error;
188
+ static unsigned char picSendDone = 0;
189
+ numEncoded = 0;
190
+ static int codedNal = 0, eofReached = 0;
191
+ EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)encoder->m_svtAppData->svtHevcParams;
192
+ if (encoder->m_param->bEnableSvtHevc)
193
+ {
194
+ if (pic_in)
195
+ {
196
+ if (pic_in->colorSpace == X265_CSP_I420) // SVT-HEVC supports only yuv420p color space
197
+ {
198
+ EB_BUFFERHEADERTYPE *inputPtr = encoder->m_svtAppData->inputPictureBuffer;
199
+
200
+ if (pic_in->framesize) inputPtr->nFilledLen = (uint32_t)pic_in->framesize;
201
x265_3.0.tar.gz/source/encoder/dpb.cpp -> x265_3.1.1.tar.gz/source/encoder/dpb.cpp
Changed
9
1
2
{
3
Slice* slice = newFrame->m_encData->m_slice;
4
slice->m_poc = newFrame->m_poc;
5
+ slice->m_fieldNum = newFrame->m_fieldNum;
6
7
int pocCurr = slice->m_poc;
8
int type = newFrame->m_lowres.sliceType;
9
x265_3.0.tar.gz/source/encoder/encoder.cpp -> x265_3.1.1.tar.gz/source/encoder/encoder.cpp
Changed
160
1
2
* TODO: come up an algorithm for adoptive threshold */
3
#define MVTHRESHOLD (10*10)
4
#define PU_2Nx2N 1
5
+#define MAX_CHROMA_QP_OFFSET 12
6
static const char* defaultAnalysisFileName = "x265_analysis.dat";
7
8
using namespace X265_NS;
9
10
m_cim = NULL;
11
#endif
12
13
+#if SVT_HEVC
14
+ m_svtAppData = NULL;
15
+#endif
16
+
17
m_prevTonemapPayload.payload = NULL;
18
m_startPoint = 0;
19
m_saveCTUSize = 0;
20
21
22
m_nalList.m_annexB = !!m_param->bAnnexB;
23
24
- m_emitCLLSEI = p->maxCLL || p->maxFALL || (p->dolbyProfile == 81);
25
-
26
if (m_param->naluFile)
27
{
28
m_naluFile = x265_fopen(m_param->naluFile, "r");
29
30
}
31
if (m_naluFile)
32
fclose(m_naluFile);
33
+
34
+#ifdef SVT_HEVC
35
+ X265_FREE(m_svtAppData);
36
+#endif
37
if (m_param)
38
{
39
if (m_param->csvfpt)
40
41
inFrame->m_pts = pic_in->pts;
42
inFrame->m_forceqp = pic_in->forceqp;
43
inFrame->m_param = (m_reconfigure || m_reconfigureRc) ? m_latestParam : m_param;
44
+ if (m_param->bField && m_param->interlaceMode)
45
+ inFrame->m_fieldNum = pic_in->fieldNum;
46
47
copyUserSEIMessages(inFrame, pic_in);
48
49
50
51
if (frameEnc->m_reconfigureRc && m_reconfigureRc)
52
{
53
- memcpy(m_param, m_latestParam, sizeof(x265_param));
54
+ x265_copy_params(m_param, m_latestParam);
55
m_rateControl->reconfigureRC();
56
m_reconfigureRc = false;
57
}
58
59
/* Safe to copy m_latestParam to Encoder::m_param, encoder reconfigure complete */
60
for (int frameEncId = 0; frameEncId < m_param->frameNumThreads; frameEncId++)
61
m_frameEncoder[frameEncId]->m_reconfigure = false;
62
- memcpy (m_param, m_latestParam, sizeof(x265_param));
63
+ x265_copy_params(m_param, m_latestParam);
64
m_reconfigure = false;
65
}
66
67
68
69
int Encoder::reconfigureParam(x265_param* encParam, x265_param* param)
70
{
71
- if (isReconfigureRc(encParam, param))
72
+ if (isReconfigureRc(encParam, param) && !param->rc.zonefileCount)
73
{
74
/* VBV can't be turned ON if it wasn't ON to begin with and can't be turned OFF if it was ON to begin with*/
75
if (param->rc.vbvMaxBitrate > 0 && param->rc.vbvBufferSize > 0 &&
76
77
78
if (m_param->bEmitHDRSEI)
79
{
80
- if (m_emitCLLSEI)
81
+ if (m_param->bEmitCLL)
82
{
83
SEIContentLightLevel cllsei;
84
cllsei.max_content_light_level = m_param->maxCLL;
85
86
p->bEnableRectInter = zone->bEnableRectInter;
87
p->maxNumMergeCand = zone->maxNumMergeCand;
88
p->bIntraInBFrames = zone->bIntraInBFrames;
89
- p->scalingLists = strdup(zone->scalingLists);
90
+ if(zone->scalingLists)
91
+ p->scalingLists = strdup(zone->scalingLists);
92
93
p->rc.aqMode = zone->rc.aqMode;
94
p->rc.aqStrength = zone->rc.aqStrength;
95
96
p->vui.matrixCoeffs = dovi[doviProfile].matrixCoeffs;
97
98
if (dovi[doviProfile].doviProfileId == 81)
99
- p->bEmitHDRSEI = 1;
100
+ p->bEmitHDRSEI = p->bEmitCLL = 1;
101
102
- if (dovi[doviProfile].doviProfileId == 50 && p->noiseReductionIntra && p->noiseReductionInter)
103
- p->crQpOffset = 4;
104
+ if (dovi[doviProfile].doviProfileId == 50)
105
+ p->crQpOffset = 3;
106
}
107
108
void Encoder::configure(x265_param *p)
109
110
/* In 444, chroma gets twice as much resolution, so halve quality when psy-rd is enabled */
111
if (p->internalCsp == X265_CSP_I444 && p->psyRd)
112
{
113
- p->cbQpOffset += 6;
114
- p->crQpOffset += 6;
115
+ if (!p->cbQpOffset && !p->crQpOffset)
116
+ {
117
+ p->cbQpOffset = MAX_CHROMA_QP_OFFSET / 2;
118
+ p->crQpOffset = MAX_CHROMA_QP_OFFSET / 2;
119
+ x265_log(p, X265_LOG_WARNING, "halving the quality when psy-rd is enabled for 444 input."
120
+ " Setting cbQpOffset = %d and crQpOffset = %d\n", p->cbQpOffset, p->crQpOffset);
121
+ }
122
}
123
124
if (p->bLossless)
125
126
if (p->dolbyProfile) // Default disabled.
127
configureDolbyVisionParams(p);
128
129
+ if (p->rc.zonefileCount && p->rc.zoneCount)
130
+ {
131
+ p->rc.zoneCount = 0;
132
+ x265_log(p, X265_LOG_WARNING, "Only zone or zonefile can be used. Enabling only zonefile\n");
133
+ }
134
+
135
if (m_param->rc.zonefileCount && p->bOpenGOP)
136
{
137
p->bOpenGOP = 0;
138
139
(analysis->interData)->refIdx[i][count + pu] = refIdx[i][d];
140
if (m_param->scaleFactor)
141
{
142
- mv[i][d].x *= (int16_t)m_param->scaleFactor;
143
- mv[i][d].y *= (int16_t)m_param->scaleFactor;
144
+ mv[i][d].x *= (int32_t)m_param->scaleFactor;
145
+ mv[i][d].y *= (int32_t)m_param->scaleFactor;
146
}
147
memcpy(&(analysis->interData)->mv[i][count + pu], &mv[i][d], sizeof(MV));
148
}
149
150
{
151
(analysis->interData)->mvpIdx[i][count + pu] = mvpIdx[i][d];
152
(analysis->interData)->refIdx[i][count + pu] = refIdx[i][d];
153
- mvCopy[i].x = mv[i][d].x * (int16_t)m_param->scaleFactor;
154
- mvCopy[i].y = mv[i][d].y * (int16_t)m_param->scaleFactor;
155
+ mvCopy[i].x = mv[i][d].x * (int32_t)m_param->scaleFactor;
156
+ mvCopy[i].y = mv[i][d].y * (int32_t)m_param->scaleFactor;
157
memcpy(&(analysis->interData)->mv[i][count + pu], &mvCopy[i], sizeof(MV));
158
}
159
}
160
x265_3.0.tar.gz/source/encoder/encoder.h -> x265_3.1.1.tar.gz/source/encoder/encoder.h
Changed
49
1
2
#include "x265.h"
3
#include "nal.h"
4
#include "framedata.h"
5
+#include "svt.h"
6
#ifdef ENABLE_HDR10_PLUS
7
#include "dynamicHDR10/hdr10plus.h"
8
#endif
9
10
11
class Entropy;
12
13
+#ifdef SVT_HEVC
14
+typedef struct SvtAppContext
15
+{
16
+ EB_COMPONENTTYPE* svtEncoderHandle;
17
+ EB_H265_ENC_CONFIGURATION* svtHevcParams;
18
+
19
+ // Buffer Pools
20
+ EB_BUFFERHEADERTYPE* inputPictureBuffer;
21
+ uint64_t byteCount;
22
+ uint64_t outFrameCount;
23
+
24
+}SvtAppContext;
25
+#endif
26
+
27
struct EncStats
28
{
29
double m_psnrSumY;
30
31
ScalingList m_scalingList; // quantization matrix information
32
Window m_conformanceWindow;
33
34
- bool m_emitCLLSEI;
35
bool m_bZeroLatency; // x265_encoder_encode() returns NALs for the input picture, zero lag
36
bool m_aborted; // fatal error detected
37
bool m_reconfigure; // Encoder reconfigure in progress
38
39
int m_numCimInfo;
40
#endif
41
42
+#ifdef SVT_HEVC
43
+ SvtAppContext* m_svtAppData;
44
+#endif
45
+
46
x265_sei_payload m_prevTonemapPayload;
47
48
/* Collect frame level feature data */
49
x265_3.0.tar.gz/source/encoder/frameencoder.cpp -> x265_3.1.1.tar.gz/source/encoder/frameencoder.cpp
Changed
42
1
2
3
if (vui->frameFieldInfoPresentFlag)
4
{
5
- if (m_param->interlaceMode == 2)
6
- sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom */;
7
- else if (m_param->interlaceMode == 1)
8
- sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top */;
9
+ if (m_param->interlaceMode > 0)
10
+ {
11
+ if( m_param->interlaceMode == 2 )
12
+ {
13
+ // m_picStruct should be set to 3 or 4 when field feature is enabled
14
+ if (m_param->bField)
15
+ // 3: Top field, bottom field, in that order; 4: Bottom field, top field, in that order
16
+ sei->m_picStruct = (slice->m_fieldNum == 1) ? 4 : 3;
17
+ else
18
+ sei->m_picStruct = (poc & 1) ? 1 /* top */ : 2 /* bottom */;
19
+ }
20
+ else if (m_param->interlaceMode == 1)
21
+ {
22
+ if (m_param->bField)
23
+ sei->m_picStruct = (slice->m_fieldNum == 1) ? 3: 4;
24
+ else
25
+ sei->m_picStruct = (poc & 1) ? 2 /* bottom */ : 1 /* top */;
26
+ }
27
+ }
28
else
29
sei->m_picStruct = m_param->pictureStructure;
30
31
32
}
33
34
// Initialize restrict on MV range in slices
35
- tld.analysis.m_sliceMinY = -(int16_t)(rowInSlice * m_param->maxCUSize * 4) + 3 * 4;
36
- tld.analysis.m_sliceMaxY = (int16_t)((endRowInSlicePlus1 - 1 - row) * (m_param->maxCUSize * 4) - 4 * 4);
37
+ tld.analysis.m_sliceMinY = -(int32_t)(rowInSlice * m_param->maxCUSize * 4) + 3 * 4;
38
+ tld.analysis.m_sliceMaxY = (int32_t)((endRowInSlicePlus1 - 1 - row) * (m_param->maxCUSize * 4) - 4 * 4);
39
40
// Handle single row slice
41
if (tld.analysis.m_sliceMaxY < tld.analysis.m_sliceMinY)
42
x265_3.0.tar.gz/source/encoder/level.cpp -> x265_3.1.1.tar.gz/source/encoder/level.cpp
Changed
31
1
2
#include "common.h"
3
#include "slice.h"
4
#include "level.h"
5
+#include "svt.h"
6
7
namespace X265_NS {
8
typedef struct
9
10
if (!param || !profile)
11
return 0;
12
13
+#ifdef SVT_HEVC
14
+ if (param->bEnableSvtHevc)
15
+ {
16
+ EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam;
17
+ if (!strcmp(profile, "main")) svtParam->profile = 1;
18
+ else if (!strcmp(profile, "main10")) svtParam->profile = 2;
19
+ else
20
+ {
21
+ x265_log(param, X265_LOG_ERROR, "SVT-HEVC encoder: Unsupported profile %s \n", profile);
22
+ return -1;
23
+ }
24
+ return 0;
25
+ }
26
+#endif
27
+
28
/* Check if profile bit-depth requirement is exceeded by internal bit depth */
29
bool bInvalidDepth = false;
30
#if X265_DEPTH > 8
31
x265_3.0.tar.gz/source/encoder/motion.cpp -> x265_3.1.1.tar.gz/source/encoder/motion.cpp
Changed
99
1
2
4 * 5
3
7
4
*/
5
- const int16_t top = omv.y - dist;
6
- const int16_t bottom = omv.y + dist;
7
- const int16_t left = omv.x - dist;
8
- const int16_t right = omv.x + dist;
9
+ const int32_t top = omv.y - dist;
10
+ const int32_t bottom = omv.y + dist;
11
+ const int32_t left = omv.x - dist;
12
+ const int32_t right = omv.x + dist;
13
14
if (top >= mvmin.y && left >= mvmin.x && right <= mvmax.x && bottom <= mvmax.y)
15
{
16
17
Points 2, 4, 5, 7 are dist
18
Points 1, 3, 6, 8 are dist>>1
19
*/
20
- const int16_t top = omv.y - dist;
21
- const int16_t bottom = omv.y + dist;
22
- const int16_t left = omv.x - dist;
23
- const int16_t right = omv.x + dist;
24
- const int16_t top2 = omv.y - (dist >> 1);
25
- const int16_t bottom2 = omv.y + (dist >> 1);
26
- const int16_t left2 = omv.x - (dist >> 1);
27
- const int16_t right2 = omv.x + (dist >> 1);
28
+ const int32_t top = omv.y - dist;
29
+ const int32_t bottom = omv.y + dist;
30
+ const int32_t left = omv.x - dist;
31
+ const int32_t right = omv.x + dist;
32
+ const int32_t top2 = omv.y - (dist >> 1);
33
+ const int32_t bottom2 = omv.y + (dist >> 1);
34
+ const int32_t left2 = omv.x - (dist >> 1);
35
+ const int32_t right2 = omv.x + (dist >> 1);
36
saved = bcost;
37
38
if (top >= mvmin.y && left >= mvmin.x &&
39
40
41
for (int16_t dist = 16; dist <= (int16_t)merange; dist <<= 1)
42
{
43
- const int16_t top = omv.y - dist;
44
- const int16_t bottom = omv.y + dist;
45
- const int16_t left = omv.x - dist;
46
- const int16_t right = omv.x + dist;
47
+ const int32_t top = omv.y - dist;
48
+ const int32_t bottom = omv.y + dist;
49
+ const int32_t left = omv.x - dist;
50
+ const int32_t right = omv.x + dist;
51
52
saved = bcost;
53
if (top >= mvmin.y && left >= mvmin.x &&
54
55
56
for (int16_t index = 1; index < 4; index++)
57
{
58
- int16_t posYT = top + ((dist >> 2) * index);
59
- int16_t posYB = bottom - ((dist >> 2) * index);
60
- int16_t posXL = omv.x - ((dist >> 2) * index);
61
- int16_t posXR = omv.x + ((dist >> 2) * index);
62
+ int32_t posYT = top + ((dist >> 2) * index);
63
+ int32_t posYB = bottom - ((dist >> 2) * index);
64
+ int32_t posXL = omv.x - ((dist >> 2) * index);
65
+ int32_t posXR = omv.x + ((dist >> 2) * index);
66
67
COST_MV_PT_DIST_X4(posXL, posYT, 0, dist,
68
posXR, posYT, 0, dist,
69
70
}
71
for (int16_t index = 1; index < 4; index++)
72
{
73
- int16_t posYT = top + ((dist >> 2) * index);
74
- int16_t posYB = bottom - ((dist >> 2) * index);
75
- int16_t posXL = omv.x - ((dist >> 2) * index);
76
- int16_t posXR = omv.x + ((dist >> 2) * index);
77
+ int32_t posYT = top + ((dist >> 2) * index);
78
+ int32_t posYB = bottom - ((dist >> 2) * index);
79
+ int32_t posXL = omv.x - ((dist >> 2) * index);
80
+ int32_t posXR = omv.x + ((dist >> 2) * index);
81
82
if (posYT >= mvmin.y) // check top
83
{
84
85
case X265_SEA:
86
{
87
// Successive Elimination Algorithm
88
- const int16_t minX = X265_MAX(omv.x - (int16_t)merange, mvmin.x);
89
- const int16_t minY = X265_MAX(omv.y - (int16_t)merange, mvmin.y);
90
- const int16_t maxX = X265_MIN(omv.x + (int16_t)merange, mvmax.x);
91
- const int16_t maxY = X265_MIN(omv.y + (int16_t)merange, mvmax.y);
92
+ const int32_t minX = X265_MAX(omv.x - (int32_t)merange, mvmin.x);
93
+ const int32_t minY = X265_MAX(omv.y - (int32_t)merange, mvmin.y);
94
+ const int32_t maxX = X265_MIN(omv.x + (int32_t)merange, mvmax.x);
95
+ const int32_t maxY = X265_MIN(omv.y + (int32_t)merange, mvmax.y);
96
const uint16_t *p_cost_mvx = m_cost_mvx - qmvp.x;
97
const uint16_t *p_cost_mvy = m_cost_mvy - qmvp.y;
98
int16_t* meScratchBuffer = NULL;
99
x265_3.0.tar.gz/source/encoder/ratecontrol.cpp -> x265_3.1.1.tar.gz/source/encoder/ratecontrol.cpp
Changed
46
1
2
}
3
rce->isActive = true;
4
rce->scenecut = false;
5
+ rce->isFadeEnd = curFrame->m_lowres.bIsFadeEnd;
6
bool isRefFrameScenecut = m_sliceType!= I_SLICE && m_curSlice->m_refFrameList[0][0]->m_lowres.bScenecut;
7
m_isFirstMiniGop = m_sliceType == I_SLICE ? true : m_isFirstMiniGop;
8
if (curFrame->m_lowres.bScenecut)
9
10
m_numBframesInPattern++;
11
}
12
}
13
+ if (rce->isFadeEnd)
14
+ m_isPatternPresent = true;
15
}
16
/* For a scenecut that occurs within the mini-gop, enable scene transition
17
* switch until the next mini-gop to ensure a min qp for all the frames within
18
19
double abrBuffer = 2 * m_rateTolerance * m_bitrate;
20
21
// Check if current Slice is a scene cut that follows low detailed/blank frames
22
- if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut)
23
+ if (rce->lastSatd > 4 * rce->movingAvgSum || rce->scenecut || rce->isFadeEnd)
24
{
25
if (!m_isAbrReset && rce->movingAvgSum > 0
26
&& (m_isPatternPresent || !m_param->bframes))
27
28
shrtTermTotalBitsSum += m_encodedBitsWindow[i];
29
double underflow = (shrtTermTotalBitsSum - shrtTermWantedBits) / abrBuffer;
30
const double epsilon = 0.0001f;
31
- if (underflow < epsilon && !isFrameDone)
32
+ if ((underflow < epsilon || rce->isFadeEnd) && !isFrameDone)
33
{
34
init(*m_curSlice->m_sps);
35
m_shortTermCplxSum = rce->lastSatd / (CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION);
36
37
X265_FREE(m_encOrder);
38
for (int i = 0; i < 2; i++)
39
X265_FREE(m_cuTreeStats.qpBuffer[i]);
40
-
41
- X265_FREE(m_param->rc.zones);
42
+
43
}
44
45
void RateControl::splitdeltaPOC(char deltapoc[], RateControlEntry *rce)
46
x265_3.0.tar.gz/source/encoder/ratecontrol.h -> x265_3.1.1.tar.gz/source/encoder/ratecontrol.h
Changed
9
1
2
HRDTiming *hrdTiming;
3
int rpsIdx;
4
RPS rpsData;
5
+ bool isFadeEnd;
6
};
7
8
class RateControl
9
x265_3.0.tar.gz/source/encoder/search.cpp -> x265_3.1.1.tar.gz/source/encoder/search.cpp
Changed
21
1
2
3
void Search::setSearchRange(const CUData& cu, const MV& mvp, int merange, MV& mvmin, MV& mvmax) const
4
{
5
- MV dist((int16_t)merange << 2, (int16_t)merange << 2);
6
+ MV dist((int32_t)merange << 2, (int32_t)merange << 2);
7
mvmin = mvp - dist;
8
mvmax = mvp + dist;
9
10
11
mvmax >>= 2;
12
13
/* conditional clipping for frame parallelism */
14
- mvmin.y = X265_MIN(mvmin.y, (int16_t)m_refLagPixels);
15
- mvmax.y = X265_MIN(mvmax.y, (int16_t)m_refLagPixels);
16
+ mvmin.y = X265_MIN(mvmin.y, (int32_t)m_refLagPixels);
17
+ mvmax.y = X265_MIN(mvmax.y, (int32_t)m_refLagPixels);
18
19
/* conditional clipping for negative mv range */
20
mvmax.y = X265_MAX(mvmax.y, mvmin.y);
21
x265_3.0.tar.gz/source/encoder/search.h -> x265_3.1.1.tar.gz/source/encoder/search.h
Changed
12
1
2
int32_t m_maxTUDepth;
3
uint16_t m_limitTU;
4
5
- int16_t m_sliceMaxY;
6
- int16_t m_sliceMinY;
7
+ int32_t m_sliceMaxY;
8
+ int32_t m_sliceMinY;
9
10
#if DETAILED_CU_STATS
11
/* Accumulate CU statistics separately for each frame encoder */
12
x265_3.0.tar.gz/source/encoder/slicetype.cpp -> x265_3.1.1.tar.gz/source/encoder/slicetype.cpp
Changed
134
1
2
}
3
}
4
5
- if (param->bDynamicRefine)
6
+ if (param->bDynamicRefine || param->bEnableFades)
7
{
8
- int blockXY = 0;
9
+ uint64_t blockXY = 0, rowVariance = 0;
10
+ curFrame->m_lowres.frameVariance = 0;
11
for (int blockY = 0; blockY < maxRow; blockY += loopIncr)
12
{
13
for (int blockX = 0; blockX < maxCol; blockX += loopIncr)
14
{
15
curFrame->m_lowres.blockVariance[blockXY] = acEnergyCu(curFrame, blockX, blockY, param->internalCsp, param->rc.qgSize);
16
+ rowVariance += curFrame->m_lowres.blockVariance[blockXY];
17
blockXY++;
18
}
19
+ curFrame->m_lowres.frameVariance += (rowVariance / maxCol);
20
}
21
+ curFrame->m_lowres.frameVariance /= maxRow;
22
}
23
}
24
25
26
m_8x8Width = ((m_param->sourceWidth / 2) + X265_LOWRES_CU_SIZE - 1) >> X265_LOWRES_CU_BITS;
27
m_cuCount = m_8x8Width * m_8x8Height;
28
m_8x8Blocks = m_8x8Width > 2 && m_8x8Height > 2 ? (m_cuCount + 4 - 2 * (m_8x8Width + m_8x8Height)) : m_cuCount;
29
+ m_isFadeIn = false;
30
+ m_fadeCount = 0;
31
+ m_fadeStart = -1;
32
33
/* Allow the strength to be adjusted via qcompress, since the two concepts
34
* are very similar. */
35
36
ProfileScopeEvent(prelookahead);
37
m_lock.release();
38
preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc);
39
- if (m_lookahead.m_bAdaptiveQuant)
40
+ if (m_lookahead.m_param->rc.bStatRead && m_lookahead.m_param->rc.cuTree && IS_REFERENCED(preFrame))
41
+ /* cu-tree offsets were read from stats file */;
42
+ else if (m_lookahead.m_bAdaptiveQuant)
43
tld.calcAdaptiveQuantFrame(preFrame, m_lookahead.m_param);
44
tld.lowresIntraEstimate(preFrame->m_lowres, m_lookahead.m_param->rc.qgSize);
45
preFrame->m_lowresInit = true;
46
47
void Lookahead::slicetypeDecide()
48
{
49
PreLookaheadGroup pre(*this);
50
-
51
Lowres* frames[X265_LOOKAHEAD_MAX + X265_BFRAME_MAX + 4];
52
Frame* list[X265_BFRAME_MAX + 4];
53
memset(frames, 0, sizeof(frames));
54
55
pre.waitForExit();
56
}
57
58
+ if(m_param->bEnableFades)
59
+ {
60
+ int j, endIndex = 0, length = X265_BFRAME_MAX + 4;
61
+ for (j = 0; j < length; j++)
62
+ m_frameVariance[j] = -1;
63
+ for (j = 0; list[j] != NULL; j++)
64
+ m_frameVariance[list[j]->m_poc % length] = list[j]->m_lowres.frameVariance;
65
+ for (int k = list[0]->m_poc % length; k <= list[j - 1]->m_poc % length; k++)
66
+ {
67
+ if (m_frameVariance[k] == -1)
68
+ break;
69
+ if((k > 0 && m_frameVariance[k] >= m_frameVariance[k - 1]) ||
70
+ (k == 0 && m_frameVariance[k] >= m_frameVariance[length - 1]))
71
+ {
72
+ m_isFadeIn = true;
73
+ if (m_fadeCount == 0 && m_fadeStart == -1)
74
+ {
75
+ for(int temp = list[0]->m_poc; temp <= list[j - 1]->m_poc; temp++)
76
+ if (k == temp % length) {
77
+ m_fadeStart = temp ? temp - 1 : 0;
78
+ break;
79
+ }
80
+ }
81
+ m_fadeCount = list[endIndex]->m_poc > m_fadeStart ? list[endIndex]->m_poc - m_fadeStart : 0;
82
+ endIndex++;
83
+ }
84
+ else
85
+ {
86
+ if (m_isFadeIn && m_fadeCount >= m_param->fpsNum / m_param->fpsDenom)
87
+ {
88
+ for (int temp = 0; list[temp] != NULL; temp++)
89
+ {
90
+ if (list[temp]->m_poc == m_fadeStart + (int)m_fadeCount)
91
+ {
92
+ list[temp]->m_lowres.bIsFadeEnd = true;
93
+ break;
94
+ }
95
+ }
96
+ }
97
+ m_isFadeIn = false;
98
+ m_fadeCount = 0;
99
+ m_fadeStart = -1;
100
+ }
101
+ if (k == length - 1)
102
+ k = -1;
103
+ }
104
+ }
105
+
106
if (m_lastNonB && !m_param->rc.bStatRead &&
107
((m_param->bFrameAdaptive && m_param->bframes) ||
108
m_param->rc.cuTree || m_param->scenecutThreshold ||
109
110
frm.sliceType = m_param->bOpenGOP && m_lastKeyframe >= 0 ? X265_TYPE_I : X265_TYPE_IDR;
111
}
112
}
113
+ if (frm.bIsFadeEnd){
114
+ frm.sliceType = m_param->bOpenGOP && m_lastKeyframe >= 0 ? X265_TYPE_I : X265_TYPE_IDR;
115
+ }
116
for (int i = 0; i < m_param->rc.zonefileCount; i++)
117
{
118
int curZoneStart = m_param->rc.zones[i].startFrame;
119
120
121
// TODO: restrict to slices boundaries
122
// establish search bounds that don't cross extended frame boundaries
123
- mvmin.x = (int16_t)(-cuX * cuSize - 8);
124
- mvmin.y = (int16_t)(-cuY * cuSize - 8);
125
- mvmax.x = (int16_t)((widthInCU - cuX - 1) * cuSize + 8);
126
- mvmax.y = (int16_t)((heightInCU - cuY - 1) * cuSize + 8);
127
+ mvmin.x = (int32_t)(-cuX * cuSize - 8);
128
+ mvmin.y = (int32_t)(-cuY * cuSize - 8);
129
+ mvmax.x = (int32_t)((widthInCU - cuX - 1) * cuSize + 8);
130
+ mvmax.y = (int32_t)((heightInCU - cuY - 1) * cuSize + 8);
131
132
for (int i = 0; i < 1 + bBidir; i++)
133
{
134
x265_3.0.tar.gz/source/encoder/slicetype.h -> x265_3.1.1.tar.gz/source/encoder/slicetype.h
Changed
12
1
2
bool m_isSceneTransition;
3
int m_numPools;
4
bool m_extendGopBoundary;
5
+ double m_frameVariance[X265_BFRAME_MAX + 4];
6
+ bool m_isFadeIn;
7
+ uint64_t m_fadeCount;
8
+ int m_fadeStart;
9
Lookahead(x265_param *param, ThreadPool *pool);
10
#if DETAILED_CU_STATS
11
int64_t m_slicetypeDecideElapsedTime;
12
x265_3.1.1.tar.gz/source/encoder/svt.h
Added
55
1
2
+/*****************************************************************************
3
+* Copyright (C) 2013-2018 MulticoreWare, Inc
4
+*
5
+* Authors: Radhakrishnan <radhakrishnan@multicorewareinc.com>
6
+*
7
+* This program is free software; you can redistribute it and/or modify
8
+* it under the terms of the GNU General Public License as published by
9
+* the Free Software Foundation; either version 2 of the License, or
10
+* (at your option) any later version.
11
+*
12
+* This program is distributed in the hope that it will be useful,
13
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+* GNU General Public License for more details.
16
+*
17
+* You should have received a copy of the GNU General Public License
18
+* along with this program; if not, write to the Free Software
19
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
20
+*
21
+* This program is also available under a commercial proprietary license.
22
+* For more information, contact us at license @ x265.com.
23
+*****************************************************************************/
24
+
25
+
26
+#ifndef SVT_H
27
+#define SVT_H
28
+
29
+#ifdef SVT_HEVC
30
+
31
+#include "EbApi.h"
32
+#include "EbErrorCodes.h"
33
+#include "EbTime.h"
34
+
35
+namespace X265_NS {
36
+
37
+#define INPUT_SIZE_576p_TH 0x90000 // 0.58 Million
38
+#define INPUT_SIZE_1080i_TH 0xB71B0 // 0.75 Million
39
+#define INPUT_SIZE_1080p_TH 0x1AB3F0 // 1.75 Million
40
+#define INPUT_SIZE_4K_TH 0x29F630 // 2.75 Million
41
+
42
+#define EB_OUTPUTSTREAMBUFFERSIZE_MACRO(ResolutionSize) ((ResolutionSize) < (INPUT_SIZE_1080i_TH) ? 0x1E8480 : (ResolutionSize) < (INPUT_SIZE_1080p_TH) ? 0x2DC6C0 : (ResolutionSize) < (INPUT_SIZE_4K_TH) ? 0x2DC6C0 : 0x2DC6C0)
43
+
44
+void svt_param_default(x265_param* param);
45
+int svt_set_preset_tune(x265_param* param, const char* preset, const char* tune);
46
+int svt_param_parse(x265_param* param, const char* name, const char* value);
47
+void svt_initialise_app_context(x265_encoder *enc);
48
+int svt_initialise_input_buffer(x265_encoder *enc);
49
+}
50
+
51
+#endif // ifdef SVT_HEVC
52
+
53
+#endif // ifndef SVT_H
54
\ No newline at end of file
55
x265_3.0.tar.gz/source/encoder/weightPrediction.cpp -> x265_3.1.1.tar.gz/source/encoder/weightPrediction.cpp
Changed
43
1
2
for (int y = 0; y < ref.lines; y += cuSize)
3
{
4
intptr_t pixoff = y * stride;
5
- mvmin.y = (int16_t)((-y - 8) * mvshift);
6
- mvmax.y = (int16_t)((ref.lines - y - 1 + 8) * mvshift);
7
+ mvmin.y = (int32_t)((-y - 8) * mvshift);
8
+ mvmax.y = (int32_t)((ref.lines - y - 1 + 8) * mvshift);
9
10
for (int x = 0; x < ref.width; x += cuSize, pixoff += cuSize, cu++)
11
{
12
ALIGN_VAR_16(pixel, buf8x8[8 * 8]);
13
intptr_t bstride = 8;
14
- mvmin.x = (int16_t)((-x - 8) * mvshift);
15
- mvmax.x = (int16_t)((ref.width - x - 1 + 8) * mvshift);
16
+ mvmin.x = (int32_t)((-x - 8) * mvshift);
17
+ mvmax.x = (int32_t)((ref.width - x - 1 + 8) * mvshift);
18
19
/* clip MV to available pixels */
20
MV mv = mvs[cu];
21
22
* into the lowres structures */
23
int cu = y * cache.lowresWidthInCU;
24
intptr_t pixoff = y * stride;
25
- mvmin.y = (int16_t)((-y - 8) * mvshift);
26
- mvmax.y = (int16_t)((height - y - 1 + 8) * mvshift);
27
+ mvmin.y = (int32_t)((-y - 8) * mvshift);
28
+ mvmax.y = (int32_t)((height - y - 1 + 8) * mvshift);
29
30
for (int x = 0; x < width; x += bw, cu++, pixoff += bw)
31
{
32
33
mv.y >>= cache.vshift;
34
35
/* clip MV to available pixels */
36
- mvmin.x = (int16_t)((-x - 8) * mvshift);
37
- mvmax.x = (int16_t)((width - x - 1 + 8) * mvshift);
38
+ mvmin.x = (int32_t)((-x - 8) * mvshift);
39
+ mvmax.x = (int32_t)((width - x - 1 + 8) * mvshift);
40
mv = mv.clipped(mvmin, mvmax);
41
42
intptr_t fpeloffset = (mv.y >> 2) * stride + (mv.x >> 2);
43
x265_3.0.tar.gz/source/test/pixelharness.cpp -> x265_3.1.1.tar.gz/source/test/pixelharness.cpp
Changed
126
1
2
return true;
3
}
4
5
+bool PixelHarness::check_ssimDist(ssimDistortion_t ref, ssimDistortion_t opt)
6
+{
7
+ uint32_t srcStride[5] = { 4, 8, 16, 32, 64 };
8
+ intptr_t dstStride[5] = { 4, 8, 16, 32, 64 };
9
+ int shift = X265_DEPTH - 8;
10
+ uint64_t opt_dest1 = 0, ref_dest1 = 0, opt_dest2 = 0, ref_dest2 = 0;
11
+ int j = 0;
12
+
13
+ for (int i = 0; i < ITERS; i++)
14
+ {
15
+ int index = i % TEST_CASES;
16
+ int k1 = rand() % 5, k2 = rand() % 5;
17
+ ref(pixel_test_buff[index] + j, srcStride[k1], pixel_test_buff[index + 10] + j, dstStride[k2], &ref_dest1, shift, &ref_dest2);
18
+ opt(pixel_test_buff[index] + j, srcStride[k1], pixel_test_buff[index + 10] + j, dstStride[k2], &opt_dest1, shift, &opt_dest2);
19
+
20
+ if (opt_dest1 != ref_dest1 && opt_dest2 != ref_dest2)
21
+ {
22
+ return false;
23
+ }
24
+
25
+ reportfail()
26
+ j += INCR;
27
+ }
28
+ return true;
29
+}
30
+
31
+bool PixelHarness::check_normFact(normFactor_t ref, normFactor_t opt, int block)
32
+{
33
+ int shift = X265_DEPTH - 8;
34
+ uint64_t opt_dest = 0, ref_dest = 0;
35
+ int j = 0;
36
+ int blockSize = 4 << block;
37
+
38
+ for (int i = 0; i < ITERS; i++)
39
+ {
40
+ int index = i % TEST_CASES;
41
+ ref(pixel_test_buff[index] + j, blockSize, shift, &ref_dest);
42
+ opt(pixel_test_buff[index] + j, blockSize, shift, &opt_dest);
43
+
44
+ if (opt_dest != ref_dest)
45
+ {
46
+ return false;
47
+ }
48
+
49
+ reportfail()
50
+ j += INCR;
51
+ }
52
+ return true;
53
+}
54
+
55
bool PixelHarness::testPU(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
56
{
57
if (opt.pu[part].satd)
58
59
}
60
}
61
62
+ if (opt.cu[i].ssimDist)
63
+ {
64
+ if (!check_ssimDist(ref.cu[i].ssimDist, opt.cu[i].ssimDist))
65
+ {
66
+ printf("\nssimDist[%dx%d] failed!\n", 4 << i, 4 << i);
67
+ return false;
68
+ }
69
+ }
70
+
71
if (i < BLOCK_64x64)
72
{
73
/* TU only primitives */
74
75
return false;
76
}
77
}
78
+
79
+ for (int i = BLOCK_8x8; i < NUM_CU_SIZES; i++)
80
+ {
81
+ if (opt.cu[i].normFact)
82
+ {
83
+ if (!check_normFact(ref.cu[i].normFact, opt.cu[i].normFact, i))
84
+ {
85
+ printf("\nnormFact[%dx%d] failed!\n", 4 << i, 4 << i);
86
+ return false;
87
+ }
88
+ }
89
+ }
90
+
91
return true;
92
}
93
94
95
HEADER("psy_cost_pp[%dx%d]", 4 << i, 4 << i);
96
REPORT_SPEEDUP(opt.cu[i].psy_cost_pp, ref.cu[i].psy_cost_pp, pbuf1, STRIDE, pbuf2, STRIDE);
97
}
98
+
99
+ if (opt.cu[i].ssimDist)
100
+ {
101
+ uint64_t dst1 = 0, dst2 = 0;
102
+ int shift = X265_DEPTH - 8;
103
+ printf("ssimDist[%dx%d]", 4 << i, 4 << i);
104
+ REPORT_SPEEDUP(opt.cu[i].ssimDist, ref.cu[i].ssimDist, pixel_test_buff[0], 32, pixel_test_buff[5], 64, &dst1, shift, &dst2);
105
+ }
106
}
107
108
if (opt.weight_pp)
109
110
REPORT_SPEEDUP(opt.integral_inith[k], ref.integral_inith[k], dst_buf, pbuf1, STRIDE);
111
}
112
}
113
+
114
+ for (int i = BLOCK_8x8; i < NUM_CU_SIZES; i++)
115
+ {
116
+ if (opt.cu[i].normFact)
117
+ {
118
+ uint64_t dst = 0;
119
+ int blockSize = 4 << i;
120
+ int shift = X265_DEPTH - 8;
121
+ printf("normFact[%dx%d]", blockSize, blockSize);
122
+ REPORT_SPEEDUP(opt.cu[i].normFact, ref.cu[i].normFact, pixel_test_buff[0], blockSize, shift, &dst);
123
+ }
124
+ }
125
}
126
x265_3.0.tar.gz/source/test/pixelharness.h -> x265_3.1.1.tar.gz/source/test/pixelharness.h
Changed
10
1
2
bool check_pelFilterChroma_H(pelFilterChroma_t ref, pelFilterChroma_t opt);
3
bool check_integral_initv(integralv_t ref, integralv_t opt);
4
bool check_integral_inith(integralh_t ref, integralh_t opt);
5
+ bool check_ssimDist(ssimDistortion_t ref, ssimDistortion_t opt);
6
+ bool check_normFact(normFactor_t ref, normFactor_t opt, int block);
7
8
public:
9
10
x265_3.0.tar.gz/source/test/regression-tests.txt -> x265_3.1.1.tar.gz/source/test/regression-tests.txt
Changed
17
1
2
ParkScene_1920x1080_24.y4m,--preset medium --qp 40 --rdpenalty 2 --tu-intra-depth 3
3
ParkScene_1920x1080_24.y4m,--preset medium --pme --tskip-fast --tskip --min-keyint 48 --weightb --limit-refs 3
4
ParkScene_1920x1080_24.y4m,--preset slower --no-weightp
5
+ParkScene_1920x1080_24.y4m,--tune grain --aq-motion
6
RaceHorses_416x240_30.y4m,--preset superfast --no-cutree
7
RaceHorses_416x240_30.y4m,--preset medium --tskip-fast --tskip
8
RaceHorses_416x240_30.y4m,--preset slower --keyint -1 --rdoq-level 0 --limit-tu 2
9
10
Kimono1_1920x1080_24_400.yuv,--preset placebo --ctu 32 --max-tu-size 8 --limit-tu 2
11
big_buck_bunny_360p24.y4m, --keyint 60 --min-keyint 40 --gop-lookahead 14
12
BasketballDrive_1920x1080_50.y4m, --preset medium --no-open-gop --keyint 50 --min-keyint 50 --radl 2 --vbv-maxrate 5000 --vbv-bufsize 5000
13
+big_buck_bunny_360p24.y4m, --bitrate 500 --fades
14
15
# Main12 intraCost overflow bug test
16
720p50_parkrun_ter.y4m,--preset medium
17
x265_3.0.tar.gz/source/x265.cpp -> x265_3.1.1.tar.gz/source/x265.cpp
Changed
201
1
2
#include "input/input.h"
3
#include "output/output.h"
4
#include "output/reconplay.h"
5
+#include "svt.h"
6
7
#if HAVE_VLD
8
/* Visual Leak Detector */
9
10
const char *preset = NULL;
11
const char *tune = NULL;
12
const char *profile = NULL;
13
+ int svtEnabled = 0;
14
15
if (argc <= 1)
16
{
17
18
/* Presets are applied before all other options. */
19
for (optind = 0;; )
20
{
21
- int c = getopt_long(argc, argv, short_options, long_options, NULL);
22
+ int optionsIndex = -1;
23
+ int c = getopt_long(argc, argv, short_options, long_options, &optionsIndex);
24
if (c == -1)
25
break;
26
else if (c == 'p')
27
28
profile = optarg;
29
else if (c == '?')
30
bShowHelp = true;
31
+ else if (!c && !strcmp(long_options[optionsIndex].name, "svt"))
32
+ svtEnabled = 1;
33
}
34
35
if (!outputBitDepth && profile)
36
37
showHelp(param);
38
}
39
40
+ //Set enable SVT-HEVC encoder first if found in the command line
41
+ if (svtEnabled) api->param_parse(param, "svt", NULL);
42
+
43
for (optind = 0;; )
44
{
45
int long_options_index = -1;
46
47
OPT("tune") /* handled above */;
48
OPT("output-depth") /* handled above */;
49
OPT("recon-y4m-exec") reconPlayCmd = optarg;
50
+ OPT("svt") /* handled above */;
51
OPT("qpfile")
52
{
53
this->qpfile = x265_fopen(optarg, "rb");
54
55
return true;
56
}
57
58
+#ifdef SVT_HEVC
59
+ if (svtEnabled)
60
+ {
61
+ EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam;
62
+ param->sourceWidth = svtParam->sourceWidth;
63
+ param->sourceHeight = svtParam->sourceHeight;
64
+ param->fpsNum = svtParam->frameRateNumerator;
65
+ param->fpsDenom = svtParam->frameRateDenominator;
66
+ svtParam->encoderBitDepth = inputBitDepth;
67
+ }
68
+#endif
69
+
70
InputFileInfo info;
71
info.filename = inputfn;
72
info.depth = inputBitDepth;
73
74
if (this->framesToBeEncoded == 0 && info.frameCount > (int)seek)
75
this->framesToBeEncoded = info.frameCount - seek;
76
param->totalFrames = this->framesToBeEncoded;
77
+
78
+#ifdef SVT_HEVC
79
+ if (svtEnabled)
80
+ {
81
+ EB_H265_ENC_CONFIGURATION* svtParam = (EB_H265_ENC_CONFIGURATION*)param->svtHevcParam;
82
+ svtParam->sourceWidth = param->sourceWidth;
83
+ svtParam->sourceHeight = param->sourceHeight;
84
+ svtParam->frameRateNumerator = param->fpsNum;
85
+ svtParam->frameRateDenominator = param->fpsDenom;
86
+ svtParam->framesToBeEncoded = param->totalFrames;
87
+ svtParam->encoderColorFormat = (EB_COLOR_FORMAT)param->internalCsp;
88
+ }
89
+#endif
90
91
/* Force CFR until we have support for VFR */
92
info.timebaseNum = param->fpsDenom;
93
info.timebaseDenom = param->fpsNum;
94
95
+ if (param->bField && param->interlaceMode)
96
+ { // Field FPS
97
+ param->fpsNum *= 2;
98
+ // Field height
99
+ param->sourceHeight = param->sourceHeight >> 1;
100
+ // Number of fields to encode
101
+ param->totalFrames *= 2;
102
+ }
103
+
104
if (api->param_apply_profile(param, profile))
105
return true;
106
107
108
uint32_t nal;
109
int16_t *errorBuf = NULL;
110
bool bDolbyVisionRPU = false;
111
+ uint8_t *rpuPayload = NULL;
112
int ret = 0;
113
+ int inputPicNum = 1;
114
+ x265_picture picField1, picField2;
115
116
-
117
- if (!param->bRepeatHeaders)
118
+ if (!param->bRepeatHeaders && !param->bEnableSvtHevc)
119
{
120
if (api->encoder_headers(encoder, &p_nal, &nal) < 0)
121
{
122
123
cliopt.totalbytes += cliopt.output->writeHeaders(p_nal, nal);
124
}
125
126
- api->picture_init(param, pic_in);
127
+ if (param->bField && param->interlaceMode)
128
+ {
129
+ api->picture_init(param, &picField1);
130
+ api->picture_init(param, &picField2);
131
+ // return back the original height of input
132
+ param->sourceHeight *= 2;
133
+ api->picture_init(param, pic_in);
134
+ }
135
+ else
136
+ api->picture_init(param, pic_in);
137
138
if (param->dolbyProfile && cliopt.dolbyVisionRpu)
139
{
140
- pic_in->rpu.payload = X265_MALLOC(uint8_t, 1024);
141
+ rpuPayload = X265_MALLOC(uint8_t, 1024);
142
+ pic_in->rpu.payload = rpuPayload;
143
if (pic_in->rpu.payload)
144
bDolbyVisionRPU = true;
145
}
146
147
// main encoder loop
148
while (pic_in && !b_ctrl_c)
149
{
150
- pic_orig.poc = inFrameCount;
151
+ pic_orig.poc = (param->bField && param->interlaceMode) ? inFrameCount * 2 : inFrameCount;
152
if (cliopt.qpfile)
153
{
154
if (!cliopt.parseQPFile(pic_orig))
155
156
/* Overwrite PTS */
157
pic_in->pts = pic_in->poc;
158
159
+ // convert to field
160
+ if (param->bField && param->interlaceMode)
161
+ {
162
+ int height = pic_in->height >> 1;
163
+
164
+ int static bCreated = 0;
165
+ if (bCreated == 0)
166
+ {
167
+ bCreated = 1;
168
+ inputPicNum = 2;
169
+ picField1.fieldNum = 1;
170
+ picField2.fieldNum = 2;
171
+
172
+ picField1.bitDepth = picField2.bitDepth = pic_in->bitDepth;
173
+ picField1.colorSpace = picField2.colorSpace = pic_in->colorSpace;
174
+ picField1.height = picField2.height = pic_in->height >> 1;
175
+ picField1.framesize = picField2.framesize = pic_in->framesize >> 1;
176
+
177
+ size_t fieldFrameSize = (size_t)pic_in->framesize >> 1;
178
+ char* field1Buf = X265_MALLOC(char, fieldFrameSize);
179
+ char* field2Buf = X265_MALLOC(char, fieldFrameSize);
180
+
181
+ int stride = picField1.stride[0] = picField2.stride[0] = pic_in->stride[0];
182
+ uint64_t framesize = stride * (height >> x265_cli_csps[pic_in->colorSpace].height[0]);
183
+ picField1.planes[0] = field1Buf;
184
+ picField2.planes[0] = field2Buf;
185
+ for (int i = 1; i < x265_cli_csps[pic_in->colorSpace].planes; i++)
186
+ {
187
+ picField1.planes[i] = field1Buf + framesize;
188
+ picField2.planes[i] = field2Buf + framesize;
189
+
190
+ stride = picField1.stride[i] = picField2.stride[i] = pic_in->stride[i];
191
+ framesize += (stride * (height >> x265_cli_csps[pic_in->colorSpace].height[i]));
192
+ }
193
+ assert(framesize == picField1.framesize);
194
+ }
195
+
196
+ picField1.pts = picField1.poc = pic_in->poc;
197
+ picField2.pts = picField2.poc = pic_in->poc + 1;
198
+
199
+ picField1.userSEI = picField2.userSEI = pic_in->userSEI;
200
+
201
x265_3.0.tar.gz/source/x265.h -> x265_3.1.1.tar.gz/source/x265.h
Changed
65
1
2
typedef struct x265_analysis_MV
3
{
4
union{
5
- struct { int16_t x, y; };
6
+ struct { int32_t x, y; };
7
8
- int32_t word;
9
+ int64_t word;
10
};
11
}x265_analysis_MV;
12
13
14
15
//Dolby Vision RPU metadata
16
x265_dolby_vision_rpu rpu;
17
+
18
+ int fieldNum;
19
} x265_picture;
20
21
typedef enum
22
23
* 0 - Disabled. 1 - Save/Load ctu distortion to/from the file specified
24
* analysis-save/load. Default 0. */
25
int ctuDistortionRefine;
26
+
27
+ /* Enable SVT HEVC Encoder */
28
+ int bEnableSvtHevc;
29
+
30
+ /* SVT-HEVC param structure. For internal use when SVT HEVC encoder is enabled */
31
+ void* svtHevcParam;
32
+
33
+ /* Detect fade-in regions. Enforces I-slice for the brightest point.
34
+ Re-init RC history at that point in ABR mode. Default is disabled. */
35
+ int bEnableFades;
36
+
37
+ /* Enable field coding */
38
+ int bField;
39
+
40
+ /*Emit content light level info SEI*/
41
+ int bEmitCLL;
42
} x265_param;
43
/* x265_param_alloc:
44
* Allocates an x265_param instance. The returned param structure is not
45
46
#define X265_PARAM_BAD_VALUE (-2)
47
int x265_param_parse(x265_param *p, const char *name, const char *value);
48
49
+x265_zone *x265_zone_alloc(int zoneCount, int isZoneFile);
50
+
51
+void x265_zone_free(x265_param *param);
52
+
53
int x265_zone_param_parse(x265_param* p, const char* name, const char* value);
54
55
static const char * const x265_profile_names[] = {
56
57
* 100 times faster than placebo!
58
*
59
* Currently available tunings are: */
60
-static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", 0 };
61
+static const char * const x265_tune_names[] = { "psnr", "ssim", "grain", "zerolatency", "fastdecode", "animation", 0 };
62
63
/* returns 0 on success, negative on failure (e.g. invalid preset/tune name). */
64
int x265_param_default_preset(x265_param *, const char *preset, const char *tune);
65
x265_3.0.tar.gz/source/x265cli.h -> x265_3.1.1.tar.gz/source/x265cli.h
Changed
92
1
2
{ "input-csp", required_argument, NULL, 0 },
3
{ "interlace", required_argument, NULL, 0 },
4
{ "no-interlace", no_argument, NULL, 0 },
5
+ { "field", no_argument, NULL, 0 },
6
+ { "no-field", no_argument, NULL, 0 },
7
{ "fps", required_argument, NULL, 0 },
8
{ "seek", required_argument, NULL, 0 },
9
{ "frame-skip", required_argument, NULL, 0 },
10
11
{ "scenecut", required_argument, NULL, 0 },
12
{ "no-scenecut", no_argument, NULL, 0 },
13
{ "scenecut-bias", required_argument, NULL, 0 },
14
+ { "fades", no_argument, NULL, 0 },
15
+ { "no-fades", no_argument, NULL, 0 },
16
{ "radl", required_argument, NULL, 0 },
17
{ "ctu-info", required_argument, NULL, 0 },
18
{ "intra-refresh", no_argument, NULL, 0 },
19
20
{ "hevc-aq", no_argument, NULL, 0 },
21
{ "no-hevc-aq", no_argument, NULL, 0 },
22
{ "qp-adaptation-range", required_argument, NULL, 0 },
23
+#ifdef SVT_HEVC
24
+ { "svt", no_argument, NULL, 0 },
25
+ { "no-svt", no_argument, NULL, 0 },
26
+ { "svt-hme", no_argument, NULL, 0 },
27
+ { "no-svt-hme", no_argument, NULL, 0 },
28
+ { "svt-search-width", required_argument, NULL, 0 },
29
+ { "svt-search-height", required_argument, NULL, 0 },
30
+ { "svt-compressed-ten-bit-format", no_argument, NULL, 0 },
31
+ { "no-svt-compressed-ten-bit-format", no_argument, NULL, 0 },
32
+ { "svt-speed-control", no_argument , NULL, 0 },
33
+ { "no-svt-speed-control", no_argument , NULL, 0 },
34
+ { "svt-preset-tuner", required_argument , NULL, 0 },
35
+ { "svt-hierarchical-level", required_argument , NULL, 0 },
36
+ { "svt-base-layer-switch-mode", required_argument , NULL, 0 },
37
+ { "svt-pred-struct", required_argument , NULL, 0 },
38
+ { "svt-fps-in-vps", no_argument , NULL, 0 },
39
+ { "no-svt-fps-in-vps", no_argument , NULL, 0 },
40
+#endif
41
+ { "cll", no_argument, NULL, 0 },
42
+ { "no-cll", no_argument, NULL, 0 },
43
{ 0, 0, 0, 0 },
44
{ 0, 0, 0, 0 },
45
{ 0, 0, 0, 0 },
46
47
H0("-f/--frames <integer> Maximum number of frames to encode. Default all\n");
48
H0(" --seek <integer> First frame to encode\n");
49
H1(" --[no-]interlace <bff|tff> Indicate input pictures are interlace fields in temporal order. Default progressive\n");
50
+ H0(" --[no-]field Enable or disable field coding. Default %s\n", OPT( param->bField));
51
H1(" --dither Enable dither if downscaling to 8 bit pixels. Default disabled\n");
52
H0(" --[no-]copy-pic Copy buffers of input picture in frame. Default %s\n", OPT(param->bCopyPicToFrame));
53
H0("\nQuality reporting metrics:\n");
54
55
H0(" --no-scenecut Disable adaptive I-frame decision\n");
56
H0(" --scenecut <integer> How aggressively to insert extra I-frames. Default %d\n", param->scenecutThreshold);
57
H1(" --scenecut-bias <0..100.0> Bias for scenecut detection. Default %.2f\n", param->scenecutBias);
58
+ H0(" --[no-]fades Enable detection and handling of fade-in regions. Default %s\n", OPT(param->bEnableFades));
59
H0(" --radl <integer> Number of RADL pictures allowed in front of IDR. Default %d\n", param->radl);
60
H0(" --intra-refresh Use Periodic Intra Refresh instead of IDR frames\n");
61
H0(" --rc-lookahead <integer> Number of frames for frame-type lookahead (determines encoder latency) Default %d\n", param->lookaheadDepth);
62
63
H1(" --chromaloc <integer> Specify chroma sample location (0 to 5). Default of %d\n", param->vui.chromaSampleLocTypeTopField);
64
H0(" --master-display <string> SMPTE ST 2086 master display color volume info SEI (HDR)\n");
65
H0(" format: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\n");
66
- H0(" --max-cll <string> Emit content light level info SEI as \"cll,fall\" (HDR)\n");
67
+ H0(" --max-cll <string> Specify content light level info SEI as \"cll,fall\" (HDR).\n");
68
+ H0(" --[no-]cll Emit content light level info SEI. Default %s\n", OPT(param->bEmitCLL));
69
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));
70
H0(" --[no-]hdr-opt Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt));
71
H0(" --min-luma <integer> Minimum luma plane value of input source picture\n");
72
73
H1(" --recon-depth <integer> Bit-depth of reconstructed raw image file. Defaults to input bit depth, or 8 if Y4M\n");
74
H1(" --recon-y4m-exec <string> pipe reconstructed frames to Y4M viewer, ex:\"ffplay -i pipe:0 -autoexit\"\n");
75
H0(" --lowpass-dct Use low-pass subband dct approximation. Default %s\n", OPT(param->bLowPassDct));
76
+#ifdef SVT_HEVC
77
+ H0(" --[no]svt Enable SVT HEVC encoder %s\n", OPT(param->bEnableSvtHevc));
78
+ H0(" --[no-]svt-hme Enable Hierarchial motion estimation(HME) in SVT HEVC encoder \n");
79
+ H0(" --svt-search-width Motion estimation search area width for SVT HEVC encoder \n");
80
+ H0(" --svt-search-height Motion estimation search area height for SVT HEVC encoder \n");
81
+ H0(" --[no-]svt-compressed-ten-bit-format Enable 8+2 encoding mode for 10bit input in SVT HEVC encoder \n");
82
+ H0(" --[no-]svt-speed-control Enable speed control functionality to achieve real time encoding speed for SVT HEVC encoder \n");
83
+ H0(" --svt-preset-tuner Enable additional faster presets of SVT; This only has to be used on top of x265's ultrafast preset. Accepts values in the range of 0-2 \n");
84
+ H0(" --svt-hierarchical-level Hierarchical layer for SVT-HEVC encoder; Accepts inputs in the range 0-3 \n");
85
+ H0(" --svt-base-layer-switch-mode Select whether B/P slice should be used in base layer for SVT-HEVC encoder. 0-Use B-frames; 1-Use P frames in the base layer \n");
86
+ H0(" --svt-pred-struct Select pred structure for SVT HEVC encoder; Accepts inputs in the range 0-2 \n");
87
+ H0(" --[no-]svt-fps-in-vps Enable VPS timing info for SVT HEVC encoder \n");
88
+#endif
89
H1("\nExecutable return codes:\n");
90
H1(" 0 - encode successful\n");
91
H1(" 1 - unable to parse command line\n");
92