1 #ifndef TH_HELPER_H 2 #define TH_HELPER_H 3 4 //#ifdef HAVE_THEORAENC || HAVE_THEORADEC 5 6 #include <cstring> 7 #include <theora/codec.h> 8 9 #include "definition.h" 10 th_clean_ycbcr(th_ycbcr_buffer & theoraPictureBuffer)11inline void th_clean_ycbcr(th_ycbcr_buffer& theoraPictureBuffer) 12 { 13 #ifdef HAVE_BZERO 14 bzero(theoraPictureBuffer, sizeof(th_img_plane)*3); 15 #else 16 // with the right alignment, this could be much faster ... I hope for the compiler to do that :-/ 17 for (int i(0); i<sizeof(th_img_plane)*3; ++i) *(((uint8*)theoraPictureBuffer)+i) = 0; 18 #endif 19 20 } 21 th_free_ycbcr(th_ycbcr_buffer & theoraPictureBuffer)22inline void th_free_ycbcr(th_ycbcr_buffer& theoraPictureBuffer) 23 { 24 // kind of ugly 25 26 delete[] theoraPictureBuffer[0].data; 27 delete[] theoraPictureBuffer[1].data; 28 delete[] theoraPictureBuffer[2].data; 29 30 th_clean_ycbcr(theoraPictureBuffer); 31 } 32 33 //#endif 34 35 #endif