Resizer.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 2011-2013 Doubango Telecom <http://www.doubango.org>
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO 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 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO 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 DOUBANGO.
  17. */
  18. /*
  19. * Copyright (c) Microsoft Corporation. All rights reserved.
  20. */
  21. #ifndef PLUGIN_DSHOW_RESIZER_H
  22. #define PLUGIN_DSHOW_RESIZER_H
  23. #include "plugin_dshow_config.h"
  24. /*
  25. * StretchC.C
  26. *
  27. * StretchBlt for DIBs
  28. *
  29. * C version of stretch.asm: StretchDIB optimised for AVI.
  30. *
  31. * NOTES
  32. * - does not handle mirroring in x or y
  33. * - does not handle pixel translation
  34. * - will not work in place.
  35. */
  36. /* Outline:
  37. *
  38. * we select a y-stretching function depending on the ratio (eg 1:N or N:1).
  39. * it copies scanlines from source to destination, duplicating or omitting
  40. * scanlines as necessary to fit the destination. It copies each scanline
  41. * via the X_FUNC function we passed as an argument: this copies one scanline
  42. * duplicating or omitting pixels to fit the destination: we select an X_FUNC
  43. * depending on the bit-depth as well as the x-stretching ratio.
  44. *
  45. * both x and y stretching functions use the following basic model for deciding
  46. * when to insert/omit elements:
  47. *
  48. * delta = <larger extent> -1;
  49. *
  50. * for (number of destination elements) {
  51. *
  52. * copy one element
  53. * advance pointer to larger region
  54. * delta -= <smaller extent>
  55. * if (delta < 0) {
  56. * delta += <larger extent>;
  57. * advance pointer to smaller region
  58. * }
  59. * }
  60. */
  61. #include <streams.h>
  62. void ResizeRGB( BITMAPINFOHEADER *pbiIn, //Src's BitMapInFoHeader
  63. const unsigned char * dibBits, //Src bits
  64. BITMAPINFOHEADER *pbiOut,
  65. unsigned char *pFrame, //Dst bits
  66. int iNewWidth, //new W in pixel
  67. int iNewHeight); //new H in pixel
  68. #endif //RESIZER_H