@@ -27,9 +27,30 @@
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
+// Only handle width aligned to 16
void ff_rgb24toyv12_neon(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
uint8_t *vdst, int width, int height, int lumStride,
int chromStride, int srcStride, int32_t *rgb2yuv);
+
+static void rgb24toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
+ uint8_t *vdst, int width, int height, int lumStride,
+ int chromStride, int srcStride, int32_t *rgb2yuv)
+{
+ int width_align = width & (~15);
+
+ if (width_align > 0)
+ ff_rgb24toyv12_neon(src, ydst, udst, vdst, width_align, height,
+ lumStride, chromStride, srcStride, rgb2yuv);
+ if (width_align < width) {
+ src += width_align * 3;
+ ydst += width_align;
+ udst += width_align / 2;
+ vdst += width_align / 2;
+ ff_rgb24toyv12_c(src, ydst, udst, vdst, width - width_align, height,
+ lumStride, chromStride, srcStride, rgb2yuv);
+ }
+}
+
void ff_interleave_bytes_neon(const uint8_t *src1, const uint8_t *src2,
uint8_t *dest, int width, int height,
int src1Stride, int src2Stride, int dstStride);
@@ -42,7 +63,7 @@ av_cold void rgb2rgb_init_aarch64(void)
int cpu_flags = av_get_cpu_flags();
if (have_neon(cpu_flags)) {
- ff_rgb24toyv12 = ff_rgb24toyv12_neon;
+ ff_rgb24toyv12 = rgb24toyv12;
interleaveBytes = ff_interleave_bytes_neon;
deinterleaveBytes = ff_deinterleave_bytes_neon;
}
@@ -129,7 +129,7 @@ static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int a
static void check_rgb24toyv12(struct SwsContext *ctx)
{
- static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE};
+ static const int input_sizes[] = {2, 16, 128, 540, MAX_LINE_SIZE, -MAX_LINE_SIZE};
LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);