mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Use a larger number of bits for POC lsb when needed
Changes the number of bits used for coding the least significant bits of the POC based on the GOP size.
This commit is contained in:
parent
d757a832c2
commit
c8fff1e0d6
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "cfg.h"
|
||||
#include "strategyselector.h"
|
||||
#include "kvz_math.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@ -237,6 +238,8 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg)
|
|||
}
|
||||
}
|
||||
|
||||
encoder->poc_lsb_bits = MAX(4, kvz_math_ceil_log2(encoder->cfg.gop_len * 2 + 1));
|
||||
|
||||
encoder->max_inter_ref_lcu.right = 1;
|
||||
encoder->max_inter_ref_lcu.down = 1;
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@ typedef struct encoder_control_t
|
|||
int down;
|
||||
} max_inter_ref_lcu;
|
||||
|
||||
int32_t poc_lsb_bits;
|
||||
|
||||
} encoder_control_t;
|
||||
|
||||
encoder_control_t* kvz_encoder_control_init(const kvz_config *cfg);
|
||||
|
|
|
@ -377,7 +377,8 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
|
|||
|
||||
WRITE_UE(stream, encoder->bitdepth-8, "bit_depth_luma_minus8");
|
||||
WRITE_UE(stream, encoder->bitdepth-8, "bit_depth_chroma_minus8");
|
||||
WRITE_UE(stream, 1, "log2_max_pic_order_cnt_lsb_minus4");
|
||||
WRITE_UE(stream, encoder->poc_lsb_bits - 4, "log2_max_pic_order_cnt_lsb_minus4");
|
||||
|
||||
WRITE_U(stream, 0, 1, "sps_sub_layer_ordering_info_present_flag");
|
||||
|
||||
//for each layer
|
||||
|
@ -715,16 +716,18 @@ static void kvz_encoder_state_write_bitstream_slice_header_independent(
|
|||
if (state->frame->pictype != KVZ_NAL_IDR_W_RADL
|
||||
&& state->frame->pictype != KVZ_NAL_IDR_N_LP)
|
||||
{
|
||||
const int poc_lsb = state->frame->poc & ((1 << encoder->poc_lsb_bits) - 1);
|
||||
WRITE_U(stream, poc_lsb, encoder->poc_lsb_bits, "pic_order_cnt_lsb");
|
||||
|
||||
int last_poc = 0;
|
||||
int poc_shift = 0;
|
||||
|
||||
WRITE_U(stream, state->frame->poc&0x1f, 5, "pic_order_cnt_lsb");
|
||||
WRITE_U(stream, 0, 1, "short_term_ref_pic_set_sps_flag");
|
||||
WRITE_UE(stream, ref_negative, "num_negative_pics");
|
||||
WRITE_UE(stream, ref_positive, "num_positive_pics");
|
||||
for (j = 0; j < ref_negative; j++) {
|
||||
WRITE_U(stream, 0, 1, "short_term_ref_pic_set_sps_flag");
|
||||
WRITE_UE(stream, ref_negative, "num_negative_pics");
|
||||
WRITE_UE(stream, ref_positive, "num_positive_pics");
|
||||
for (j = 0; j < ref_negative; j++) {
|
||||
int8_t delta_poc = 0;
|
||||
|
||||
|
||||
if (encoder->cfg.gop_len) {
|
||||
int8_t found = 0;
|
||||
do {
|
||||
|
|
Loading…
Reference in a new issue