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