MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
decoder.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2008 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 #ifndef _DECODER_H
26 #define _DECODER_H
27 
28 #include "techtype.h"
29 
30 #define HAS_TRANSPARENCY 0x00
31 #define COMPLETELY_OPAQUE 0x01
32 
33 #define PIX_BYTES_PLT 1
34 #define PIX_BYTES_RGB 3
35 #define PIX_BYTES_ARGB 4
36 
37 #define SD_METRIC_RESOLUTION 2835
38 #define HD_720_METRIC_RESOLUTION 3543
39 #define HD_1080_METRIC_RESOLUTION 5315
40 
41 /* Structure: 'S_IMAGE'
42  * Only
43  * 'width' and 'height' are in pixels of the bitmap.
44  * 'y_resolution' is in pixels per meter (on y axis). It is expected that bitmap resolution
45  * could be - 0 or 2835, 3543, 5315. These correspond to bitmaps adapted to screen resolutions:
46  * 720x576 (in case of 0 or 2835), 1280x720 (in case of 3543) and 1920x1080 (in case of 5315)
47  *
48  * 'pix_bytes' is the number of bytes per pixel - 1, 3 or 4.
49  * For value of 1 (palette data), the buffer should use the palette given by MHEG5_Open
50  * For value of 3 (RGB colour data), 'opaque' should always be set to COMPLETELY_OPAQUE.
51  * For value of 4 (ARGB colour data), 'opaque' could be set to COMPLETELY_OPAQUE, if all data is so.
52  *
53  * Values for 'opaque' indicate whether entire buffer has opaque colours
54  * This can helps later with speed of pixel blending
55  */
56 typedef struct s_image
57 {
58  U16BIT width;
59  U16BIT height;
60  U16BIT y_resolution;
61  U8BIT pix_bytes;
62  U8BIT opaque;
63  U8BIT *col_buff;
64 } S_IMAGE;
65 
66 
67 /*-------------------------------------------------------------------------------*
68  * Functions optionally provided by Receiver Platform *
69  * - when not using PNG/JPG libraries from Ocean Blue *
70  *-------------------------------------------------------------------------------*/
71 
79 S_IMAGE* DEC_DecodePng( U8BIT *data, U32BIT size );
80 
81 
87 void DEC_FreePng( S_IMAGE *image );
88 
89 
97 S_IMAGE* DEC_DecodeJpg( U8BIT *data, U32BIT size );
98 
99 
105 void DEC_FreeJpg( S_IMAGE *image );
106 
107 
130 void* DEC_OSDCreateBmpSurf( U32BIT s_width, U32BIT s_height,
131  U32BIT i_width, U32BIT i_height,
132  S_IMAGE *image, U32BIT *pitch );
133 
134 #endif /* _DECODER_H */
void DEC_FreeJpg(S_IMAGE *image)
Free memory allocated for JPEG bitmap.
Definition: mg_jpg.c:495
void DEC_FreePng(S_IMAGE *image)
Free memory allocated for PNG bitmap.
Definition: mg_png.c:637
S_IMAGE * DEC_DecodeJpg(U8BIT *data, U32BIT size)
Allocate memory for JPEG and decode bitmap To free "S_IMAGE" memory, DEC_FreeJpg will be called...
Definition: mg_jpg.c:324
System Wide Global Technical Data Type Definitions.
S_IMAGE * DEC_DecodePng(U8BIT *data, U32BIT size)
Allocate memory for PNG and decode bitmap To free "S_IMAGE" memory, DEC_FreePng will be called...
Definition: mg_png.c:332
Definition: decoder.h:56
void * DEC_OSDCreateBmpSurf(U32BIT s_width, U32BIT s_height, U32BIT i_width, U32BIT i_height, S_IMAGE *image, U32BIT *pitch)
This creates a hardware surface of size using STB_OSDMhegCreateSurface() with s_width and s_height...
Definition: mg_bitmap.c:1397