1 /*
2 * V210 encoder DSP init
3 *
4 * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
5 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef AVCODEC_V210ENC_INIT_H
25 #define AVCODEC_V210ENC_INIT_H
26
27 #include <stddef.h>
28 #include <stdint.h>
29
30 #include "config.h"
35
36 #define CLIP(v, depth) av_clip(v, 1<<(depth-8), ((1<<depth)-(1<<(depth-8))-1))
37 #define WRITE_PIXELS(a, b, c, depth) \
38 do { \
39 val = CLIP(*a++, depth) << (10-depth); \
40 val |= (CLIP(*b++, depth) << (20-depth)) | \
41 (CLIP(*c++, depth) << (30-depth)); \
42 AV_WL32(dst, val); \
43 dst += 4; \
44 } while (0)
45
47 const uint8_t *v, uint8_t *
dst,
49 {
51
52 /* unroll this to match the assembly */
53 for (
int i = 0;
i <
width - 11;
i += 12) {
62 }
63 }
64
66 const uint16_t *v, uint8_t *
dst,
68 {
70
71 for (
int i = 0;
i <
width - 5;
i += 6) {
76 }
77 }
78
80 {
83 s->sample_factor_8 = 2;
84 s->sample_factor_10 = 1;
85
86 #if ARCH_X86
88 #endif
89 }
90
91 #endif /* AVCODEC_V210ENC_INIT_H */