annotate ffmpeg/libavcodec/dirac_dwt.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at>
yading@10 3 *
yading@10 4 * This file is part of FFmpeg.
yading@10 5 *
yading@10 6 * FFmpeg is free software; you can redistribute it and/or
yading@10 7 * modify it under the terms of the GNU Lesser General Public
yading@10 8 * License as published by the Free Software Foundation; either
yading@10 9 * version 2.1 of the License, or (at your option) any later version.
yading@10 10 *
yading@10 11 * FFmpeg is distributed in the hope that it will be useful,
yading@10 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 14 * Lesser General Public License for more details.
yading@10 15 *
yading@10 16 * You should have received a copy of the GNU Lesser General Public
yading@10 17 * License along with FFmpeg; if not, write to the Free Software
yading@10 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 19 */
yading@10 20
yading@10 21 #ifndef AVCODEC_DIRAC_DWT_H
yading@10 22 #define AVCODEC_DIRAC_DWT_H
yading@10 23
yading@10 24 #include <stdint.h>
yading@10 25
yading@10 26 typedef int DWTELEM;
yading@10 27 typedef short IDWTELEM;
yading@10 28
yading@10 29 #define MAX_DWT_SUPPORT 8
yading@10 30 #define MAX_DECOMPOSITIONS 8
yading@10 31
yading@10 32 typedef struct DWTCompose {
yading@10 33 IDWTELEM *b[MAX_DWT_SUPPORT];
yading@10 34 int y;
yading@10 35 } DWTCompose;
yading@10 36
yading@10 37 struct DWTContext;
yading@10 38
yading@10 39 // Possible prototypes for vertical_compose functions
yading@10 40 typedef void (*vertical_compose_2tap)(IDWTELEM *b0, IDWTELEM *b1, int width);
yading@10 41 typedef void (*vertical_compose_3tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width);
yading@10 42 typedef void (*vertical_compose_5tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width);
yading@10 43 typedef void (*vertical_compose_9tap)(IDWTELEM *dst, IDWTELEM *b[8], int width);
yading@10 44
yading@10 45 typedef struct DWTContext {
yading@10 46 IDWTELEM *buffer;
yading@10 47 IDWTELEM *temp;
yading@10 48 int width;
yading@10 49 int height;
yading@10 50 int stride;
yading@10 51 int decomposition_count;
yading@10 52 int support;
yading@10 53
yading@10 54 void (*spatial_compose)(struct DWTContext *cs, int level, int width, int height, int stride);
yading@10 55 void (*vertical_compose_l0)(void);
yading@10 56 void (*vertical_compose_h0)(void);
yading@10 57 void (*vertical_compose_l1)(void);
yading@10 58 void (*vertical_compose_h1)(void);
yading@10 59 void (*vertical_compose)(void); ///< one set of lowpass and highpass combined
yading@10 60 void (*horizontal_compose)(IDWTELEM *b, IDWTELEM *tmp, int width);
yading@10 61
yading@10 62 DWTCompose cs[MAX_DECOMPOSITIONS];
yading@10 63 } DWTContext;
yading@10 64
yading@10 65 enum dwt_type {
yading@10 66 DWT_SNOW_DAUB9_7,
yading@10 67 DWT_SNOW_LEGALL5_3,
yading@10 68 DWT_DIRAC_DD9_7,
yading@10 69 DWT_DIRAC_LEGALL5_3,
yading@10 70 DWT_DIRAC_DD13_7,
yading@10 71 DWT_DIRAC_HAAR0,
yading@10 72 DWT_DIRAC_HAAR1,
yading@10 73 DWT_DIRAC_FIDELITY,
yading@10 74 DWT_DIRAC_DAUB9_7,
yading@10 75 DWT_NUM_TYPES
yading@10 76 };
yading@10 77
yading@10 78 // -1 if an error occurred, e.g. the dwt_type isn't recognized
yading@10 79 int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height,
yading@10 80 int stride, enum dwt_type type, int decomposition_count,
yading@10 81 IDWTELEM *temp);
yading@10 82
yading@10 83 int ff_spatial_idwt2(IDWTELEM *buffer, int width, int height, int stride,
yading@10 84 enum dwt_type type, int decomposition_count, IDWTELEM *temp);
yading@10 85
yading@10 86 void ff_spatial_idwt_slice2(DWTContext *d, int y);
yading@10 87
yading@10 88 // shared stuff for simd optimiztions
yading@10 89 #define COMPOSE_53iL0(b0, b1, b2)\
yading@10 90 (b1 - ((b0 + b2 + 2) >> 2))
yading@10 91
yading@10 92 #define COMPOSE_DIRAC53iH0(b0, b1, b2)\
yading@10 93 (b1 + ((b0 + b2 + 1) >> 1))
yading@10 94
yading@10 95 #define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
yading@10 96 (b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4))
yading@10 97
yading@10 98 #define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
yading@10 99 (b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
yading@10 100
yading@10 101 #define COMPOSE_HAARiL0(b0, b1)\
yading@10 102 (b0 - ((b1 + 1) >> 1))
yading@10 103
yading@10 104 #define COMPOSE_HAARiH0(b0, b1)\
yading@10 105 (b0 + b1)
yading@10 106
yading@10 107 #define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
yading@10 108 (b4 - ((-8*(b0+b8) + 21*(b1+b7) - 46*(b2+b6) + 161*(b3+b5) + 128) >> 8))
yading@10 109
yading@10 110 #define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
yading@10 111 (b4 + ((-2*(b0+b8) + 10*(b1+b7) - 25*(b2+b6) + 81*(b3+b5) + 128) >> 8))
yading@10 112
yading@10 113 #define COMPOSE_DAUB97iL1(b0, b1, b2)\
yading@10 114 (b1 - ((1817*(b0 + b2) + 2048) >> 12))
yading@10 115
yading@10 116 #define COMPOSE_DAUB97iH1(b0, b1, b2)\
yading@10 117 (b1 - (( 113*(b0 + b2) + 64) >> 7))
yading@10 118
yading@10 119 #define COMPOSE_DAUB97iL0(b0, b1, b2)\
yading@10 120 (b1 + (( 217*(b0 + b2) + 2048) >> 12))
yading@10 121
yading@10 122 #define COMPOSE_DAUB97iH0(b0, b1, b2)\
yading@10 123 (b1 + ((6497*(b0 + b2) + 2048) >> 12))
yading@10 124
yading@10 125
yading@10 126 #endif /* AVCODEC_DWT_H */