FFmpeg
colorspacedsp.h
Go to the documentation of this file.
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], const 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], const 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 (*rgb2yuv_fsb_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3],
36  int16_t *rgb[3], ptrdiff_t rgb_stride,
37  int w, int h, const int16_t rgb2yuv_coeffs[3][3][8],
38  const int16_t yuv_offset[8],
39  int *rnd[3][2]);
40 typedef void (*yuv2yuv_fn)(uint8_t *yuv_out[3], const ptrdiff_t yuv_out_stride[3],
41  uint8_t *yuv_in[3], const ptrdiff_t yuv_in_stride[3],
42  int w, int h, const int16_t yuv2yuv_coeffs[3][3][8],
43  const int16_t yuv_offset[2][8]);
44 
50 };
51 
57 };
58 
59 typedef struct ColorSpaceDSPContext {
60  /* Convert input YUV pixel buffer from a user into an internal, 15bpp array
61  * of intermediate RGB data. */
63  /* Convert intermediate RGB data (15bpp, internal format) into YUV data and
64  * store into user-provided output buffer */
66  /* Same as rgb2yuv(), but use floyd-steinberg dithering */
68  /* Direct yuv-to-yuv conversion (input and output are both user-provided
69  * buffers) */
70  yuv2yuv_fn yuv2yuv[NB_BPP /* in */][NB_BPP /* out */][NB_SS];
71 
72  /* In-place 3x3 matrix multiplication. Input and output are both 15bpp
73  * (our internal data format) */
74  void (*multiply3x3)(int16_t *data[3], ptrdiff_t stride,
75  int w, int h, const int16_t m[3][3][8]);
77 
79 
80 /* internal */
82 
83 #endif /* AVFILTER_COLORSPACEDSP_H */
ColorSpaceDSPContext::yuv2yuv
yuv2yuv_fn yuv2yuv[NB_BPP][NB_BPP][NB_SS]
Definition: colorspacedsp.h:70
SS_444
@ SS_444
Definition: colorspacedsp.h:53
w
uint8_t w
Definition: llviddspenc.c:38
data
const char data[16]
Definition: mxf.c:143
ChromaSubsamplingIndex
ChromaSubsamplingIndex
Definition: colorspacedsp.h:52
rgb
Definition: rpzaenc.c:59
ff_colorspacedsp_x86_init
void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
Definition: colorspacedsp_init.c:79
NB_SS
@ NB_SS
Definition: colorspacedsp.h:56
rnd
#define rnd()
Definition: checkasm.h:115
BPP_10
@ BPP_10
Definition: colorspacedsp.h:47
ColorSpaceDSPContext::yuv2rgb
yuv2rgb_fn yuv2rgb[NB_BPP][NB_SS]
Definition: colorspacedsp.h:62
BPP_12
@ BPP_12
Definition: colorspacedsp.h:48
ColorSpaceDSPContext
Definition: colorspacedsp.h:59
ff_colorspacedsp_init
void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
Definition: colorspacedsp.c:102
BPP_8
@ BPP_8
Definition: colorspacedsp.h:46
SS_420
@ SS_420
Definition: colorspacedsp.h:55
SS_422
@ SS_422
Definition: colorspacedsp.h:54
ColorSpaceDSPContext::rgb2yuv_fsb
rgb2yuv_fsb_fn rgb2yuv_fsb[NB_BPP][NB_SS]
Definition: colorspacedsp.h:67
yuv2yuv_fn
void(* yuv2yuv_fn)(uint8_t *yuv_out[3], const ptrdiff_t yuv_out_stride[3], uint8_t *yuv_in[3], const ptrdiff_t yuv_in_stride[3], int w, int h, const int16_t yuv2yuv_coeffs[3][3][8], const int16_t yuv_offset[2][8])
Definition: colorspacedsp.h:40
ColorSpaceDSPContext::multiply3x3
void(* multiply3x3)(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
Definition: colorspacedsp.h:74
BitDepthIndex
BitDepthIndex
Definition: colorspacedsp.h:45
stride
#define stride
Definition: h264pred_template.c:537
ColorSpaceDSPContext::rgb2yuv
rgb2yuv_fn rgb2yuv[NB_BPP][NB_SS]
Definition: colorspacedsp.h:65
yuv2rgb_fn
void(* yuv2rgb_fn)(int16_t *rgb[3], ptrdiff_t rgb_stride, uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int w, int h, const int16_t yuv2rgb_coeffs[3][3][8], const int16_t yuv_offset[8])
Definition: colorspacedsp.h:27
rgb2yuv_fn
void(* rgb2yuv_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t rgb_stride, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
Definition: colorspacedsp.h:31
NB_BPP
@ NB_BPP
Definition: colorspacedsp.h:49
rgb2yuv_fsb_fn
void(* rgb2yuv_fsb_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t rgb_stride, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8], int *rnd[3][2])
Definition: colorspacedsp.h:35
h
h
Definition: vp9dsp_template.c:2038