xref: /rockchip-linux_mpp/kmpp/base/inc/kmpp_frame_impl.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /* SPDX-License-Identifier: Apache-2.0 OR MIT */
2 /*
3  * Copyright (c) 2024 Rockchip Electronics Co., Ltd.
4  */
5 
6 #ifndef __KMPP_FRAME_IMPL_H__
7 #define __KMPP_FRAME_IMPL_H__
8 
9 #include "kmpp_frame.h"
10 
11 typedef struct KmppFrameImpl_t {
12     const char *name;
13     KmppObj obj;
14 
15     /*
16      * dimension parameter for display
17      */
18     rk_u32 width;
19     rk_u32 height;
20     rk_u32 hor_stride;
21     rk_u32 ver_stride;
22     rk_u32 hor_stride_pixel;
23     rk_u32 offset_x;
24     rk_u32 offset_y;
25 
26     /*
27      * poc - picture order count
28      */
29     rk_u32 poc;
30     /*
31      * pts - display time stamp
32      * dts - decode time stamp
33      */
34     rk_s64 pts;
35     rk_s64 dts;
36 
37     /*
38         * eos - end of stream
39         * info_change - set when buffer resized or frame infomation changed
40         */
41     rk_u32 eos;
42     MppFrameColorRange color_range;
43     MppFrameColorPrimaries color_primaries;
44     MppFrameColorTransferCharacteristic color_trc;
45 
46     /**
47      * YUV colorspace type.
48      * It must be accessed using av_frame_get_colorspace() and
49      * av_frame_set_colorspace().
50      * - encoding: Set by user
51      * - decoding: Set by libavcodec
52      */
53     MppFrameColorSpace colorspace;
54     MppFrameChromaLocation chroma_location;
55 
56     MppFrameFormat fmt;
57 
58     MppFrameRational sar;
59 
60     /*
61      * buffer information
62      * NOTE: buf_size only access internally
63      */
64     KmppShmPtr buffer;
65     size_t buf_size;
66     RK_U32 buf_fd;
67     /*
68      * frame buffer compression (FBC) information
69      *
70      * NOTE: some constraint on fbc data
71      * 1. FBC config need two addresses but only one buffer.
72      *    The second address should be represented by base + offset form.
73      * 2. FBC has header address and payload address
74      *    Both addresses should be 4K aligned.
75      * 3. The header section size is default defined by:
76      *    header size = aligned(aligned(width, 16) * aligned(height, 16) / 16, 4096)
77      * 4. The stride in header section is defined by:
78      *    stride = aligned(width, 16)
79      */
80     rk_u32 fbc_offset;
81     rk_u32 is_gray;
82 
83     KmppShmPtr meta;
84     KmppMeta self_meta;
85 } KmppFrameImpl;
86 
87 typedef struct KmppFramePriv_t {
88     KmppMeta    meta;
89 } KmppFramePriv;
90 
91 #endif /* __KMPP_FRAME_IMPL_H__ */
92