FFmpeg
dirac_dwt.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at>
3  * Copyright (C) 2008 David Conrad
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/common.h"
24 #include "dirac_dwt.h"
25 
26 #define TEMPLATE_8bit
27 #include "dirac_dwt_template.c"
28 
29 #define TEMPLATE_10bit
30 #include "dirac_dwt_template.c"
31 
32 #define TEMPLATE_12bit
33 #include "dirac_dwt_template.c"
34 
36  int decomposition_count, int bit_depth)
37 {
38  int ret = 0;
39 
40  d->buffer = p->buf;
41  d->width = p->width;
42  d->height = p->height;
43  d->stride = p->stride;
44  d->temp = p->tmp;
45  d->decomposition_count = decomposition_count;
46 
47  if (bit_depth == 8)
48  ret = ff_spatial_idwt_init_8bit(d, type);
49  else if (bit_depth == 10)
50  ret = ff_spatial_idwt_init_10bit(d, type);
51  else if (bit_depth == 12)
52  ret = ff_spatial_idwt_init_12bit(d, type);
53  else
54  av_log(NULL, AV_LOG_WARNING, "Unsupported bit depth = %i\n", bit_depth);
55 
56  if (ret) {
57  av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type);
58  return AVERROR_INVALIDDATA;
59  }
60 
61  if (ARCH_X86 && bit_depth == 8)
63  return 0;
64 }
65 
67 {
68  int level, support = d->support;
69 
70  for (level = d->decomposition_count-1; level >= 0; level--) {
71  int wl = d->width >> level;
72  int hl = d->height >> level;
73  int stride_l = d->stride << level;
74 
75  while (d->cs[level].y <= FFMIN((y>>level)+support, hl))
76  d->spatial_compose(d, level, wl, hl, stride_l);
77  }
78 }
DWTPlane::buf
uint8_t * buf
Definition: dirac_dwt.h:41
bit_depth
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
Definition: af_astats.c:226
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
level
uint8_t level
Definition: svq3.c:204
DWTPlane
Definition: dirac_dwt.h:37
dirac_dwt.h
ff_spatial_idwt_init
int ff_spatial_idwt_init(DWTContext *d, DWTPlane *p, enum dwt_type type, int decomposition_count, int bit_depth)
Definition: dirac_dwt.c:35
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
DWTPlane::stride
int stride
Definition: dirac_dwt.h:40
dwt_type
dwt_type
Definition: dirac_dwt.h:74
NULL
#define NULL
Definition: coverity.c:32
dirac_dwt_template.c
ff_spatial_idwt_slice2
void ff_spatial_idwt_slice2(DWTContext *d, int y)
Definition: dirac_dwt.c:66
attributes.h
common.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
ff_spatial_idwt_init_x86
void ff_spatial_idwt_init_x86(DWTContext *d, enum dwt_type type)
Definition: dirac_dwt_init.c:161
DWTContext
Definition: dirac_dwt.h:54
ret
ret
Definition: filter_design.txt:187
d
d
Definition: ffmpeg_filter.c:153
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
DWTPlane::width
int width
Definition: dirac_dwt.h:38
DWTPlane::tmp
uint8_t * tmp
Definition: dirac_dwt.h:43
DWTPlane::height
int height
Definition: dirac_dwt.h:39