Libav 0.7.1
|
00001 /* 00002 * Copyright (C) 2004 Michael Niedermayer <michaelni@gmx.at> 00003 * Copyright (C) 2006 Robert Edele <yartrebo@earthlink.net> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef AVCODEC_SNOW_H 00023 #define AVCODEC_SNOW_H 00024 00025 #include "dsputil.h" 00026 #include "dwt.h" 00027 00028 #define MID_STATE 128 00029 00030 #define MAX_PLANES 4 00031 #define QSHIFT 5 00032 #define QROOT (1<<QSHIFT) 00033 #define LOSSLESS_QLOG -128 00034 #define FRAC_BITS 4 00035 #define MAX_REF_FRAMES 8 00036 00037 #define LOG2_OBMC_MAX 8 00038 #define OBMC_MAX (1<<(LOG2_OBMC_MAX)) 00039 00040 /* C bits used by mmx/sse2/altivec */ 00041 00042 static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){ 00043 (*i) = (width) - 2; 00044 00045 if (width & 1){ 00046 low[(*i)+1] = low[((*i)+1)>>1]; 00047 (*i)--; 00048 } 00049 } 00050 00051 static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){ 00052 for (; (*i)>=0; (*i)-=2){ 00053 low[(*i)+1] = high[(*i)>>1]; 00054 low[*i] = low[(*i)>>1]; 00055 } 00056 } 00057 00058 static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){ 00059 for(; i<w; i++){ 00060 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift); 00061 } 00062 00063 if((width^lift_high)&1){ 00064 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift); 00065 } 00066 } 00067 00068 static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){ 00069 for(; i<w; i++){ 00070 dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS); 00071 } 00072 00073 if(width&1){ 00074 dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS); 00075 } 00076 } 00077 00078 #endif /* AVCODEC_SNOW_H */