3
* Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
5
* This file is part of libde265.
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.
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.
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/>.
21
#include "libde265/encoder/sop.h"
22
#include "libde265/encoder/encoder-context.h"
25
sop_creator_intra_only::sop_creator_intra_only()
30
void sop_creator_intra_only::set_SPS_header_values()
32
mEncCtx->sps.log2_max_pic_order_cnt_lsb = get_num_poc_lsb_bits();
36
void sop_creator_intra_only::insert_new_input_image(de265_image* img)
38
img->PicOrderCntVal = get_pic_order_count();
41
int poc = get_pic_order_count();
44
image_data* imgdata = mEncPicBuf->insert_next_image_in_encoding_order(img, get_frame_number());
47
imgdata->set_NAL_type(NAL_UNIT_IDR_N_LP);
48
imgdata->shdr.slice_type = SLICE_TYPE_I;
49
imgdata->shdr.slice_pic_order_cnt_lsb = get_pic_order_count_lsb();
51
mEncPicBuf->sop_metadata_commit(get_frame_number());
57
// ---------------------------------------------------------------------------
60
sop_creator_trivial_low_delay::sop_creator_trivial_low_delay()
65
void sop_creator_trivial_low_delay::set_SPS_header_values()
68
rps.DeltaPocS0[0] = -1;
69
rps.UsedByCurrPicS0[0] = true;
70
rps.NumNegativePics = 1;
71
rps.NumPositivePics = 0;
72
rps.compute_derived_values();
73
mEncCtx->sps.ref_pic_sets.push_back(rps);
74
mEncCtx->sps.log2_max_pic_order_cnt_lsb = get_num_poc_lsb_bits();
78
void sop_creator_trivial_low_delay::insert_new_input_image(de265_image* img)
80
img->PicOrderCntVal = get_pic_order_count();
82
int frame = get_frame_number();
84
std::vector<int> l0, l1, empty;
85
if (!isIntra(frame)) {
86
l0.push_back(frame-1);
90
image_data* imgdata = mEncPicBuf->insert_next_image_in_encoding_order(img, get_frame_number());
95
imgdata->set_NAL_type(NAL_UNIT_IDR_N_LP);
96
imgdata->shdr.slice_type = SLICE_TYPE_I;
98
imgdata->set_references(0, l0,l1, empty,empty);
99
imgdata->set_NAL_type(NAL_UNIT_TRAIL_R);
100
imgdata->shdr.slice_type = SLICE_TYPE_P;
102
imgdata->shdr.slice_pic_order_cnt_lsb = get_pic_order_count_lsb();
103
mEncPicBuf->sop_metadata_commit(get_frame_number());