huangcm
2025-04-22 c8cf547b11f2c03565d8fb8b8bcdc69860d0ed08
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
/*
 * Copyright (C) 2016 Google, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program 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.
 *
 */
 
#ifndef __GOLDFISH_FORMATCONVERSIONS_H__
#define __GOLDFISH_FORMATCONVERSIONS_H__
 
#include <inttypes.h>
 
// format conversions and helper functions
void get_yv12_offsets(int width, int height,
                      uint32_t* yStride_out,
                      uint32_t* cStride_out,
                      uint32_t* totalSz_out);
void get_yuv420p_offsets(int width, int height,
                         uint32_t* yStride_out,
                         uint32_t* cStride_out,
                         uint32_t* totalSz_out);
signed clamp_rgb(signed value);
void rgb565_to_yv12(char* dest, char* src, int width, int height,
                    int left, int top, int right, int bottom);
void rgb888_to_yv12(char* dest, char* src, int width, int height,
                    int left, int top, int right, int bottom);
void rgb888_to_yuv420p(char* dest, char* src, int width, int height,
                       int left, int top, int right, int bottom);
void yv12_to_rgb565(char* dest, char* src, int width, int height,
                    int left, int top, int right, int bottom);
void yv12_to_rgb888(char* dest, char* src, int width, int height,
                    int left, int top, int right, int bottom);
void yuv420p_to_rgb888(char* dest, char* src, int width, int height,
                       int left, int top, int right, int bottom);
void copy_rgb_buffer_from_unlocked(char* _dst, char* raw_data,
                                   int unlockedWidth,
                                   int width, int height, int top, int left,
                                   int bpp);
#endif