Imported Upstream version 1.4+222+hg5f9f7194267b
[deb_x265.git] / source / common / frame.h
1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
3 *
4 * Author: Steve Borho <steve@borho.org>
5 *
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.
10 *
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.
15 *
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.
19 *
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
23
24 #ifndef X265_FRAME_H
25 #define X265_FRAME_H
26
27 #include "common.h"
28 #include "lowres.h"
29 #include "threading.h"
30
31 namespace x265 {
32 // private namespace
33
34 class FrameData;
35 class PicYuv;
36 struct SPS;
37
38 #define IS_REFERENCED(frame) (frame->m_lowres.sliceType != X265_TYPE_B)
39
40 class Frame
41 {
42 public:
43
44 /* These two items will be NULL until the Frame begins to be encoded, at which point
45 * it will be assigned a FrameData instance, which comes with a reconstructed image PicYuv */
46 FrameData* m_encData;
47 PicYuv* m_reconPic;
48
49 /* Data associated with x265_picture */
50 PicYuv* m_fencPic;
51 int m_poc;
52 int64_t m_pts; // user provided presentation time stamp
53 int64_t m_reorderedPts;
54 int64_t m_dts;
55 int32_t m_forceqp; // Force to use the qp specified in qp file
56 void* m_userData; // user provided pointer passed in with this picture
57
58 Lowres m_lowres;
59 bool m_bChromaExtended; // orig chroma planes motion extended for weight analysis
60
61 /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */
62 ThreadSafeInteger m_reconRowCount; // count of CTU rows completely reconstructed and extended for motion reference
63 volatile uint32_t m_countRefEncoders; // count of FrameEncoder threads monitoring m_reconRowCount
64
65 Frame* m_next; // PicList doubly linked list pointers
66 Frame* m_prev;
67
68 x265_analysis_data m_analysisData;
69 Frame();
70
71 bool create(x265_param *param);
72 bool allocEncodeData(x265_param *param, const SPS& sps);
73 void reinit(const SPS& sps);
74 void destroy();
75 };
76 }
77
78 #endif // ifndef X265_FRAME_H