1 /*
2  * H.265 video codec.
3  * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
4  *
5  * This file is part of libde265.
6  *
7  * libde265 is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * libde265 is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with libde265.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef DE265_REFPIC_H
22 #define DE265_REFPIC_H
23 
24 #include "libde265/bitstream.h"
25 
26 #define MAX_NUM_REF_PICS 16  // maximum defined by standard, may be lower for some Levels
27 
28 
29 class ref_pic_set
30 {
31  public:
32   // Lists of pictures that have to be kept in the decoded picture buffer for future
33   // reference and that may optionally be used for prediction in the current frame.
34   // Lists contain the relative POC positions.
35   int16_t DeltaPocS0[MAX_NUM_REF_PICS]; // sorted in decreasing order (e.g. -1, -2, -4, -7, ...)
36   int16_t DeltaPocS1[MAX_NUM_REF_PICS]; // sorted in ascending order (e.g. 1, 2, 4, 7)
37 
38   // flag for each reference whether this is actually used for prediction in the current frame
39   uint8_t UsedByCurrPicS0[MAX_NUM_REF_PICS];
40   uint8_t UsedByCurrPicS1[MAX_NUM_REF_PICS];
41 
42   uint8_t NumNegativePics;  // number of past reference pictures
43   uint8_t NumPositivePics;  // number of future reference pictures
44 
45   // --- derived values ---
46 
47   void compute_derived_values();
48 
49   uint8_t NumDeltaPocs;     // total number of reference pictures (past + future)
50 
51   uint8_t NumPocTotalCurr_shortterm_only; /* Total number of reference pictures that may actually
52                                              be used for prediction in the current frame. */
53 
54   void reset();
55 };
56 
57 
58 void dump_short_term_ref_pic_set(const ref_pic_set*, FILE* fh);
59 void dump_compact_short_term_ref_pic_set(const ref_pic_set* set, int range, FILE* fh);
60 
61 #endif
62