FFmpeg
diracdsp.h
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 #ifndef AVCODEC_DIRACDSP_H
22 #define AVCODEC_DIRACDSP_H
23 
24 #include <stdint.h>
25 #include <stddef.h>
26 
27 typedef void (*dirac_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int h);
28 typedef void (*dirac_biweight_func)(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, int weightd, int weights, int h);
29 
30 typedef struct {
31  void (*dirac_hpel_filter)(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height);
32  /**
33  * dirac_pixels_tab[width][subpel]
34  * width is 2 for 32, 1 for 16, 0 for 8
35  * subpel is 0 for fpel and hpel (only need to copy from the first plane in src)
36  * 1 if an average of the first 2 planes is needed (TODO: worth it?)
37  * 2 for general qpel (avg of 4)
38  * 3 for general epel (biweight of 4 using the weights in src[4])
39  * src[0-3] is each of the hpel planes
40  * src[4] is the 1/8 pel weights if needed
41  */
42  void (*put_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h);
43  void (*avg_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h);
44 
45  void (*put_signed_rect_clamped[3])(uint8_t *dst/*align 16*/, int dst_stride, const uint8_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/);
46  void (*put_rect_clamped)(uint8_t *dst/*align 16*/, int dst_stride, const uint8_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/);
47  void (*add_rect_clamped)(uint8_t *dst/*align 16*/, const uint16_t *src/*align 16*/, int stride, const int16_t *idwt/*align 16*/, int idwt_stride, int width, int height/*mod 2*/);
48  void (*add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen);
49 
50  /* 0-1: int16_t and int32_t asm/c, 2-3: int16 and int32_t, C only */
51  void (*dequant_subband[4])(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h);
52 
53  dirac_weight_func weight_dirac_pixels_tab[3];
54  dirac_biweight_func biweight_dirac_pixels_tab[3];
56 
57 #define DECL_DIRAC_PIXOP(PFX, EXT) \
58  void ff_ ## PFX ## _dirac_pixels8_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
59  void ff_ ## PFX ## _dirac_pixels16_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
60  void ff_ ## PFX ## _dirac_pixels32_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h)
61 
62 DECL_DIRAC_PIXOP(put, c);
64 DECL_DIRAC_PIXOP(put, l2_c);
65 DECL_DIRAC_PIXOP(avg, l2_c);
66 DECL_DIRAC_PIXOP(put, l4_c);
67 DECL_DIRAC_PIXOP(avg, l4_c);
68 
71 
72 #endif /* AVCODEC_DIRACDSP_H */
ff_diracdsp_init
void ff_diracdsp_init(DiracDSPContext *c)
Definition: diracdsp.c:221
dirac_biweight_func
void(* dirac_biweight_func)(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, int weightd, int weights, int h)
Definition: diracdsp.h:28
dirac_hpel_filter
static void dirac_hpel_filter(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height)
Definition: diracdsp.c:32
dirac_weight_func
void(* dirac_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int h)
Definition: diracdsp.h:27
width
#define width
c
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
weight
static int weight(int i, int blen, int offset)
Definition: diracdec.c:1562
avg
#define avg(a, b, c, d)
Definition: colorspacedsp_template.c:28
height
#define height
DiracDSPContext
Definition: diracdsp.h:30
weights
static const int weights[]
Definition: hevc_pel.c:32
stride
#define stride
Definition: h264pred_template.c:537
DECL_DIRAC_PIXOP
#define DECL_DIRAC_PIXOP(PFX, EXT)
Definition: diracdsp.h:57
ff_diracdsp_init_x86
void ff_diracdsp_init_x86(DiracDSPContext *c)
Definition: diracdsp_init.c:92
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
h
h
Definition: vp9dsp_template.c:2038