00001 00039 #ifndef __VETLIB_VETFILTER_H__ 00040 #define __VETLIB_VETFILTER_H__ 00041 00042 #include "vetDefs.h" 00043 #include "vetObject.h" 00044 00045 #include "vetInput.h" 00046 #include "vetOutput.h" 00047 00048 #include "vetFrameYUV420.h" 00049 #include "vetFrameRGB24.h" 00050 #include "vetFrameT.h" 00051 00052 00053 #include <stdio.h> 00054 #include <fstream> 00055 00056 00057 class vetFilterParameters 00058 { 00059 public: 00060 00064 enum BUFFER_TYPE { NONE, YUV, RGB, TuC }; 00065 00066 protected: 00067 00072 BUFFER_TYPE currentBuffer; 00073 00078 friend class vetFilter; 00079 00080 public: 00081 00085 vetFilterParameters() {};//{ reset(); } 00086 00090 virtual ~vetFilterParameters() {} 00091 00096 // virtual void reset() = 0; 00097 00098 00108 VETRESULT saveToXML(const char* filename); 00109 00119 VETRESULT loadFromXML(const char* filename); 00120 00121 00122 00131 virtual VETRESULT saveToStreamXML(FILE *fp) = 0; 00132 00141 virtual VETRESULT loadFromStreamXML(FILE *fp) = 0; 00142 00143 }; 00144 00145 00146 00147 00149 00150 00151 00152 00153 00154 class vetFilter : public vetInput, 00155 public vetOutput, 00156 public vetObject 00157 { 00158 00159 protected: 00160 00164 vetFrameYUV420* bufferYUV; 00165 00169 vetFrameRGB24* bufferRGB; 00170 00174 vetFrameT<unsigned char>* bufferTuC; 00175 00176 00183 void allocateBuffer(vetFilterParameters::BUFFER_TYPE bType); 00184 00188 void releaseBuffers(); 00189 00190 public: 00191 00192 00199 vetFilter(float fps = 0); 00200 00201 00205 ~vetFilter(); 00206 00207 00208 00218 virtual VETRESULT setFilterParameters (vetFilterParameters* initParams) = 0; 00219 00220 00221 00222 virtual vetFilterParameters* getFilterParameters () = 0; 00223 00224 00225 00233 virtual VETRESULT reset() = 0; 00234 00235 00236 00244 vetFrameYUV420* dump_buffer_YUV() { return bufferYUV; }; 00245 00253 vetFrameRGB24* dump_buffer_RGB() { return bufferRGB; }; 00254 00262 vetFrameT<unsigned char>* dump_buffer_TuC() { return bufferTuC; }; 00263 00269 void useBufferYUV(unsigned int width, unsigned int height); 00270 00276 void useBufferRGB(unsigned int width, unsigned int height); 00277 00283 void useBufferTuC(unsigned int width, unsigned int height, vetFrame::VETFRAME_PROFILE profile); 00284 00290 bool isBufferYUV() { if ( bufferYUV != NULL ) return true; return false; }; 00291 00297 bool isBufferRGB() { if ( bufferRGB != NULL ) return true; return false; }; 00298 00304 bool isBufferTuC() { if ( bufferTuC != NULL ) return true; return false; }; 00305 00306 00312 VETRESULT setHeight(unsigned int value); 00313 00319 VETRESULT setWidth(unsigned int value); 00320 00326 unsigned int getWidth() const; 00327 00328 00334 unsigned int getHeight() const; 00335 00336 00343 bool EoF(); 00344 00345 00346 00360 VETRESULT extractTo(vetFrameYUV420& img); 00361 00375 VETRESULT extractTo(vetFrameRGB24& img); 00376 00390 VETRESULT extractTo(vetFrameT<unsigned char>& img); 00391 00392 00393 00406 virtual VETRESULT importFrom(vetFrameYUV420& img) = 0; 00407 00420 virtual VETRESULT importFrom(vetFrameRGB24& img) = 0; 00421 00434 virtual VETRESULT importFrom(vetFrameT<unsigned char>& img) = 0; 00435 00436 00437 00444 enum{ vetClassType = VETCLASS_TYPE_FILTER }; 00445 00446 }; 00447 00448 00449 00450 #endif //__VETLIB_VETFILTER_H__ 00451
1.4.4