1 /*****************************************************************************
2 * copy.h: Fast YV12/NV12 copy
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
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_
30 # ifdef CAN_COMPILE_SSE2
36 int CopyInitCache(copy_cache_t
*cache
, unsigned width
);
37 void CopyCleanCache(copy_cache_t
*cache
);
39 /* Copy planes from NV12/NV21 to NV12/NV21 */
40 void Copy420_SP_to_SP(picture_t
*dst
, const uint8_t *src
[static 2],
41 const size_t src_pitch
[static 2], unsigned height
,
42 const copy_cache_t
*cache
);
44 /* Copy planes from I420/YV12 to I420/YV12 */
45 void Copy420_P_to_P(picture_t
*dst
, const uint8_t *src
[static 3],
46 const size_t src_pitch
[static 3], unsigned height
,
47 const copy_cache_t
*cache
);
49 /* Copy planes from I420/YV12 to NV12/NV21 */
50 void Copy420_P_to_SP(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 NV12/NV21 to I420/YV12 */
55 void Copy420_SP_to_P(picture_t
*dst
, const uint8_t *src
[static 2],
56 const size_t src_pitch
[static 2], unsigned height
,
57 const copy_cache_t
*cache
);
59 /* Copy planes from I420_10 to P010. A positive bitshift value will shift bits
60 * to the right, a negative value will shift to the left. */
61 void Copy420_16_P_to_SP(picture_t
*dst
, const uint8_t *src
[static 3],
62 const size_t src_pitch
[static 3], unsigned height
,
63 int bitshift
, const copy_cache_t
*cache
);
65 /* Copy planes from P010 to I420_10. A positive bitshift value will shift bits
66 * to the right, a negative value will shift to the left. */
67 void Copy420_16_SP_to_P(picture_t
*dst
, const uint8_t *src
[static 2],
68 const size_t src_pitch
[static 2], unsigned height
,
69 int bitshift
, const copy_cache_t
*cache
);
71 /* XXX: Not optimized copy (no SEE) */
72 void CopyFromI420_10ToP010(picture_t
*dst
, const uint8_t *src
[static 3],
73 const size_t src_pitch
[static 3],
74 unsigned height
, const copy_cache_t
*cache
);
77 * This functions sets the internal plane pointers/dimensions for the given
79 * This is useful when mapping opaque surfaces into CPU planes.
81 * picture is the picture to update
82 * data is the buffer pointer to use as the start of data for all the planes
83 * pitch is the internal line pitch for the buffer
85 int picture_UpdatePlanes(picture_t
*picture
, uint8_t *data
, unsigned pitch
);