FFmpeg
Loading...
Searching...
No Matches
diracdsp_init.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 David Conrad
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#include "libavutil/x86/cpu.h"
22#include "libavcodec/diracdsp.h"
23#include "fpel.h"
24
25void ff_add_rect_clamped_sse2(uint8_t *dst, const uint16_t *src, ptrdiff_t stride,
26 const int16_t *idwt, ptrdiff_t idwt_stride,
27 int width, int height);
28
29void ff_add_dirac_obmc8_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride,
30 const uint8_t *obmc_weight, int yblen);
31void ff_add_dirac_obmc16_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride,
32 const uint8_t *obmc_weight, int yblen);
33void ff_add_dirac_obmc32_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride,
34 const uint8_t *obmc_weight, int yblen);
35
36void ff_put_rect_clamped_sse2(uint8_t *dst, ptrdiff_t dst_stride, const int16_t *src,
37 ptrdiff_t src_stride, int width, int height);
38void ff_put_signed_rect_clamped_sse2(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src,
39 ptrdiff_t src_stride, int width, int height);
40void ff_put_signed_rect_clamped_10_sse4(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src,
41 ptrdiff_t src_stride, int width, int height);
42
43void ff_dequant_subband_32_sse4(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h);
44
45#define HPEL_FILTER(MMSIZE, EXT) \
46 void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *dst, const uint8_t *src, \
47 ptrdiff_t stride, int width); \
48 void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *dst, const uint8_t *src, int width); \
49 \
50 static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, \
51 const uint8_t *src, ptrdiff_t stride, int width, int height) \
52 { \
53 while( height-- ) \
54 { \
55 ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5); \
56 ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width); \
57 ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width); \
58 \
59 dsth += stride; \
60 dstv += stride; \
61 dstc += stride; \
62 src += stride; \
63 } \
64 }
65
66#define DIRAC_PIXOP(OPNAME, EXT)\
67static void OPNAME ## _dirac_pixels16_ ## EXT(uint8_t *dst, const uint8_t *src[5], \
68 ptrdiff_t stride, int h) \
69{\
70 if (h&3)\
71 ff_ ## OPNAME ## _dirac_pixels16_c(dst, src, stride, h);\
72 else\
73 ff_ ## OPNAME ## _pixels16_ ## EXT(dst, src[0], stride, h);\
74}\
75static void OPNAME ## _dirac_pixels32_ ## EXT(uint8_t *dst, const uint8_t *src[5], \
76 ptrdiff_t stride, int h) \
77{\
78 if (h&3) {\
79 ff_ ## OPNAME ## _dirac_pixels32_c(dst, src, stride, h);\
80 } else {\
81 ff_ ## OPNAME ## _pixels16_ ## EXT(dst , src[0] , stride, h);\
82 ff_ ## OPNAME ## _pixels16_ ## EXT(dst+16, src[0]+16, stride, h);\
83 }\
84}
85
86DIRAC_PIXOP(put, sse2)
87DIRAC_PIXOP(avg, sse2)
88
89HPEL_FILTER(16, sse2)
90
92{
93 int mm_flags = av_get_cpu_flags();
94
95 if (EXTERNAL_SSE2(mm_flags)) {
96 c->dirac_hpel_filter = dirac_hpel_filter_sse2;
97 c->add_rect_clamped = ff_add_rect_clamped_sse2;
98 c->put_signed_rect_clamped[0] = ff_put_signed_rect_clamped_sse2;
99
100 c->add_dirac_obmc[0] = ff_add_dirac_obmc8_sse2;
101 c->add_dirac_obmc[1] = ff_add_dirac_obmc16_sse2;
102 c->add_dirac_obmc[2] = ff_add_dirac_obmc32_sse2;
103
104 c->put_dirac_pixels_tab[1][0] = put_dirac_pixels16_sse2;
105 c->avg_dirac_pixels_tab[1][0] = avg_dirac_pixels16_sse2;
106 c->put_dirac_pixels_tab[2][0] = put_dirac_pixels32_sse2;
107 c->avg_dirac_pixels_tab[2][0] = avg_dirac_pixels32_sse2;
108 }
109
110 if (EXTERNAL_SSE4(mm_flags)) {
111 c->dequant_subband[1] = ff_dequant_subband_32_sse4;
112 c->put_signed_rect_clamped[1] = ff_put_signed_rect_clamped_10_sse4;
113 }
114}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define avg(a, b, c, d)
void ff_diracdsp_init_x86(DiracDSPContext *c)
void ff_add_dirac_obmc16_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride, const uint8_t *obmc_weight, int yblen)
void ff_put_signed_rect_clamped_sse2(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, ptrdiff_t src_stride, int width, int height)
void ff_dequant_subband_32_sse4(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h)
void ff_add_dirac_obmc32_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride, const uint8_t *obmc_weight, int yblen)
#define DIRAC_PIXOP(OPNAME, EXT)
void ff_add_rect_clamped_sse2(uint8_t *dst, const uint16_t *src, ptrdiff_t stride, const int16_t *idwt, ptrdiff_t idwt_stride, int width, int height)
void ff_add_dirac_obmc8_sse2(uint16_t *dst, const uint8_t *src, ptrdiff_t stride, const uint8_t *obmc_weight, int yblen)
void ff_put_rect_clamped_sse2(uint8_t *dst, ptrdiff_t dst_stride, const int16_t *src, ptrdiff_t src_stride, int width, int height)
void ff_put_signed_rect_clamped_10_sse4(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, ptrdiff_t src_stride, int width, int height)
#define HPEL_FILTER(MMSIZE, EXT)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition cpu.c:109
#define EXTERNAL_SSE4(flags)
Definition cpu.h:62
#define EXTERNAL_SSE2(flags)
Definition cpu.h:53
#define stride
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
static double c[64]