@@ -39,15 +39,27 @@ namespace H264Sharp {
3939 numThreads);
4040 return ;
4141 #elif defined(__aarch64__)
42- if (Converter::EnableNEON>0 )
43- Yuv2Rgb::ConvertYUVToRGB_NEON (
44- y_ptr,
45- u_ptr,
46- v_ptr,
47- dst_ptr,
48- width,
49- height);
50- else
42+ if (Converter::EnableNEON > 0 ) {
43+ if (numThreads>1 )
44+ Yuv2Rgb::ConvertYUVToRGB_NEON_Parallel (
45+ y_ptr,
46+ u_ptr,
47+ v_ptr,
48+ dst_ptr,
49+ width,
50+ height, numThreads);
51+ else
52+ Yuv2Rgb::ConvertYUVToRGB_NEON (
53+ y_ptr,
54+ u_ptr,
55+ v_ptr,
56+ dst_ptr,
57+ width,
58+ height);
59+ }
60+
61+ else
62+ {
5163 Yuv2Rgb::Yuv420P2RGBDefault (dst_ptr,
5264 y_ptr,
5365 u_ptr,
@@ -58,6 +70,8 @@ namespace H264Sharp {
5870 uv_span,
5971 dst_span,
6072 numThreads);
73+ }
74+
6175 #else
6276 Yuv2Rgb::Yuv420P2RGBDefault (dst_ptr,
6377 y_ptr,
@@ -121,6 +135,11 @@ namespace H264Sharp {
121135 void Converter::BGRAtoYUV420Planar (const unsigned char * bgra, unsigned char * dst, const int width, const int height, const int stride)
122136 {
123137 int numThreads = Converter::NumThreads;
138+
139+ #if defined(__aarch64__)
140+ Rgb2Yuv::BGRAtoYUV420PlanarNeon (bgra, dst, width, height, stride, numThreads);
141+
142+ #else
124143 if (width * height > minSize)
125144 {
126145 Rgb2Yuv::BGRAtoYUV420Planar (bgra, dst, width, height, stride, numThreads);
@@ -129,11 +148,17 @@ namespace H264Sharp {
129148 {
130149 Rgb2Yuv::BGRAtoYUV420Planar (bgra, dst, width, height, stride, 1 );
131150 }
151+ #endif
132152 }
133153
134154 void Converter::RGBAtoYUV420Planar (unsigned char * bgra, unsigned char * dst, int width, int height, int stride)
135155 {
136156 int numThreads = Converter::NumThreads;
157+
158+ #if defined(__aarch64__)
159+ Rgb2Yuv::RGBAtoYUV420PlanarNeon (bgra, dst, width, height, stride, numThreads);
160+
161+ #else
137162 if (width * height > minSize)
138163 {
139164 Rgb2Yuv::RGBAtoYUV420Planar (bgra, dst, width, height, stride, numThreads);
@@ -142,12 +167,19 @@ namespace H264Sharp {
142167 {
143168 Rgb2Yuv::RGBAtoYUV420Planar (bgra, dst, width, height, stride, 1 );
144169 }
170+ #endif
171+
145172
146173 }
147174
148175 void Converter::BGRtoYUV420Planar (unsigned char * bgra, unsigned char * dst, int width, int height, int stride)
149176 {
150177 int numThreads = Converter::NumThreads;
178+
179+ #if defined(__aarch64__)
180+ Rgb2Yuv::BGRtoYUV420PlanarNeon (bgra, dst, width, height, stride, numThreads);
181+
182+ #else
151183 if (width * height > minSize)
152184 {
153185 Rgb2Yuv::BGRtoYUV420Planar (bgra, dst, width, height, stride, numThreads);
@@ -156,11 +188,18 @@ namespace H264Sharp {
156188 {
157189 Rgb2Yuv::BGRtoYUV420Planar (bgra, dst, width, height, stride, 1 );
158190 }
191+ #endif
192+
159193 }
160194
161195 void Converter::RGBtoYUV420Planar (unsigned char * bgra, unsigned char * dst, int width, int height, int stride)
162196 {
163197 int numThreads = Converter::NumThreads;
198+
199+ #if defined(__aarch64__)
200+ Rgb2Yuv::RGBtoYUV420PlanarNeon (bgra, dst, width, height, stride, numThreads);
201+
202+ #else
164203 if (width * height > minSize)
165204 {
166205 Rgb2Yuv::RGBtoYUV420Planar (bgra, dst, width, height, stride, numThreads);
@@ -169,6 +208,7 @@ namespace H264Sharp {
169208 {
170209 Rgb2Yuv::RGBtoYUV420Planar (bgra, dst, width, height, stride, 1 );
171210 }
211+ #endif
172212
173213 }
174214
0 commit comments