Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

swscale_internal.h

00001 /*
00002     Copyright (C) 2001-2003 Michael Niedermayer <[email protected]>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 
00019 #ifndef SWSCALE_INTERNAL_H
00020 #define SWSCALE_INTERNAL_H
00021 
00022 #ifdef HAVE_ALTIVEC_H
00023 #include <altivec.h>
00024 #endif
00025 
00026 #define MSG_WARN(args...) mp_msg(MSGT_SWS,MSGL_WARN, ##args )
00027 #define MSG_FATAL(args...) mp_msg(MSGT_SWS,MSGL_FATAL, ##args )
00028 #define MSG_ERR(args...) mp_msg(MSGT_SWS,MSGL_ERR, ##args )
00029 #define MSG_V(args...) mp_msg(MSGT_SWS,MSGL_V, ##args )
00030 #define MSG_DBG2(args...) mp_msg(MSGT_SWS,MSGL_DBG2, ##args )
00031 #define MSG_INFO(args...) mp_msg(MSGT_SWS,MSGL_INFO, ##args )
00032 
00033 #define MAX_FILTER_SIZE 256
00034 
00035 typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
00036              int srcSliceH, uint8_t* dst[], int dstStride[]);
00037 
00038 /* this struct should be aligned on at least 32-byte boundary */
00039 typedef struct SwsContext{
00044         SwsFunc swScale;
00045         int srcW, srcH, dstH;
00046         int chrSrcW, chrSrcH, chrDstW, chrDstH;
00047         int lumXInc, chrXInc;
00048         int lumYInc, chrYInc;
00049         int dstFormat, srcFormat;               
00050         int origDstFormat, origSrcFormat;       
00051         int chrSrcHSubSample, chrSrcVSubSample;
00052         int chrIntHSubSample, chrIntVSubSample;
00053         int chrDstHSubSample, chrDstVSubSample;
00054         int vChrDrop;
00055 
00056         int16_t **lumPixBuf;
00057         int16_t **chrPixBuf;
00058         int16_t *hLumFilter;
00059         int16_t *hLumFilterPos;
00060         int16_t *hChrFilter;
00061         int16_t *hChrFilterPos;
00062         int16_t *vLumFilter;
00063         int16_t *vLumFilterPos;
00064         int16_t *vChrFilter;
00065         int16_t *vChrFilterPos;
00066 
00067         uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
00068 
00069         int hLumFilterSize;
00070         int hChrFilterSize;
00071         int vLumFilterSize;
00072         int vChrFilterSize;
00073         int vLumBufSize;
00074         int vChrBufSize;
00075 
00076         uint8_t __attribute__((aligned(32))) funnyYCode[10000];
00077         uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
00078         int32_t *lumMmx2FilterPos;
00079         int32_t *chrMmx2FilterPos;
00080         int16_t *lumMmx2Filter;
00081         int16_t *chrMmx2Filter;
00082 
00083         int canMMX2BeUsed;
00084 
00085         int lastInLumBuf;
00086         int lastInChrBuf;
00087         int lumBufIndex;
00088         int chrBufIndex;
00089         int dstY;
00090         int flags;
00091         void * yuvTable;                        // pointer to the yuv->rgb table start so it can be freed()
00092         void * table_rV[256];
00093         void * table_gU[256];
00094         int    table_gV[256];
00095         void * table_bU[256];
00096 
00097         //Colorspace stuff
00098         int contrast, brightness, saturation;   // for sws_getColorspaceDetails
00099         int srcColorspaceTable[4];
00100         int dstColorspaceTable[4];
00101         int srcRange, dstRange;
00102 
00103 #define RED_DITHER   "0*8"
00104 #define GREEN_DITHER "1*8"
00105 #define BLUE_DITHER  "2*8"
00106 #define Y_COEFF      "3*8"
00107 #define VR_COEFF     "4*8"
00108 #define UB_COEFF     "5*8"
00109 #define VG_COEFF     "6*8"
00110 #define UG_COEFF     "7*8"
00111 #define Y_OFFSET     "8*8"
00112 #define U_OFFSET     "9*8"
00113 #define V_OFFSET     "10*8"
00114 #define LUM_MMX_FILTER_OFFSET "11*8"
00115 #define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
00116 #define DSTW_OFFSET  "11*8+4*4*256*2" //do not change, its hardcoded in the asm
00117 #define ESP_OFFSET  "11*8+4*4*256*2+4"
00118 #define VROUNDER_OFFSET "11*8+4*4*256*2+8"
00119                   
00120         uint64_t redDither   __attribute__((aligned(8)));
00121         uint64_t greenDither __attribute__((aligned(8)));
00122         uint64_t blueDither  __attribute__((aligned(8)));
00123 
00124         uint64_t yCoeff      __attribute__((aligned(8)));
00125         uint64_t vrCoeff     __attribute__((aligned(8)));
00126         uint64_t ubCoeff     __attribute__((aligned(8)));
00127         uint64_t vgCoeff     __attribute__((aligned(8)));
00128         uint64_t ugCoeff     __attribute__((aligned(8)));
00129         uint64_t yOffset     __attribute__((aligned(8)));
00130         uint64_t uOffset     __attribute__((aligned(8)));
00131         uint64_t vOffset     __attribute__((aligned(8)));
00132         int32_t  lumMmxFilter[4*MAX_FILTER_SIZE];
00133         int32_t  chrMmxFilter[4*MAX_FILTER_SIZE];
00134         int dstW;
00135         int esp;
00136         uint64_t vRounder     __attribute__((aligned(8)));
00137 
00138 #ifdef HAVE_ALTIVEC
00139 
00140   vector signed short   CY;
00141   vector signed short   CRV;
00142   vector signed short   CBU;
00143   vector signed short   CGU;
00144   vector signed short   CGV;
00145   vector signed short   OY;
00146   vector unsigned short CSHIFT;
00147 
00148 #endif
00149 
00150 } SwsContext;
00151 //FIXME check init (where 0)
00152 
00153 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
00154 int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
00155 
00156 #endif

Generated on Tue Dec 20 10:14:54 2005 for vlc-0.8.4a by  doxygen 1.4.2