FFmpeg
rgb2rgb.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <stdint.h>
20 
21 #include "config.h"
22 #include "libavutil/attributes.h"
23 #include "libavutil/aarch64/cpu.h"
24 #include "libavutil/cpu.h"
25 #include "libavutil/bswap.h"
26 #include "libswscale/rgb2rgb.h"
27 #include "libswscale/swscale.h"
29 
30 // Only handle width aligned to 16
31 void ff_rgb24toyv12_neon(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
32  uint8_t *vdst, int width, int height, int lumStride,
33  int chromStride, int srcStride, const int32_t *rgb2yuv);
34 
35 static void rgb24toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
36  uint8_t *vdst, int width, int height, int lumStride,
37  int chromStride, int srcStride, const int32_t *rgb2yuv)
38 {
39  int width_align = width & (~15);
40 
41  if (width_align > 0)
42  ff_rgb24toyv12_neon(src, ydst, udst, vdst, width_align, height,
43  lumStride, chromStride, srcStride, rgb2yuv);
44  if (width_align < width) {
45  src += width_align * 3;
46  ydst += width_align;
47  udst += width_align / 2;
48  vdst += width_align / 2;
49  ff_rgb24toyv12_c(src, ydst, udst, vdst, width - width_align, height,
50  lumStride, chromStride, srcStride, rgb2yuv);
51  }
52 }
53 
54 void ff_interleave_bytes_neon(const uint8_t *src1, const uint8_t *src2,
55  uint8_t *dest, int width, int height,
56  int src1Stride, int src2Stride, int dstStride);
57 void ff_deinterleave_bytes_neon(const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
58  int width, int height, int srcStride,
59  int dst1Stride, int dst2Stride);
60 
62 {
64 
65  if (have_neon(cpu_flags)) {
69  }
70 }
ff_interleave_bytes_neon
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)
src1
const pixel * src1
Definition: h264pred_template.c:421
ff_rgb24toyv12_neon
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, const int32_t *rgb2yuv)
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:69
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:107
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:56
ff_deinterleave_bytes_neon
void ff_deinterleave_bytes_neon(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
av_cold
#define av_cold
Definition: attributes.h:90
interleaveBytes
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb.c:92
rgb2rgb_init_aarch64
av_cold void rgb2rgb_init_aarch64(void)
Definition: rgb2rgb.c:61
height
#define height
Definition: dsp.h:85
cpu.h
have_neon
#define have_neon(flags)
Definition: cpu.h:26
attributes.h
ff_rgb24toyv12
void(* ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, const int32_t *rgb2yuv)
Height should be a multiple of 2 and width should be a multiple of 2.
Definition: rgb2rgb.c:85
src2
const pixel * src2
Definition: h264pred_template.c:422
swscale_internal.h
bswap.h
deinterleaveBytes
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
Definition: rgb2rgb.c:95
int32_t
int32_t
Definition: audioconvert.c:56
ff_rgb24toyv12_c
void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, const int32_t *rgb2yuv)
width should be a multiple of 2.
Definition: rgb2rgb_template.c:650
rgb24toyv12
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, const int32_t *rgb2yuv)
Definition: rgb2rgb.c:35
width
#define width
Definition: dsp.h:85
cpu.h
rgb2rgb.h
src
#define src
Definition: vp8dsp.c:248
swscale.h