home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Kasumi / source / uberblit_16f.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  1.2 KB  |  41 lines

  1. #include <vd2/system/halffloat.h>
  2. #include "uberblit_16f.h"
  3.  
  4. ///////////////////////////////////////////////////////////////////////////////
  5.  
  6. void VDPixmapGen_32F_To_16F::Start() {
  7.     StartWindow(mWidth * sizeof(uint16));
  8. }
  9.  
  10. uint32 VDPixmapGen_32F_To_16F::GetType(uint32 output) const {
  11.     return (mpSrc->GetType(mSrcIndex) & ~kVDPixType_Mask) | kVDPixType_16F_LE;
  12. }
  13.  
  14. void VDPixmapGen_32F_To_16F::Compute(void *dst0, sint32 y) {
  15.     uint16 *dst = (uint16 *)dst0;
  16.     const float *src = (const float *)mpSrc->GetRow(y, mSrcIndex);
  17.     uint32 w = mWidth;
  18.  
  19.     for(uint32 i=0; i<w; ++i)
  20.         *dst++ = VDConvertFloatToHalf(src++);
  21. }
  22.  
  23. ///////////////////////////////////////////////////////////////////////////////
  24.  
  25. void VDPixmapGen_16F_To_32F::Start() {
  26.     StartWindow(mWidth * sizeof(float));
  27. }
  28.  
  29. uint32 VDPixmapGen_16F_To_32F::GetType(uint32 output) const {
  30.     return (mpSrc->GetType(mSrcIndex) & ~kVDPixType_Mask) | kVDPixType_32F_LE;
  31. }
  32.  
  33. void VDPixmapGen_16F_To_32F::Compute(void *dst0, sint32 y) {
  34.     float *dst = (float *)dst0;
  35.     const uint16 *src = (const uint16 *)mpSrc->GetRow(y, mSrcIndex);
  36.     uint32 w = mWidth;
  37.  
  38.     for(uint32 i=0; i<w; ++i)
  39.         VDConvertHalfToFloat(*src++, dst++);
  40. }
  41.