1 /* 2 * Copyright(c) 2018 Intel Corporation 3 * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 */ 5 6 #ifndef EbPictureBuffer_h 7 #define EbPictureBuffer_h 8 9 #include <stdio.h> 10 #include "EbDefinitions.h" 11 #include "EbObject.h" 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 #define PICTURE_BUFFER_DESC_Y_FLAG (1 << 0) 16 #define PICTURE_BUFFER_DESC_Cb_FLAG (1 << 1) 17 #define PICTURE_BUFFER_DESC_Cr_FLAG (1 << 2) 18 #define PICTURE_BUFFER_DESC_LUMA_MASK PICTURE_BUFFER_DESC_Y_FLAG 19 #define PICTURE_BUFFER_DESC_CHROMA_MASK (PICTURE_BUFFER_DESC_Cb_FLAG | PICTURE_BUFFER_DESC_Cr_FLAG) 20 #define PICTURE_BUFFER_DESC_FULL_MASK (PICTURE_BUFFER_DESC_Y_FLAG | PICTURE_BUFFER_DESC_Cb_FLAG | PICTURE_BUFFER_DESC_Cr_FLAG) 21 22 /************************************ 23 * EbPictureBufferDesc 24 ************************************/ 25 typedef struct EbPictureBufferDesc_s 26 { 27 EbDctor dctor; 28 // Buffer Ptrs 29 EB_BYTE bufferY; // Pointer to the Y luma buffer 30 EB_BYTE bufferCb; // Pointer to the U chroma buffer 31 EB_BYTE bufferCr; // Pointer to the V chroma buffer 32 33 // Pointer of buffer can be changed in 10bit encoding which causes issue when being freed. 34 // Workaround: record the original address of the buffer. 35 EB_BYTE bufferYAddress; // Original Address of the Y luma buffer 36 EB_BYTE bufferCbAddress; // Original Address of the U chroma buffer 37 EB_BYTE bufferCrAddress; // Original Address of the V chroma buffer 38 39 //Bit increment 40 EB_BYTE bufferBitIncY; // Pointer to the Y luma buffer Bit increment 41 EB_BYTE bufferBitIncCb; // Pointer to the U chroma buffer Bit increment 42 EB_BYTE bufferBitIncCr; // Pointer to the V chroma buffer Bit increment 43 44 EB_U16 strideY; // stride of the Y luma buffer 45 EB_U16 strideCb; // stride of the U chroma buffer 46 EB_U16 strideCr; // stride of the V chroma buffer 47 48 EB_U16 strideBitIncY; // stride of the Y luma buffer Bit increment 49 EB_U16 strideBitIncCb; // stride of the U chroma buffer Bit increment 50 EB_U16 strideBitIncCr; // stride of the V chroma buffer Bit increment 51 52 // Picture Parameters 53 EB_U16 originX; // Horizontal padding distance 54 EB_U16 originY; // Vertical padding distance 55 EB_U16 width; // Luma picture width which excludes the padding 56 EB_U16 height; // Luma picture height which excludes the padding 57 EB_U16 maxWidth; // Luma picture width 58 EB_U16 maxHeight; // Luma picture height 59 EB_BITDEPTH bitDepth; // Pixel Bit Depth 60 EB_COLOR_FORMAT colorFormat; // Chroma subsampling format 61 62 // Buffer Parameters 63 EB_U32 lumaSize; // Size of the luma buffer 64 EB_U32 chromaSize; // Size of the chroma buffers 65 EB_BOOL packedFlag; // Indicates if sample buffers are packed or not 66 67 EB_SEI_MESSAGE dolbyVisionRpu; 68 EB_SEI_MESSAGE userSeiMsg; 69 EB_U32 bufferEnableMask; 70 } EbPictureBufferDesc_t; 71 72 /************************************ 73 * EbPictureBufferDesc Init Data 74 ************************************/ 75 typedef struct EbPictureBufferDescInitData_s 76 { 77 EB_U16 maxWidth; 78 EB_U16 maxHeight; 79 EB_BITDEPTH bitDepth; 80 EB_COLOR_FORMAT colorFormat; 81 EB_U32 bufferEnableMask; 82 EB_U16 leftPadding; 83 EB_U16 rightPadding; 84 EB_U16 topPadding; 85 EB_U16 botPadding; 86 EB_BOOL splitMode; //ON: allocate 8bit data separately from nbit data 87 88 } EbPictureBufferDescInitData_t; 89 90 /************************************** 91 * Extern Function Declarations 92 **************************************/ 93 extern EB_ERRORTYPE EbPictureBufferDescCtor( 94 EbPictureBufferDesc_t *objectPtr, 95 EB_PTR objectInitDataPtr); 96 97 extern EB_ERRORTYPE EbReconPictureBufferDescCtor( 98 EbPictureBufferDesc_t *objectPtr, 99 EB_PTR objectInitDataPtr); 100 101 #ifdef __cplusplus 102 } 103 #endif 104 #endif // EbPictureBuffer_h 105