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

  1. //    VirtualDub - Video processing and capture application
  2. //    Video decoding library
  3. //    Copyright (C) 1998-2006 Avery Lee
  4. //
  5. //    This program is free software; you can redistribute it and/or modify
  6. //    it under the terms of the GNU General Public License as published by
  7. //    the Free Software Foundation; either version 2 of the License, or
  8. //    (at your option) any later version.
  9. //
  10. //    This program is distributed in the hope that it will be useful,
  11. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. //    GNU General Public License for more details.
  14. //
  15. //    You should have received a copy of the GNU General Public License
  16. //    along with this program; if not, write to the Free Software
  17. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #include "common_png.h"
  20.  
  21. namespace nsVDPNG {
  22.     extern const uint8 kPNGSignature[8]={137,80,78,71,13,10,26,10};
  23. };
  24.  
  25. void VDAdler32Checker::Process(const void *src, sint32 len) {
  26.     const uint8 *s = (const uint8 *)src;
  27.  
  28.     while(len > 0) {
  29.         uint32 tc = len;
  30.         if (tc > 0x1000)
  31.             tc = 0x1000;
  32.  
  33.         len -= tc;
  34.         do {
  35.             mS1 += *s++;
  36.             mS2 += mS1;
  37.         } while(--tc);
  38.  
  39.         mS1 %= 65521;
  40.         mS2 %= 65521;
  41.     }
  42. }
  43.