mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Keep track of total number of bits coded.
Adds total_bits_coded into encoder_state_config_global_t. The count is updated whenever a frame is written.
This commit is contained in:
parent
815a2bea55
commit
5b8cd76f01
|
@ -738,7 +738,7 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state) {
|
|||
uint64_t newpos;
|
||||
int i;
|
||||
|
||||
curpos = bitstream_tell(stream) >> 3;
|
||||
curpos = bitstream_tell(stream);
|
||||
|
||||
// The first NAL unit of the access unit must use a long start code.
|
||||
bool first_nal_in_au = true;
|
||||
|
@ -803,8 +803,12 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state) {
|
|||
assert(state->tile->frame->poc == state->global->poc);
|
||||
|
||||
//Get bitstream length for stats
|
||||
newpos = bitstream_tell(stream) >> 3;
|
||||
state->stats_bitstream_length = newpos - curpos;
|
||||
newpos = bitstream_tell(stream);
|
||||
state->stats_bitstream_length = (newpos >> 3) - (curpos >> 3);
|
||||
if (state->global->frame > 0) {
|
||||
state->global->total_bits_coded = state->previous_encoder_state->global->total_bits_coded;
|
||||
}
|
||||
state->global->total_bits_coded += newpos - curpos;
|
||||
|
||||
// Flush the output in case someone is reading the file on the other end.
|
||||
fflush(state->stream.file.output);
|
||||
|
|
|
@ -34,6 +34,7 @@ static int encoder_state_config_global_init(encoder_state_t * const state) {
|
|||
state->global->ref_list = REF_PIC_LIST_0;
|
||||
state->global->frame = 0;
|
||||
state->global->poc = 0;
|
||||
state->global->total_bits_coded = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ typedef struct {
|
|||
bool is_idr_frame;
|
||||
uint8_t pictype;
|
||||
uint8_t slicetype;
|
||||
|
||||
//! Total number of bits written.
|
||||
uint64_t total_bits_coded;
|
||||
|
||||
} encoder_state_config_global_t;
|
||||
|
||||
|
|
Loading…
Reference in a new issue