]> git.sesse.net Git - ffmpeg/blob - libavfilter/colorspacedsp.h
Merge commit 'c2a4ca944d9029a3c162f8f3ddd317b83a7bd600'
[ffmpeg] / libavfilter / colorspacedsp.h
1 /*
2  * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVFILTER_COLORSPACEDSP_H
22 #define AVFILTER_COLORSPACEDSP_H
23
24 #include <stddef.h>
25 #include <stdint.h>
26
27 typedef void (*yuv2rgb_fn)(int16_t *rgb[3], ptrdiff_t rgb_stride,
28                            uint8_t *yuv[3], ptrdiff_t yuv_stride[3],
29                            int w, int h, const int16_t yuv2rgb_coeffs[3][3][8],
30                            const int16_t yuv_offset[8]);
31 typedef void (*rgb2yuv_fn)(uint8_t *yuv[3], ptrdiff_t yuv_stride[3],
32                            int16_t *rgb[3], ptrdiff_t rgb_stride,
33                            int w, int h, const int16_t rgb2yuv_coeffs[3][3][8],
34                            const int16_t yuv_offset[8]);
35 typedef void (*yuv2yuv_fn)(uint8_t *yuv_out[3], ptrdiff_t yuv_out_stride[3],
36                            uint8_t *yuv_in[3], ptrdiff_t yuv_in_stride[3],
37                            int w, int h, const int16_t yuv2yuv_coeffs[3][3][8],
38                            const int16_t yuv_offset[2][8]);
39
40 typedef struct ColorSpaceDSPContext {
41     yuv2rgb_fn yuv2rgb[3 /* 0: 8bit, 1: 10bit, 2: 12bit */][3 /* 0: 444, 1: 422, 2: 420 */];
42     rgb2yuv_fn rgb2yuv[3 /* 0: 8bit, 1: 10bit, 2: 12bit */][3 /* 0: 444, 1: 422, 2: 420 */];
43     yuv2yuv_fn yuv2yuv[3 /* in_depth */][3 /* out_depth */][3 /* 0: 444, 1: 422, 2: 420 */];
44
45     void (*multiply3x3)(int16_t *data[3], ptrdiff_t stride,
46                         int w, int h, const int16_t m[3][3][8]);
47 } ColorSpaceDSPContext;
48
49 void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp);
50
51 /* internal */
52 void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp);
53
54 #endif /* AVFILTER_COLORSPACEDSP_H */