FFmpeg
Loading...
Searching...
No Matches
cfhdencdsp.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015-2016 Kieran Kunhya <kieran@kunhya.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
22#include "libavutil/common.h"
23
24#include "cfhdencdsp.h"
25
26static av_always_inline void filter(const int16_t *input, ptrdiff_t in_stride,
27 int16_t *low, ptrdiff_t low_stride,
28 int16_t *high, ptrdiff_t high_stride,
29 int len)
30{
31 low[(0>>1) * low_stride] = av_clip_int16(input[0*in_stride] + input[1*in_stride]);
32 high[(0>>1) * high_stride] = av_clip_int16((5 * input[0*in_stride] - 11 * input[1*in_stride] +
33 4 * input[2*in_stride] + 4 * input[3*in_stride] -
34 1 * input[4*in_stride] - 1 * input[5*in_stride] + 4) >> 3);
35
36 for (int i = 2; i < len - 2; i += 2) {
37 low[(i>>1) * low_stride] = av_clip_int16(input[i*in_stride] + input[(i+1)*in_stride]);
38 high[(i>>1) * high_stride] = av_clip_int16(((-input[(i-2)*in_stride] - input[(i-1)*in_stride] +
39 input[(i+2)*in_stride] + input[(i+3)*in_stride] + 4) >> 3) +
40 input[(i+0)*in_stride] - input[(i+1)*in_stride]);
41 }
42
43 low[((len-2)>>1) * low_stride] = av_clip_int16(input[((len-2)+0)*in_stride] + input[((len-2)+1)*in_stride]);
44 high[((len-2)>>1) * high_stride] = av_clip_int16((11* input[((len-2)+0)*in_stride] - 5 * input[((len-2)+1)*in_stride] -
45 4 * input[((len-2)-1)*in_stride] - 4 * input[((len-2)-2)*in_stride] +
46 1 * input[((len-2)-3)*in_stride] + 1 * input[((len-2)-4)*in_stride] + 4) >> 3);
47}
48
49static void horiz_filter(const int16_t *input, int16_t *low, int16_t *high,
50 ptrdiff_t in_stride, ptrdiff_t low_stride,
51 ptrdiff_t high_stride,
52 int width, int height)
53{
54 for (int i = 0; i < height; i++) {
55 filter(input, 1, low, 1, high, 1, width);
56 input += in_stride;
57 low += low_stride;
58 high += high_stride;
59 }
60}
61
62static void vert_filter(const int16_t *input, int16_t *low, int16_t *high,
63 ptrdiff_t in_stride, ptrdiff_t low_stride,
64 ptrdiff_t high_stride,
65 int width, int height)
66{
67 for (int i = 0; i < width; i++)
68 filter(&input[i], in_stride, &low[i], low_stride, &high[i], high_stride, height);
69}
70
72{
73 c->horiz_filter = horiz_filter;
74 c->vert_filter = vert_filter;
75
76#if ARCH_X86 && HAVE_X86ASM
78#endif
79}
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
static void horiz_filter(int16_t *output, ptrdiff_t ostride, const int16_t *low, ptrdiff_t lstride, const int16_t *high, ptrdiff_t hstride, int width, int height)
Definition cfhddsp.c:80
static void vert_filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int width, int height)
Definition cfhddsp.c:67
av_cold void ff_cfhdencdsp_init(CFHDEncDSPContext *c)
Definition cfhdencdsp.c:71
static void vert_filter(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height)
Definition cfhdencdsp.c:62
static void horiz_filter(const int16_t *input, int16_t *low, int16_t *high, ptrdiff_t in_stride, ptrdiff_t low_stride, ptrdiff_t high_stride, int width, int height)
Definition cfhdencdsp.c:49
void ff_cfhdencdsp_init_x86(CFHDEncDSPContext *c)
common internal and external API header
#define av_clip_int16
Definition common.h:115
int high
Definition dovi_rpuenc.c:39
Macro definitions for various function/variable attributes.
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
int len
static double c[64]