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_resample_special.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  5.5 KB  |  187 lines

  1. #include "uberblit_resample_special.h"
  2. #include "blt_spanutils.h"
  3.  
  4. ///////////////////////////////////////////////////////////////////////////////
  5.  
  6. void VDPixmapGenResampleRow_d2_p0_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  7.     InitSource(src, srcIndex);
  8.     src->AddWindowRequest(0, 0);
  9.  
  10.     mWidth = (mSrcWidth + 1) >> 1;
  11. }
  12.  
  13. void VDPixmapGenResampleRow_d2_p0_lin_u8::Start() {
  14.     mpSrc->Start();
  15.     StartWindow(mWidth);
  16. }
  17.  
  18. void VDPixmapGenResampleRow_d2_p0_lin_u8::Compute(void *dst0, sint32 y) {
  19.     const uint8 *src = (const uint8 *)mpSrc->GetRow(y, mSrcIndex);
  20.  
  21.     nsVDPixmapSpanUtils::horiz_compress2x_coaligned((uint8 *)dst0, src, mSrcWidth);
  22. }
  23.  
  24. ///////////////////////////////////////////////////////////////////////////////
  25.  
  26. void VDPixmapGenResampleRow_d4_p0_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  27.     InitSource(src, srcIndex);
  28.     src->AddWindowRequest(0, 0);
  29.  
  30.     mWidth = (mSrcWidth + 3) >> 2;
  31. }
  32.  
  33. void VDPixmapGenResampleRow_d4_p0_lin_u8::Start() {
  34.     mpSrc->Start();
  35.     StartWindow(mWidth);
  36. }
  37.  
  38. void VDPixmapGenResampleRow_d4_p0_lin_u8::Compute(void *dst0, sint32 y) {
  39.     const uint8 *src = (const uint8 *)mpSrc->GetRow(y, mSrcIndex);
  40.  
  41.     nsVDPixmapSpanUtils::horiz_compress4x_coaligned((uint8 *)dst0, src, mSrcWidth);
  42. }
  43.  
  44. ///////////////////////////////////////////////////////////////////////////////
  45.  
  46. void VDPixmapGenResampleRow_x2_p0_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  47.     InitSource(src, srcIndex);
  48.     src->AddWindowRequest(0, 0);
  49.  
  50.     mWidth = mSrcWidth * 2;
  51. }
  52.  
  53. void VDPixmapGenResampleRow_x2_p0_lin_u8::Start() {
  54.     mpSrc->Start();
  55.     StartWindow(mWidth);
  56. }
  57.  
  58. void VDPixmapGenResampleRow_x2_p0_lin_u8::Compute(void *dst0, sint32 y) {
  59.     const uint8 *src = (const uint8 *)mpSrc->GetRow(y, mSrcIndex);
  60.  
  61.     nsVDPixmapSpanUtils::horiz_expand2x_coaligned((uint8 *)dst0, src, mWidth);
  62. }
  63.  
  64. ///////////////////////////////////////////////////////////////////////////////
  65.  
  66. void VDPixmapGenResampleRow_x4_p0_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  67.     InitSource(src, srcIndex);
  68.     src->AddWindowRequest(0, 0);
  69.  
  70.     mWidth = mSrcWidth * 4;
  71. }
  72.  
  73. void VDPixmapGenResampleRow_x4_p0_lin_u8::Start() {
  74.     mpSrc->Start();
  75.     StartWindow(mWidth);
  76. }
  77.  
  78. void VDPixmapGenResampleRow_x4_p0_lin_u8::Compute(void *dst0, sint32 y) {
  79.     const uint8 *src = (const uint8 *)mpSrc->GetRow(y, mSrcIndex);
  80.  
  81.     nsVDPixmapSpanUtils::horiz_expand4x_coaligned((uint8 *)dst0, src, mWidth);
  82. }
  83.  
  84. ///////////////////////////////////////////////////////////////////////////////
  85.  
  86. void VDPixmapGenResampleCol_x2_phalf_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  87.     InitSource(src, srcIndex);
  88.     src->AddWindowRequest(-2, 2);
  89.  
  90.     mHeight = (mSrcHeight + 1) >> 1;
  91. }
  92.  
  93. void VDPixmapGenResampleCol_x2_phalf_lin_u8::Start() {
  94.     mpSrc->Start();
  95.     StartWindow(mWidth);
  96. }
  97.  
  98. void VDPixmapGenResampleCol_x2_phalf_lin_u8::Compute(void *dst0, sint32 y) {
  99.     sint32 y2 = y+y;
  100.     const uint8 *src[4] = {
  101.         (const uint8 *)mpSrc->GetRow(y2 > 0 ? y2-1 : 0, mSrcIndex),
  102.         (const uint8 *)mpSrc->GetRow(y2  , mSrcIndex),
  103.         (const uint8 *)mpSrc->GetRow(y2+1, mSrcIndex),
  104.         (const uint8 *)mpSrc->GetRow(y2+2, mSrcIndex)
  105.     };
  106.  
  107.     nsVDPixmapSpanUtils::vert_compress2x_centered((uint8 *)dst0, src, mWidth, 0);
  108. }
  109.  
  110. ///////////////////////////////////////////////////////////////////////////////
  111.  
  112. void VDPixmapGenResampleCol_x4_p1half_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  113.     InitSource(src, srcIndex);
  114.     src->AddWindowRequest(-4, 4);
  115.  
  116.     mHeight = (mSrcHeight + 2) >> 2;
  117. }
  118.  
  119. void VDPixmapGenResampleCol_x4_p1half_lin_u8::Start() {
  120.     mpSrc->Start();
  121.     StartWindow(mWidth);
  122. }
  123.  
  124. void VDPixmapGenResampleCol_x4_p1half_lin_u8::Compute(void *dst0, sint32 y) {
  125.     sint32 y4 = y*4;
  126.     const uint8 *src[8] = {
  127.         (const uint8 *)mpSrc->GetRow(y4 > 2 ? y4-2 : 0, mSrcIndex),
  128.         (const uint8 *)mpSrc->GetRow(y4 > 1 ? y4-1 : 0, mSrcIndex),
  129.         (const uint8 *)mpSrc->GetRow(y4  , mSrcIndex),
  130.         (const uint8 *)mpSrc->GetRow(y4+1, mSrcIndex),
  131.         (const uint8 *)mpSrc->GetRow(y4+2, mSrcIndex),
  132.         (const uint8 *)mpSrc->GetRow(y4+3, mSrcIndex),
  133.         (const uint8 *)mpSrc->GetRow(y4+4, mSrcIndex),
  134.         (const uint8 *)mpSrc->GetRow(y4+5, mSrcIndex)
  135.     };
  136.  
  137.     nsVDPixmapSpanUtils::vert_compress4x_centered((uint8 *)dst0, src, mWidth, 0);
  138. }
  139.  
  140. ///////////////////////////////////////////////////////////////////////////////
  141.  
  142. void VDPixmapGenResampleCol_d2_pnqrtr_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  143.     InitSource(src, srcIndex);
  144.     src->AddWindowRequest(-1, 1);
  145.  
  146.     mHeight = mSrcHeight * 2;
  147. }
  148.  
  149. void VDPixmapGenResampleCol_d2_pnqrtr_lin_u8::Start() {
  150.     mpSrc->Start();
  151.     StartWindow(mWidth);
  152. }
  153.  
  154. void VDPixmapGenResampleCol_d2_pnqrtr_lin_u8::Compute(void *dst0, sint32 y) {
  155.     sint32 y2 = (y - 1) >> 1;
  156.     const uint8 *src[2] = {
  157.         (const uint8 *)mpSrc->GetRow(y2, mSrcIndex),
  158.         (const uint8 *)mpSrc->GetRow(y2+1, mSrcIndex),
  159.     };
  160.  
  161.     nsVDPixmapSpanUtils::vert_expand2x_centered((uint8 *)dst0, src, mWidth, ~y << 7);
  162. }
  163.  
  164. ///////////////////////////////////////////////////////////////////////////////
  165.  
  166. void VDPixmapGenResampleCol_d4_pn38_lin_u8::Init(IVDPixmapGen *src, uint32 srcIndex) {
  167.     InitSource(src, srcIndex);
  168.     src->AddWindowRequest(-1, 1);
  169.  
  170.     mHeight = mSrcHeight * 4;
  171. }
  172.  
  173. void VDPixmapGenResampleCol_d4_pn38_lin_u8::Start() {
  174.     mpSrc->Start();
  175.     StartWindow(mWidth);
  176. }
  177.  
  178. void VDPixmapGenResampleCol_d4_pn38_lin_u8::Compute(void *dst0, sint32 y) {
  179.     sint32 y2 = (y - 2) >> 2;
  180.     const uint8 *src[2] = {
  181.         (const uint8 *)mpSrc->GetRow(y2, mSrcIndex),
  182.         (const uint8 *)mpSrc->GetRow(y2+1, mSrcIndex),
  183.     };
  184.  
  185.     nsVDPixmapSpanUtils::vert_expand4x_centered((uint8 *)dst0, src, mWidth, (y - 2) << 6);
  186. }
  187.