1 /*
2  * Copyright (C) 2016 Google, Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  */
14 
15 #ifndef __GOLDFISH_FORMATCONVERSIONS_H__
16 #define __GOLDFISH_FORMATCONVERSIONS_H__
17 
18 #include <inttypes.h>
19 
20 // format conversions and helper functions
21 void get_yv12_offsets(int width, int height,
22                       uint32_t* yStride_out,
23                       uint32_t* cStride_out,
24                       uint32_t* totalSz_out);
25 void get_yuv420p_offsets(int width, int height,
26                          uint32_t* yStride_out,
27                          uint32_t* cStride_out,
28                          uint32_t* totalSz_out);
29 signed clamp_rgb(signed value);
30 void rgb565_to_yv12(char* dest, char* src, int width, int height,
31                     int left, int top, int right, int bottom);
32 void rgb888_to_yv12(char* dest, char* src, int width, int height,
33                     int left, int top, int right, int bottom);
34 void rgb888_to_yuv420p(char* dest, char* src, int width, int height,
35                        int left, int top, int right, int bottom);
36 void yv12_to_rgb565(char* dest, char* src, int width, int height,
37                     int left, int top, int right, int bottom);
38 void yv12_to_rgb888(char* dest, char* src, int width, int height,
39                     int left, int top, int right, int bottom);
40 void yuv420p_to_rgb888(char* dest, char* src, int width, int height,
41                        int left, int top, int right, int bottom);
42 void copy_rgb_buffer_from_unlocked(char* _dst, char* raw_data,
43                                    int unlockedWidth,
44                                    int width, int height, int top, int left,
45                                    int bpp);
46 #endif
47