qml: Create MediaGroupDisplay
[vlc.git] / modules / video_chroma / copy.h
blobb06dc680ccca32e269357a1fd20311b4bdaf2213
1 /*****************************************************************************
2 * copy.h: Fast YV12/NV12 copy
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
6 * Authors: Laurent Aimar <fenrir_AT_ videolan _DOT_ org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef VLC_VIDEOCHROMA_COPY_H_
24 #define VLC_VIDEOCHROMA_COPY_H_
26 #include <assert.h>
28 typedef struct {
29 # ifdef CAN_COMPILE_SSE2
30 uint8_t *buffer;
31 size_t size;
32 # else
33 char dummy;
34 # endif
35 } copy_cache_t;
37 int CopyInitCache(copy_cache_t *cache, unsigned width);
38 void CopyCleanCache(copy_cache_t *cache);
40 /* YUVY/RGB copies */
41 void CopyPacked(picture_t *dst, const uint8_t *src,
42 const size_t src_pitch, unsigned height,
43 const copy_cache_t *cache);
45 /* Copy planes from NV12/NV21 to NV12/NV21 */
46 void Copy420_SP_to_SP(picture_t *dst, const uint8_t *src[static 2],
47 const size_t src_pitch[static 2], unsigned height,
48 const copy_cache_t *cache);
50 /* Copy planes from I420/YV12 to I420/YV12 */
51 void Copy420_P_to_P(picture_t *dst, const uint8_t *src[static 3],
52 const size_t src_pitch[static 3], unsigned height,
53 const copy_cache_t *cache);
55 /* Copy planes from I420/YV12 to NV12/NV21 */
56 void Copy420_P_to_SP(picture_t *dst, const uint8_t *src[static 3],
57 const size_t src_pitch[static 3], unsigned height,
58 const copy_cache_t *cache);
60 /* Copy planes from NV12/NV21 to I420/YV12 */
61 void Copy420_SP_to_P(picture_t *dst, const uint8_t *src[static 2],
62 const size_t src_pitch[static 2], unsigned height,
63 const copy_cache_t *cache);
65 /* Copy planes from I420_10 to P010. A positive bitshift value will shift bits
66 * to the right, a negative value will shift to the left. */
67 void Copy420_16_P_to_SP(picture_t *dst, const uint8_t *src[static 3],
68 const size_t src_pitch[static 3], unsigned height,
69 int bitshift, const copy_cache_t *cache);
71 /* Copy planes from P010 to I420_10. A positive bitshift value will shift bits
72 * to the right, a negative value will shift to the left. */
73 void Copy420_16_SP_to_P(picture_t *dst, const uint8_t *src[static 2],
74 const size_t src_pitch[static 2], unsigned height,
75 int bitshift, const copy_cache_t *cache);
77 /**
78 * This functions sets the internal plane pointers/dimensions for the given
79 * buffer.
80 * This is useful when mapping opaque surfaces into CPU planes.
82 * picture is the picture to update
83 * data is the buffer pointer to use as the start of data for all the planes
84 * pitch is the internal line pitch for the buffer
86 int picture_UpdatePlanes(picture_t *picture, uint8_t *data, unsigned pitch);
88 #endif