| 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_reconPicYuv; |
| 48 | |
| 49 | /* Data associated with x265_picture */ |
| 50 | PicYuv* m_origPicYuv; |
| 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 | x265_intra_data* m_intraData; |
| 57 | x265_inter_data* m_interData; |
| 58 | void* m_userData; // user provided pointer passed in with this picture |
| 59 | |
| 60 | Lowres m_lowres; |
| 61 | bool m_bChromaExtended; // orig chroma planes motion extended for weight analysis |
| 62 | |
| 63 | /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */ |
| 64 | ThreadSafeInteger m_reconRowCount; // count of CTU rows completely reconstructed and extended for motion reference |
| 65 | volatile uint32_t m_countRefEncoders; // count of FrameEncoder threads monitoring m_reconRowCount |
| 66 | |
| 67 | Frame* m_next; // PicList doubly linked list pointers |
| 68 | Frame* m_prev; |
| 69 | |
| 70 | Frame(); |
| 71 | |
| 72 | bool create(x265_param *param); |
| 73 | bool allocEncodeData(x265_param *param, const SPS& sps); |
| 74 | void reinit(const SPS& sps); |
| 75 | void destroy(); |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | #endif // ifndef X265_FRAME_H |