summaryrefslogtreecommitdiffstats
path: root/plugins/pluginDirectShow/internals/Resizer.h
blob: e91b980458f3fcab0bf354ee2209021d2dd62d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Copyright (C) 2011-2013 Doubango Telecom <http://www.doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*/
/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 */
#ifndef PLUGIN_DSHOW_RESIZER_H
#define PLUGIN_DSHOW_RESIZER_H

#include "plugin_dshow_config.h"

/*
* StretchC.C
*
* StretchBlt for DIBs
*
* C version of stretch.asm: StretchDIB optimised for AVI.
*
* NOTES
*	- does not handle mirroring in x or y
*	- does not handle pixel translation
*	- will not work in place.
*/


/* Outline:
*
* we select a y-stretching function depending on the ratio (eg 1:N or N:1).
* it copies scanlines from source to destination, duplicating or omitting
* scanlines as necessary to fit the destination. It copies each scanline
* via the X_FUNC function we passed as an argument: this copies one scanline
* duplicating or omitting pixels to fit the destination: we select an X_FUNC
* depending on the bit-depth as well as the x-stretching ratio.
*
* both x and y stretching functions use the following basic model for deciding
* when to insert/omit elements:
*
* 	delta = <larger extent> -1;
*
*      for (number of destination elements) {
*
*		copy one element
*		advance pointer to larger region
*		delta -= <smaller extent>
*		if (delta < 0) {
*			delta += <larger extent>;
*			advance pointer to smaller region
*		}
*	}
*/

#include <streams.h>


void ResizeRGB( BITMAPINFOHEADER *pbiIn,    //Src's BitMapInFoHeader
                const unsigned char * dibBits,    //Src bits
                BITMAPINFOHEADER *pbiOut,
                unsigned char *pFrame,    //Dst bits
                int iNewWidth,            //new W in pixel
                int iNewHeight);           //new H in pixel

#endif //RESIZER_H
OpenPOWER on IntegriCloud