1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
4 * Author: Steve Borho <steve@borho.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
24 #ifndef X265_FRAMEDATA_H
25 #define X265_FRAMEDATA_H
36 /* Per-frame data that is used during encodes and referenced while the picture
37 * is available for reference. A FrameData instance is attached to a Frame as it
38 * comes out of the lookahead. Frames which are not being encoded do not have a
39 * FrameData instance. These instances are re-used once the encoded frame has
40 * no active references. They hold the Slice instance and the 'official' CTU
41 * data structures. They are maintained in a free-list pool along together with
42 * a reconstructed image PicYuv in order to conserve memory. */
51 FrameData
* m_freeListNext
;
53 bool m_bHasReferences
; /* used during DPB/RPS updates */
54 int m_frameEncoderID
; /* the ID of the FrameEncoder encoding this frame */
56 CUDataMemPool m_cuMemPool
;
59 /* Rate control data used during encode and by references */
62 uint32_t totalBits
; /* total bits to encode this CTU */
63 uint32_t vbvCost
; /* sum of lowres costs for 16x16 sub-blocks */
64 uint32_t intraVbvCost
; /* sum of lowres intra costs for 16x16 sub-blocks */
65 uint64_t avgCost
[4]; /* stores the avg cost of CU's in frame for each depth */
66 uint32_t count
[4]; /* count and avgCost only used by Analysis at RD0..4 */
67 double baseQp
; /* Qp of Cu set from RateControl/Vbv (only used by frame encoder) */
72 uint32_t numEncodedCUs
; /* ctuAddr of last encoded CTU in row */
73 uint32_t encodedBits
; /* sum of 'totalBits' of encoded CTUs */
74 uint32_t satdForVbv
; /* sum of lowres (estimated) costs for entire row */
76 uint32_t diagIntraSatd
;
86 double m_avgQpRc
; /* avg QP as decided by rate-control */
87 double m_avgQpAq
; /* avg QP as decided by AQ in addition to rate-control */
88 double m_rateFactor
; /* calculated based on the Frame QP */
92 bool create(x265_param
*param
, const SPS
& sps
);
93 void reinit(const SPS
& sps
);
96 CUData
* getPicCTU(uint32_t ctuAddr
) { return &m_picCTU
[ctuAddr
]; }
100 #endif // ifndef X265_FRAMEDATA_H