Libav
|
00001 /* 00002 * Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at> 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with FFmpeg; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVCODEC_DWT_H 00022 #define AVCODEC_DWT_H 00023 00024 #include <stdint.h> 00025 00026 typedef int DWTELEM; 00027 typedef short IDWTELEM; 00028 00029 typedef struct { 00030 IDWTELEM *b0; 00031 IDWTELEM *b1; 00032 IDWTELEM *b2; 00033 IDWTELEM *b3; 00034 int y; 00035 } DWTCompose; 00036 00038 typedef struct slice_buffer_s { 00039 IDWTELEM * * line; 00040 IDWTELEM * * data_stack; 00041 int data_stack_top; 00042 int line_count; 00043 int line_width; 00044 int data_count; 00045 IDWTELEM * base_buffer; 00046 } slice_buffer; 00047 00048 typedef struct DWTContext { 00049 void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width); 00050 void (*horizontal_compose97i)(IDWTELEM *b, int width); 00051 void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8); 00052 } DWTContext; 00053 00054 #define MAX_DECOMPOSITIONS 8 00055 00056 #define DWT_97 0 00057 #define DWT_53 1 00058 00059 #define liftS lift 00060 #if 1 00061 #define W_AM 3 00062 #define W_AO 0 00063 #define W_AS 1 00064 00065 #undef liftS 00066 #define W_BM 1 00067 #define W_BO 8 00068 #define W_BS 4 00069 00070 #define W_CM 1 00071 #define W_CO 0 00072 #define W_CS 0 00073 00074 #define W_DM 3 00075 #define W_DO 4 00076 #define W_DS 3 00077 #elif 0 00078 #define W_AM 55 00079 #define W_AO 16 00080 #define W_AS 5 00081 00082 #define W_BM 3 00083 #define W_BO 32 00084 #define W_BS 6 00085 00086 #define W_CM 127 00087 #define W_CO 64 00088 #define W_CS 7 00089 00090 #define W_DM 7 00091 #define W_DO 8 00092 #define W_DS 4 00093 #elif 0 00094 #define W_AM 97 00095 #define W_AO 32 00096 #define W_AS 6 00097 00098 #define W_BM 63 00099 #define W_BO 512 00100 #define W_BS 10 00101 00102 #define W_CM 13 00103 #define W_CO 8 00104 #define W_CS 4 00105 00106 #define W_DM 15 00107 #define W_DO 16 00108 #define W_DS 5 00109 00110 #else 00111 00112 #define W_AM 203 00113 #define W_AO 64 00114 #define W_AS 7 00115 00116 #define W_BM 217 00117 #define W_BO 2048 00118 #define W_BS 12 00119 00120 #define W_CM 113 00121 #define W_CO 64 00122 #define W_CS 7 00123 00124 #define W_DM 227 00125 #define W_DO 128 00126 #define W_DS 9 00127 #endif 00128 00129 #define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : ff_slice_buffer_load_line((slice_buf), (line_num))) 00130 //#define slice_buffer_get_line(slice_buf, line_num) (ff_slice_buffer_load_line((slice_buf), (line_num))) 00131 00132 void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer); 00133 void ff_slice_buffer_release(slice_buffer * buf, int line); 00134 void ff_slice_buffer_flush(slice_buffer * buf); 00135 void ff_slice_buffer_destroy(slice_buffer * buf); 00136 IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line); 00137 00138 void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width); 00139 void ff_snow_horizontal_compose97i(IDWTELEM *b, int width); 00140 void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8); 00141 00142 int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h); 00143 int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h); 00144 00145 void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, int decomposition_count); 00146 00147 void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count); 00148 void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y); 00149 void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count); 00150 void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y); 00151 void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count); 00152 00153 void ff_dwt_init(DWTContext *c); 00154 void ff_dwt_init_x86(DWTContext *c); 00155 00156 #endif /* AVCODEC_DWT_H */