Debian Codegraph @

src/dsp/x86/film_grain_sse4.cc

raw symbols SCIP
1 // Copyright 2020 The libgav1 Authorscxx . . $ `<file>/src/dsp/x86/film_grain_sse4.cc`/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "src/dsp/film_grain.h"cxx . . $ `<file>/src/dsp/film_grain.h`/
16 #include "src/utils/cpu.h"cxx . . $ `<file>/src/utils/cpu.h`/
17
18 #if LIBGAV1_TARGETING_SSE4_1cxx . . $ `src/utils/cpu.h:70:9`!
19 #include <smmintrin.h>
20
21 #include <cassert>
22 #include <cstddef>
23 #include <cstdint>
24 #include <cstring>
25
26 #include "src/dsp/constants.h"cxx . . $ `<file>/src/dsp/constants.h`/
27 #include "src/dsp/dsp.h"cxx . . $ `<file>/src/dsp/dsp.h`/
28 #include "src/dsp/film_grain_common.h"cxx . . $ `<file>/src/dsp/film_grain_common.h`/
29 #include "src/dsp/x86/common_sse4.h"cxx . . $ `<file>/src/dsp/x86/common_sse4.h`/
30 #include "src/utils/array_2d.h"cxx . . $ `<file>/src/utils/array_2d.h`/
31 #include "src/utils/common.h"cxx . . $ `<file>/src/utils/common.h`/
32 #include "src/utils/compiler_attributes.h"cxx . . $ `<file>/src/utils/compiler_attributes.h`/
33 #include "src/utils/constants.h"cxx . . $ `<file>/src/utils/constants.h`/
34 #include "src/utils/types.h"cxx . . $ `<file>/src/utils/types.h`/
35
36 namespace libgav1cxx . . $ libgav1/ {
37 namespace dspcxx . . $ libgav1/dsp/ {
38 namespace film_graincxx . . $ libgav1/dsp/film_grain/ {
39 namespacecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ {
40
41 // Load 8 values from source, widening to int16_t intermediate value size.
42 // The function is overloaded for each type and bitdepth for simplicity.
43 inline __m128icxx . . $ __m128i# LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(efc19e62faa26e11).(const int8_tcxx . . $ int8_t#* src) {
44 return _mm_cvtepi8_epi16cxx . . $ _mm_cvtepi8_epi16(6fc8b38ef05139cf).(LoadLo8cxx . . $ libgav1/dsp/LoadLo8(7f771a116cc7c384).(src));
45 }
46
47 // Load 8 values from source, widening to int16_t intermediate value size.
48 inline __m128icxx . . $ __m128i# LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(8d7e582028d8d8e2).(const uint8_tcxx . . $ uint8_t#* src) {
49 return _mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(LoadLo8cxx . . $ libgav1/dsp/LoadLo8(7f771a116cc7c384).(src));
50 }
51
52 inline __m128icxx . . $ __m128i# LoadSourceMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSourceMsan(6c1266c0b0fc6577).(const uint8_tcxx . . $ uint8_t#* src, const int valid_range) {
53 return _mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(LoadLo8Msancxx . . $ libgav1/dsp/LoadLo8Msan(cfbeb0b52e028598).(src, 8 - valid_range));
54 }
55
56 // Store 8 values to dest, narrowing to uint8_t from int16_t intermediate value.
57 inline void StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(cc9760d4bc69d571).(uint8_tcxx . . $ uint8_t#* dest, const __m128icxx . . $ __m128i# data) {
58 StoreLo8cxx . . $ libgav1/dsp/StoreLo8(2e73c3cb7991893e).(dest, _mm_packus_epi16cxx . . $ _mm_packus_epi16(e79ab442e937dade).(data, data));
59 }
60
61 #if LIBGAV1_MAX_BITDEPTHcxx . . $ `<built-in>:490:9`! >= 10
62 // Load 8 values from source.
63 inline __m128icxx . . $ __m128i# LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(d0f3060d832d37ef).(const int16_tcxx . . $ int16_t#* src) { return LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(src); }
64
65 // Load 8 values from source.
66 inline __m128icxx . . $ __m128i# LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(const uint16_tcxx . . $ uint16_t#* src) { return LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(src); }
67
68 // Store 8 values to dest.
69 inline void StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(uint16_tcxx . . $ uint16_t#* dest, const __m128icxx . . $ __m128i# data) {
70 StoreUnaligned16cxx . . $ libgav1/dsp/StoreUnaligned16(2e73c3cb7991893e).(dest, data);
71 }
72 #endif // LIBGAV1_MAX_BITDEPTH >= 10
73
74 // For BlendNoiseWithImageChromaWithCfl, only |subsampling_x| is needed.
75 inline __m128icxx . . $ __m128i# GetAverageLumacxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLuma(6c1266c0b0fc6577).(const uint8_tcxx . . $ uint8_t#* const luma, int subsampling_x) {
76 if (subsampling_x != 0) {
77 const __m128icxx . . $ __m128i# src = LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(luma);
78
79 return RightShiftWithRounding_U16cxx . . $ libgav1/dsp/RightShiftWithRounding_U16(8c21f12da5b7f84d).(
80 _mm_hadd_epi16cxx . . $ _mm_hadd_epi16(e79ab442e937dade).(_mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(src),
81 _mm_unpackhi_epi8cxx . . $ _mm_unpackhi_epi8(e79ab442e937dade).(src, _mm_setzero_si128cxx . . $ _mm_setzero_si128(3e8ed594d480523e).())),
82 1);
83 }
84 return _mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(LoadLo8cxx . . $ libgav1/dsp/LoadLo8(7f771a116cc7c384).(luma));
85 }
86
87 inline __m128icxx . . $ __m128i# GetAverageLumaMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLumaMsan(6b0bbbe20dcee0bd).(const uint8_tcxx . . $ uint8_t#* const luma, int subsampling_x,
88 int valid_range) {
89 if (subsampling_x != 0) {
90 const __m128icxx . . $ __m128i# src = LoadUnaligned16Msancxx . . $ libgav1/dsp/LoadUnaligned16Msan(cfbeb0b52e028598).(luma, 16 - valid_range);
91
92 return RightShiftWithRounding_U16cxx . . $ libgav1/dsp/RightShiftWithRounding_U16(8c21f12da5b7f84d).(
93 _mm_hadd_epi16cxx . . $ _mm_hadd_epi16(e79ab442e937dade).(_mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(src),
94 _mm_unpackhi_epi8cxx . . $ _mm_unpackhi_epi8(e79ab442e937dade).(src, _mm_setzero_si128cxx . . $ _mm_setzero_si128(3e8ed594d480523e).())),
95 1);
96 }
97 return _mm_cvtepu8_epi16cxx . . $ _mm_cvtepu8_epi16(6fc8b38ef05139cf).(LoadLo8Msancxx . . $ libgav1/dsp/LoadLo8Msan(cfbeb0b52e028598).(luma, 8 - valid_range));
98 }
99
100 #if LIBGAV1_MAX_BITDEPTHcxx . . $ `<built-in>:490:9`! >= 10
101 // For BlendNoiseWithImageChromaWithCfl, only |subsampling_x| is needed.
102 inline __m128icxx . . $ __m128i# GetAverageLumacxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLuma(7d91efe52eaa9dc7).(const uint16_tcxx . . $ uint16_t#* const luma, int subsampling_x) {
103 if (subsampling_x != 0) {
104 return RightShiftWithRounding_U16cxx . . $ libgav1/dsp/RightShiftWithRounding_U16(8c21f12da5b7f84d).(
105 _mm_hadd_epi16cxx . . $ _mm_hadd_epi16(e79ab442e937dade).(LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(luma), LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(luma + 8)), 1);
106 }
107 return LoadUnaligned16cxx . . $ libgav1/dsp/LoadUnaligned16(7f771a116cc7c384).(luma);
108 }
109
110 inline __m128icxx . . $ __m128i# GetAverageLumaMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLumaMsan(44a02f5cbac74e26).(const uint16_tcxx . . $ uint16_t#* const luma, int subsampling_x,
111 int valid_range) {
112 if (subsampling_x != 0) {
113 return RightShiftWithRounding_U16cxx . . $ libgav1/dsp/RightShiftWithRounding_U16(8c21f12da5b7f84d).(
114 _mm_hadd_epi16cxx . . $ _mm_hadd_epi16(e79ab442e937dade).(
115 LoadUnaligned16Msancxx . . $ libgav1/dsp/LoadUnaligned16Msan(cfbeb0b52e028598).(luma, 16 - valid_range * sizeof(*luma)),
116 LoadUnaligned16Msancxx . . $ libgav1/dsp/LoadUnaligned16Msan(cfbeb0b52e028598).(luma + 8, 32 - valid_range * sizeof(*luma))),
117 1);
118 }
119 return LoadUnaligned16Msancxx . . $ libgav1/dsp/LoadUnaligned16Msan(cfbeb0b52e028598).(luma, 16 - valid_range * sizeof(*luma));
120 }
121 #endif // LIBGAV1_MAX_BITDEPTH >= 10
122
123 inline __m128icxx . . $ __m128i# Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(const __m128icxx . . $ __m128i# value, const __m128icxx . . $ __m128i# low,
124 const __m128icxx . . $ __m128i# high) {
125 const __m128icxx . . $ __m128i# clipped_to_ceiling = _mm_min_epi16cxx . . $ _mm_min_epi16(e79ab442e937dade).(high, value);
126 return _mm_max_epi16cxx . . $ _mm_max_epi16(e79ab442e937dade).(low, clipped_to_ceiling);
127 }
128
129 template <int bitdepth, typename Pixel>
130 inline __m128icxx . . $ __m128i# GetScalingFactorscxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetScalingFactors(e634b0d9e841338c).(const int16_tcxx . . $ int16_t#* scaling_lut,
131 const Pixel* source) {
132 alignas(16) int16_tcxx . . $ int16_t# start_vals[8];
133 static_assert(bitdepth <= kBitdepth10cxx . . $ libgav1/kBitdepth10.,
134 "SSE4 Film Grain is not yet implemented for 12bpp.");
135 for (int i = 0; i < 8; ++i) {
136 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(source[i] < kScalingLookupTableSize << (bitdepth - 2));
137 start_vals[i] = scaling_lut[source[i]];
138 }
139 return LoadAligned16cxx . . $ libgav1/dsp/LoadAligned16(7f771a116cc7c384).(start_vals);
140 }
141
142 // |scaling_shift| is in range [8,11].
143 template <int bitdepth>
144 inline __m128icxx . . $ __m128i# ScaleNoisecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ScaleNoise(f33f264612c2011b).(const __m128icxx . . $ __m128i# noise, const __m128icxx . . $ __m128i# scaling,
145 const __m128icxx . . $ __m128i# scaling_shift) {
146 const __m128icxx . . $ __m128i# shifted_scale_factors = _mm_sll_epi16cxx . . $ _mm_sll_epi16(e79ab442e937dade).(scaling, scaling_shift);
147 return _mm_mulhrs_epi16cxx . . $ _mm_mulhrs_epi16(e79ab442e937dade).(noise, shifted_scale_factors);
148 }
149
150 template <int bitdepth, typename GrainType, typename Pixel>
151 void BlendNoiseWithImageLuma_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageLuma_SSE4_1(ea558a15d13e8027).(
152 const void* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! noise_image_ptr, int min_value, int max_luma,
153 int scaling_shift, int width, int height, int start_height,
154 const int16_tcxx . . $ int16_t#* scaling_lut_y, const void* source_plane_y,
155 ptrdiff_t source_stride_y, void* dest_plane_y, ptrdiff_t dest_stride_y) {
156 const auto* noise_image =
157 static_cast<const Array2Dcxx . . $ libgav1/Array2D#<GrainType>*>(noise_image_ptr);
158 const auto* in_y_row = static_cast<const Pixel*>(source_plane_y);
159 source_stride_y /= sizeof(Pixel);
160 auto* out_y_row = static_cast<Pixel*>(dest_plane_y);
161 dest_stride_y /= sizeof(Pixel);
162 const __m128icxx . . $ __m128i# floor = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(min_value);
163 const __m128icxx . . $ __m128i# ceiling = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(max_luma);
164 const int safe_width = width & ~7;
165 const __m128icxx . . $ __m128i# derived_scaling_shift = _mm_cvtsi32_si128cxx . . $ _mm_cvtsi32_si128(5a61b7d581f996c2).(15 - scaling_shift);
166 int y = 0;
167 do {
168 int x = 0;
169 for (; x + 8 <= safe_width; x += 8) {
170 const __m128icxx . . $ __m128i# orig = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(&in_y_row[x]);
171 const __m128icxx . . $ __m128i# scaling =
172 GetScalingFactorscxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetScalingFactors(e634b0d9e841338c).<bitdepth, Pixel>(scaling_lut_y, &in_y_row[x]);
173 __m128icxx . . $ __m128i# noise = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(&(noise_image[kPlaneYcxx . . $ libgav1/kPlaneY.][y + start_height][x]));
174
175 noise = ScaleNoisecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ScaleNoise(f33f264612c2011b).<bitdepth>(noise, scaling, derived_scaling_shift);
176 const __m128icxx . . $ __m128i# combined = _mm_add_epi16cxx . . $ _mm_add_epi16(e79ab442e937dade).(orig, noise);
177 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(&out_y_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(combined, floor, ceiling));
178 }
179
180 if (x < width) {
181 Pixel luma_buffer[8];
182 // Prevent arbitrary indices from entering GetScalingFactors.
183 memset(luma_buffer, 0, sizeof(luma_buffer));
184 const int valid_range = width - x;
185 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(valid_range < 8);
186 memcpy(luma_buffer, &in_y_row[x], valid_range * sizeof(in_y_row[0]));
187 luma_buffer[valid_range] = in_y_row[width - 1];
188 const __m128icxx . . $ __m128i# orig = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(&in_y_row[x]);
189 const __m128icxx . . $ __m128i# scaling =
190 GetScalingFactorscxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetScalingFactors(e634b0d9e841338c).<bitdepth, Pixel>(scaling_lut_y, luma_buffer);
191 __m128icxx . . $ __m128i# noise = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(&(noise_image[kPlaneYcxx . . $ libgav1/kPlaneY.][y + start_height][x]));
192
193 noise = ScaleNoisecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ScaleNoise(f33f264612c2011b).<bitdepth>(noise, scaling, derived_scaling_shift);
194 const __m128icxx . . $ __m128i# combined = _mm_add_epi16cxx . . $ _mm_add_epi16(e79ab442e937dade).(orig, noise);
195 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(&out_y_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(combined, floor, ceiling));
196 }
197 in_y_row += source_stride_y;
198 out_y_row += dest_stride_y;
199 } while (++y < height);
200 out_y_row = static_cast<Pixel*>(dest_plane_y);
201 }
202
203 template <int bitdepth, typename GrainType, typename Pixel>
204 inline __m128icxx . . $ __m128i# BlendChromaValsWithCflcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsWithCfl(a3584f65af77d2b7).(
205 const Pixel* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! average_luma_buffer,
206 const int16_tcxx . . $ int16_t#* scaling_lut, const Pixel* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! chroma_cursor,
207 const GrainType* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! noise_image_cursor,
208 const __m128icxx . . $ __m128i# scaling_shift) {
209 const __m128icxx . . $ __m128i# scaling =
210 GetScalingFactorscxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetScalingFactors(e634b0d9e841338c).<bitdepth, Pixel>(scaling_lut, average_luma_buffer);
211 const __m128icxx . . $ __m128i# orig = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(chroma_cursor);
212 __m128icxx . . $ __m128i# noise = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(2ef3d58700b1a83).(noise_image_cursor);
213 noise = ScaleNoisecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ScaleNoise(f33f264612c2011b).<bitdepth>(noise, scaling, scaling_shift);
214 return _mm_add_epi16cxx . . $ _mm_add_epi16(e79ab442e937dade).(orig, noise);
215 }
216
217 template <int bitdepth, typename GrainType, typename Pixel>
218 LIBGAV1_ALWAYS_INLINEcxx . . $ `src/utils/compiler_attributes.h:94:9`! void BlendChromaPlaneWithCfl_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaPlaneWithCfl_SSE4_1(d071ef4aea7d5684).(
219 const Array2Dcxx . . $ libgav1/Array2D#<GrainType>& noise_image, int min_value, int max_chroma,
220 int width, int height, int start_height, int subsampling_x,
221 int subsampling_y, int scaling_shift, const int16_tcxx . . $ int16_t#* scaling_lut,
222 const Pixel* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! in_y_row, ptrdiff_t source_stride_y,
223 const Pixel* in_chroma_row, ptrdiff_t source_stride_chroma,
224 Pixel* out_chroma_row, ptrdiff_t dest_stride) {
225 const __m128icxx . . $ __m128i# floor = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(min_value);
226 const __m128icxx . . $ __m128i# ceiling = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(max_chroma);
227 alignas(16) Pixel luma_buffer[16];
228
229 const int chroma_height = (height + subsampling_y) >> subsampling_y;
230 const int chroma_width = (width + subsampling_x) >> subsampling_x;
231 // |chroma_width| is rounded up. If |width| is odd, then the final pixel will
232 // need to be guarded from overread, even if |chroma_width| is divisible by 8.
233 const int safe_chroma_width = (chroma_width - (width & 1)) & ~7;
234
235 // Writing to this buffer avoids the cost of doing 8 lane lookups in a row
236 // in GetScalingFactors.
237 Pixel average_luma_buffer[8];
238 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(start_height % 2 == 0);
239 start_height >>= subsampling_y;
240 const __m128icxx . . $ __m128i# derived_scaling_shift = _mm_cvtsi32_si128cxx . . $ _mm_cvtsi32_si128(5a61b7d581f996c2).(15 - scaling_shift);
241 int y = 0;
242 do {
243 int x = 0;
244 for (; x + 8 <= safe_chroma_width; x += 8) {
245 const int luma_x = x << subsampling_x;
246 const __m128icxx . . $ __m128i# average_luma =
247 GetAverageLumacxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLuma(7d91efe52eaa9dc7).(&in_y_row[luma_x], subsampling_x);
248 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(average_luma_buffer, average_luma);
249
250 const __m128icxx . . $ __m128i# blended =
251 BlendChromaValsWithCflcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsWithCfl(a3584f65af77d2b7).<bitdepth, GrainType, Pixel>(
252 average_luma_buffer, scaling_lut, &in_chroma_row[x],
253 &(noise_image[y + start_height][x]), derived_scaling_shift);
254 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(&out_chroma_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(blended, floor, ceiling));
255 }
256
257 if (x < chroma_width) {
258 // Prevent huge indices from entering GetScalingFactors due to
259 // uninitialized values. This is not a problem in 8bpp because the table
260 // is made larger than 255 values.
261 if (bitdepth > kBitdepth8cxx . . $ libgav1/kBitdepth8.) {
262 memset(luma_buffer, 0, sizeof(luma_buffer));
263 }
264 const int luma_x = x << subsampling_x;
265 const int valid_range = width - luma_x;
266 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(valid_range < 16);
267 memcpy(luma_buffer, &in_y_row[luma_x], valid_range * sizeof(in_y_row[0]));
268 luma_buffer[valid_range] = in_y_row[width - 1];
269 const __m128icxx . . $ __m128i# average_luma =
270 GetAverageLumaMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLumaMsan(44a02f5cbac74e26).(luma_buffer, subsampling_x, valid_range + 1);
271 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(average_luma_buffer, average_luma);
272
273 const __m128icxx . . $ __m128i# blended =
274 BlendChromaValsWithCflcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsWithCfl(a3584f65af77d2b7).<bitdepth, GrainType, Pixel>(
275 average_luma_buffer, scaling_lut, &in_chroma_row[x],
276 &(noise_image[y + start_height][x]), derived_scaling_shift);
277 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(9c4335cd27e0f109).(&out_chroma_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(blended, floor, ceiling));
278 }
279
280 in_y_row += source_stride_y << subsampling_y;
281 in_chroma_row += source_stride_chroma;
282 out_chroma_row += dest_stride;
283 } while (++y < chroma_height);
284 }
285
286 // This function is for the case params_.chroma_scaling_from_luma == true.
287 // This further implies that scaling_lut_u == scaling_lut_v == scaling_lut_y.
288 template <int bitdepth, typename GrainType, typename Pixel>
289 void BlendNoiseWithImageChromaWithCfl_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageChromaWithCfl_SSE4_1(bb9778083041b240).(
290 Planecxx . . $ libgav1/Plane# plane, const FilmGrainParamscxx . . $ libgav1/FilmGrainParams#& params,
291 const void* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! noise_image_ptr, int min_value, int max_chroma,
292 int width, int height, int start_height, int subsampling_x,
293 int subsampling_y, const int16_tcxx . . $ int16_t#* scaling_lut,
294 const void* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! source_plane_y, ptrdiff_t source_stride_y,
295 const void* source_plane_uv, ptrdiff_t source_stride_uv,
296 void* dest_plane_uv, ptrdiff_t dest_stride_uv) {
297 const auto* noise_image =
298 static_cast<const Array2Dcxx . . $ libgav1/Array2D#<GrainType>*>(noise_image_ptr);
299 const auto* in_y = static_cast<const Pixel*>(source_plane_y);
300 source_stride_y /= sizeof(Pixel);
301
302 const auto* in_uv = static_cast<const Pixel*>(source_plane_uv);
303 source_stride_uv /= sizeof(Pixel);
304 auto* out_uv = static_cast<Pixel*>(dest_plane_uv);
305 dest_stride_uv /= sizeof(Pixel);
306 BlendChromaPlaneWithCfl_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaPlaneWithCfl_SSE4_1(d071ef4aea7d5684).<bitdepth, GrainType, Pixel>(
307 noise_image[plane], min_value, max_chroma, width, height, start_height,
308 subsampling_x, subsampling_y, params.chroma_scalingcxx . . $ libgav1/FilmGrainParams#chroma_scaling., scaling_lut, in_y,
309 source_stride_y, in_uv, source_stride_uv, out_uv, dest_stride_uv);
310 }
311
312 } // namespace
313
314 namespace low_bitdepthcxx . . $ libgav1/dsp/film_grain/low_bitdepth/ {
315 namespacecxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ {
316
317 // |offset| is 32x4 packed to add with the result of _mm_madd_epi16.
318 inline __m128icxx . . $ __m128i# BlendChromaValsNoCfl8bppcxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsNoCfl8bpp(dc38f0df8f087eee).(
319 const int16_tcxx . . $ int16_t#* scaling_lut, const __m128icxx . . $ __m128i#& orig,
320 const int8_tcxx . . $ int8_t#* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! noise_image_cursor,
321 const __m128icxx . . $ __m128i#& average_luma, const __m128icxx . . $ __m128i#& scaling_shift,
322 const __m128icxx . . $ __m128i#& offset, const __m128icxx . . $ __m128i#& weights) {
323 uint8_tcxx . . $ uint8_t# merged_buffer[8];
324 const __m128icxx . . $ __m128i# combined_lo =
325 _mm_madd_epi16cxx . . $ _mm_madd_epi16(e79ab442e937dade).(_mm_unpacklo_epi16cxx . . $ _mm_unpacklo_epi16(e79ab442e937dade).(average_luma, orig), weights);
326 const __m128icxx . . $ __m128i# combined_hi =
327 _mm_madd_epi16cxx . . $ _mm_madd_epi16(e79ab442e937dade).(_mm_unpackhi_epi16cxx . . $ _mm_unpackhi_epi16(e79ab442e937dade).(average_luma, orig), weights);
328 const __m128icxx . . $ __m128i# merged_base = _mm_packs_epi32cxx . . $ _mm_packs_epi32(e79ab442e937dade).(_mm_srai_epi32cxx . . $ _mm_srai_epi32(8c21f12da5b7f84d).((combined_lo), 6),
329 _mm_srai_epi32cxx . . $ _mm_srai_epi32(8c21f12da5b7f84d).((combined_hi), 6));
330
331 const __m128icxx . . $ __m128i# merged = _mm_add_epi16cxx . . $ _mm_add_epi16(e79ab442e937dade).(merged_base, offset);
332
333 StoreLo8cxx . . $ libgav1/dsp/StoreLo8(2e73c3cb7991893e).(merged_buffer, _mm_packus_epi16cxx . . $ _mm_packus_epi16(e79ab442e937dade).(merged, merged));
334 const __m128icxx . . $ __m128i# scaling =
335 GetScalingFactorscxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetScalingFactors(e634b0d9e841338c).<kBitdepth8cxx . . $ libgav1/kBitdepth8., uint8_tcxx . . $ uint8_t#>(scaling_lut, merged_buffer);
336 __m128icxx . . $ __m128i# noise = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(efc19e62faa26e11).(noise_image_cursor);
337 noise = ScaleNoisecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ScaleNoise(f33f264612c2011b).<kBitdepth8cxx . . $ libgav1/kBitdepth8.>(noise, scaling, scaling_shift);
338 return _mm_add_epi16cxx . . $ _mm_add_epi16(e79ab442e937dade).(orig, noise);
339 }
340
341 LIBGAV1_ALWAYS_INLINEcxx . . $ `src/utils/compiler_attributes.h:94:9`! void BlendChromaPlane8bpp_SSE4_1cxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaPlane8bpp_SSE4_1(8359f783a0e52e65).(
342 const Array2Dcxx . . $ libgav1/Array2D#<int8_tcxx . . $ int8_t#>& noise_image, int min_value, int max_chroma,
343 int width, int height, int start_height, int subsampling_x,
344 int subsampling_y, int scaling_shift, int chroma_offset,
345 int chroma_multiplier, int luma_multiplier, const int16_tcxx . . $ int16_t#* scaling_lut,
346 const uint8_tcxx . . $ uint8_t#* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! in_y_row, ptrdiff_t source_stride_y,
347 const uint8_tcxx . . $ uint8_t#* in_chroma_row, ptrdiff_t source_stride_chroma,
348 uint8_tcxx . . $ uint8_t#* out_chroma_row, ptrdiff_t dest_stride) {
349 const __m128icxx . . $ __m128i# floor = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(min_value);
350 const __m128icxx . . $ __m128i# ceiling = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(max_chroma);
351
352 const int chroma_height = (height + subsampling_y) >> subsampling_y;
353 const int chroma_width = (width + subsampling_x) >> subsampling_x;
354 // |chroma_width| is rounded up. If |width| is odd, then the final luma pixel
355 // will need to be guarded from overread, even if |chroma_width| is a
356 // multiple of 8.
357 const int safe_chroma_width = (chroma_width - (width & 1)) & ~7;
358 alignas(16) uint8_tcxx . . $ uint8_t# luma_buffer[16];
359 const __m128icxx . . $ __m128i# offset = _mm_set1_epi16cxx . . $ _mm_set1_epi16(5130941c07634c37).(chroma_offset);
360 const __m128icxx . . $ __m128i# multipliers = _mm_set1_epi32cxx . . $ _mm_set1_epi32(5a61b7d581f996c2).(LeftShiftcxx . . $ libgav1/LeftShift(9b79fb6aee4c0440).(chroma_multiplier, 16) |
361 (luma_multiplier & 0xFFFF));
362 const __m128icxx . . $ __m128i# derived_scaling_shift = _mm_cvtsi32_si128cxx . . $ _mm_cvtsi32_si128(5a61b7d581f996c2).(15 - scaling_shift);
363
364 start_height >>= subsampling_y;
365 int y = 0;
366 do {
367 int x = 0;
368 for (; x + 8 <= safe_chroma_width; x += 8) {
369 const int luma_x = x << subsampling_x;
370 const __m128icxx . . $ __m128i# average_luma =
371 GetAverageLumacxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLuma(6c1266c0b0fc6577).(&in_y_row[luma_x], subsampling_x);
372 const __m128icxx . . $ __m128i# orig_chroma = LoadSourcecxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSource(8d7e582028d8d8e2).(&in_chroma_row[x]);
373 const __m128icxx . . $ __m128i# blended = BlendChromaValsNoCfl8bppcxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsNoCfl8bpp(dc38f0df8f087eee).(
374 scaling_lut, orig_chroma, &(noise_image[cxx . . $ libgav1/Array2D#`operator[]`(a8bee47fb301c1de).y + start_height][x]),
375 average_luma, derived_scaling_shift, offset, multipliers);
376 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(cc9760d4bc69d571).(&out_chroma_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(blended, floor, ceiling));
377 }
378
379 if (x < chroma_width) {
380 // Begin right edge iteration. Same as the normal iterations, but the
381 // |average_luma| computation requires a duplicated luma value at the
382 // end.
383 const int luma_x = x << subsampling_x;
384 const int valid_range = width - luma_x;
385 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(valid_range < 16);
386 // There is no need to pre-initialize this buffer, because merged values
387 // used as indices are saturated in the 8bpp case. Uninitialized values
388 // are written outside the frame.
389 memcpy(luma_buffer, &in_y_row[luma_x], valid_range * sizeof(in_y_row[0]));
390 luma_buffer[valid_range] = in_y_row[width - 1];
391 const int valid_range_chroma = chroma_width - x;
392 uint8_tcxx . . $ uint8_t# chroma_buffer[8];
393 memcpy(chroma_buffer, &in_chroma_row[x],
394 valid_range_chroma * sizeof(in_chroma_row[0]));
395
396 const __m128icxx . . $ __m128i# average_luma =
397 GetAverageLumaMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/GetAverageLumaMsan(6b0bbbe20dcee0bd).(luma_buffer, subsampling_x, valid_range + 1);
398 const __m128icxx . . $ __m128i# orig_chroma =
399 LoadSourceMsancxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/LoadSourceMsan(6c1266c0b0fc6577).(chroma_buffer, valid_range_chroma);
400 const __m128icxx . . $ __m128i# blended = BlendChromaValsNoCfl8bppcxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaValsNoCfl8bpp(dc38f0df8f087eee).(
401 scaling_lut, orig_chroma, &(noise_image[cxx . . $ libgav1/Array2D#`operator[]`(a8bee47fb301c1de).y + start_height][x]),
402 average_luma, derived_scaling_shift, offset, multipliers);
403 StoreUnsignedcxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/StoreUnsigned(cc9760d4bc69d571).(&out_chroma_row[x], Clip3cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Clip3(f33f264612c2011b).(blended, floor, ceiling));
404 // End of right edge iteration.
405 }
406
407 in_y_row += source_stride_y << subsampling_y;
408 in_chroma_row += source_stride_chroma;
409 out_chroma_row += dest_stride;
410 } while (++y < chroma_height);
411 }
412
413 // This function is for the case params_.chroma_scaling_from_luma == false.
414 void BlendNoiseWithImageChroma8bpp_SSE4_1cxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageChroma8bpp_SSE4_1(bb9778083041b240).(
415 Planecxx . . $ libgav1/Plane# plane, const FilmGrainParamscxx . . $ libgav1/FilmGrainParams#& params,
416 const void* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! noise_image_ptr, int min_value, int max_chroma,
417 int width, int height, int start_height, int subsampling_x,
418 int subsampling_y, const int16_tcxx . . $ int16_t#* scaling_lut,
419 const void* LIBGAV1_RESTRICTcxx . . $ `src/utils/common.h:58:9`! source_plane_y, ptrdiff_t source_stride_y,
420 const void* source_plane_uv, ptrdiff_t source_stride_uv,
421 void* dest_plane_uv, ptrdiff_t dest_stride_uv) {
422 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(plane == kPlaneU || plane == kPlaneV);
423 const auto* noise_image =
424 static_cast<const Array2Dcxx . . $ libgav1/Array2D#<int8_tcxx . . $ int8_t#>*>(noise_image_ptr);
425 const auto* in_y = static_cast<const uint8_tcxx . . $ uint8_t#*>(source_plane_y);
426 const auto* in_uv = static_cast<const uint8_tcxx . . $ uint8_t#*>(source_plane_uv);
427 auto* out_uv = static_cast<uint8_tcxx . . $ uint8_t#*>(dest_plane_uv);
428
429 const int offset = (plane == kPlaneUcxx . . $ libgav1/kPlaneU.) ? params.u_offsetcxx . . $ libgav1/FilmGrainParams#u_offset. : params.v_offsetcxx . . $ libgav1/FilmGrainParams#v_offset.;
430 const int luma_multiplier =
431 (plane == kPlaneUcxx . . $ libgav1/kPlaneU.) ? params.u_luma_multipliercxx . . $ libgav1/FilmGrainParams#u_luma_multiplier. : params.v_luma_multipliercxx . . $ libgav1/FilmGrainParams#v_luma_multiplier.;
432 const int multiplier =
433 (plane == kPlaneUcxx . . $ libgav1/kPlaneU.) ? params.u_multipliercxx . . $ libgav1/FilmGrainParams#u_multiplier. : params.v_multipliercxx . . $ libgav1/FilmGrainParams#v_multiplier.;
434 BlendChromaPlane8bpp_SSE4_1cxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendChromaPlane8bpp_SSE4_1(8359f783a0e52e65).(
435 noise_image[plane], min_value, max_chroma, width, height, start_height,
436 subsampling_x, subsampling_y, params.chroma_scalingcxx . . $ libgav1/FilmGrainParams#chroma_scaling., offset, multiplier,
437 luma_multiplier, scaling_lut, in_y, source_stride_y, in_uv,
438 source_stride_uv, out_uv, dest_stride_uv);
439 }
440
441 void Init8bppcxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Init8bpp(49f6e7a06ebc5aa8).() {
442 Dspcxx . . $ libgav1/dsp/Dsp#* const dsp = dsp_internalcxx . . $ libgav1/dsp_internal/::GetWritableDspTablecxx . . $ libgav1/dsp_internal/GetWritableDspTable(4a7f900f576901c3).(kBitdepth8cxx . . $ libgav1/kBitdepth8.);
443 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(dsp != nullptr);
444
445 dsp->film_graincxx . . $ libgav1/dsp/Dsp#film_grain..blend_noise_lumacxx . . $ libgav1/dsp/FilmGrainFuncs#blend_noise_luma. =
446 BlendNoiseWithImageLuma_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageLuma_SSE4_1(ea558a15d13e8027).<kBitdepth8cxx . . $ libgav1/kBitdepth8., int8_tcxx . . $ int8_t#, uint8_tcxx . . $ uint8_t#>;
447 dsp->film_graincxx . . $ libgav1/dsp/Dsp#film_grain..blend_noise_chromacxx . . $ libgav1/dsp/FilmGrainFuncs#blend_noise_chroma.[0] = BlendNoiseWithImageChroma8bpp_SSE4_1cxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageChroma8bpp_SSE4_1(bb9778083041b240).;
448 dsp->film_graincxx . . $ libgav1/dsp/Dsp#film_grain..blend_noise_chromacxx . . $ libgav1/dsp/FilmGrainFuncs#blend_noise_chroma.[1] =
449 BlendNoiseWithImageChromaWithCfl_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageChromaWithCfl_SSE4_1(bb9778083041b240).<kBitdepth8cxx . . $ libgav1/kBitdepth8., int8_tcxx . . $ int8_t#, uint8_tcxx . . $ uint8_t#>;
450 }
451
452 } // namespace
453 } // namespace low_bitdepth
454
455 #if LIBGAV1_MAX_BITDEPTHcxx . . $ `<built-in>:490:9`! >= 10
456 namespace high_bitdepthcxx . . $ libgav1/dsp/film_grain/high_bitdepth/ {
457 namespacecxx . . $ libgav1/dsp/film_grain/high_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/ {
458
459 void Init10bppcxx . . $ libgav1/dsp/film_grain/high_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Init10bpp(49f6e7a06ebc5aa8).() {
460 Dspcxx . . $ libgav1/dsp/Dsp#* const dsp = dsp_internalcxx . . $ libgav1/dsp_internal/::GetWritableDspTablecxx . . $ libgav1/dsp_internal/GetWritableDspTable(4a7f900f576901c3).(kBitdepth10cxx . . $ libgav1/kBitdepth10.);
461 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(dsp != nullptr);
462
463 dsp->film_graincxx . . $ libgav1/dsp/Dsp#film_grain..blend_noise_lumacxx . . $ libgav1/dsp/FilmGrainFuncs#blend_noise_luma. =
464 BlendNoiseWithImageLuma_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageLuma_SSE4_1(ea558a15d13e8027).<kBitdepth10cxx . . $ libgav1/kBitdepth10., int16_tcxx . . $ int16_t#, uint16_tcxx . . $ uint16_t#>;
465 dsp->film_graincxx . . $ libgav1/dsp/Dsp#film_grain..blend_noise_chromacxx . . $ libgav1/dsp/FilmGrainFuncs#blend_noise_chroma.[1] =
466 BlendNoiseWithImageChromaWithCfl_SSE4_1cxx . . $ libgav1/dsp/film_grain/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/BlendNoiseWithImageChromaWithCfl_SSE4_1(bb9778083041b240).<kBitdepth10cxx . . $ libgav1/kBitdepth10., int16_tcxx . . $ int16_t#, uint16_tcxx . . $ uint16_t#>;
467 }
468
469 } // namespace
470 } // namespace high_bitdepth
471 #endif // LIBGAV1_MAX_BITDEPTH >= 10
472
473 } // namespace film_grain
474
475 void FilmGrainInit_SSE4_1cxx . . $ libgav1/dsp/FilmGrainInit_SSE4_1(49f6e7a06ebc5aa8).() {
476 film_graincxx . . $ libgav1/dsp/film_grain/::low_bitdepthcxx . . $ libgav1/dsp/film_grain/low_bitdepth/::Init8bppcxx . . $ libgav1/dsp/film_grain/low_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Init8bpp(49f6e7a06ebc5aa8).();
477 #if LIBGAV1_MAX_BITDEPTHcxx . . $ `<built-in>:490:9`! >= 10
478 film_graincxx . . $ libgav1/dsp/film_grain/::high_bitdepthcxx . . $ libgav1/dsp/film_grain/high_bitdepth/::Init10bppcxx . . $ libgav1/dsp/film_grain/high_bitdepth/`$anonymous_namespace_src/dsp/x86/film_grain_sse4.cc`/Init10bpp(49f6e7a06ebc5aa8).();
479 #endif // LIBGAV1_MAX_BITDEPTH >= 10
480 }
481
482 } // namespace dsp
483 } // namespace libgav1
484
485 #else // !LIBGAV1_ENABLE_SSE4_1
486
487 namespace libgav1 {
488 namespace dsp {
489
490 void FilmGrainInit_SSE4_1() {}
491
492 } // namespace dsp
493 } // namespace libgav1
494 #endif // LIBGAV1_TARGETING_SSE4_1