FFmpeg
utvideodsp.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 "utvideodsp.h"
24 
25 static void restore_rgb_planes_c(uint8_t *src_r,
26  uint8_t *src_g,
27  uint8_t *src_b,
28  ptrdiff_t linesize_r,
29  ptrdiff_t linesize_g,
30  ptrdiff_t linesize_b,
31  int width, int height)
32 {
33  uint8_t r, g, b;
34  int i, j;
35 
36  for (j = 0; j < height; j++) {
37  for (i = 0; i < width; i++) {
38  r = src_r[i];
39  g = src_g[i];
40  b = src_b[i];
41  src_r[i] = r + g - 0x80;
42  src_b[i] = b + g - 0x80;
43  }
44  src_r += linesize_r;
45  src_g += linesize_g;
46  src_b += linesize_b;
47  }
48 }
49 
50 static void restore_rgb_planes10_c(uint16_t *src_r,
51  uint16_t *src_g,
52  uint16_t *src_b,
53  ptrdiff_t linesize_r,
54  ptrdiff_t linesize_g,
55  ptrdiff_t linesize_b,
56  int width, int height)
57 {
58  int r, g, b;
59  int i, j;
60 
61  for (j = 0; j < height; j++) {
62  for (i = 0; i < width; i++) {
63  r = src_r[i];
64  g = src_g[i];
65  b = src_b[i];
66  src_r[i] = (r + g - 0x200) & 0x3FF;
67  src_b[i] = (b + g - 0x200) & 0x3FF;
68  }
69  src_r += linesize_r;
70  src_g += linesize_g;
71  src_b += linesize_b;
72  }
73 }
74 
76 {
79 
80  if (ARCH_X86)
82 }
const char * g
Definition: vf_curves.c:115
void(* restore_rgb_planes10)(uint16_t *src_r, uint16_t *src_g, uint16_t *src_b, ptrdiff_t linesize_r, ptrdiff_t linesize_g, ptrdiff_t linesize_b, int width, int height)
Definition: utvideodsp.h:31
Macro definitions for various function/variable attributes.
static void restore_rgb_planes_c(uint8_t *src_r, uint8_t *src_g, uint8_t *src_b, ptrdiff_t linesize_r, ptrdiff_t linesize_g, ptrdiff_t linesize_b, int width, int height)
Definition: utvideodsp.c:25
av_cold void ff_utvideodsp_init(UTVideoDSPContext *c)
Definition: utvideodsp.c:75
uint8_t
#define av_cold
Definition: attributes.h:82
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
static void restore_rgb_planes10_c(uint16_t *src_r, uint16_t *src_g, uint16_t *src_b, ptrdiff_t linesize_r, ptrdiff_t linesize_g, ptrdiff_t linesize_b, int width, int height)
Definition: utvideodsp.c:50
#define height
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
void ff_utvideodsp_init_x86(UTVideoDSPContext *c)
const char * r
Definition: vf_curves.c:114
void(* restore_rgb_planes)(uint8_t *src_r, uint8_t *src_g, uint8_t *src_b, ptrdiff_t linesize_r, ptrdiff_t linesize_g, ptrdiff_t linesize_b, int width, int height)
Definition: utvideodsp.h:28
#define b
Definition: input.c:41
#define width