mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Move fields from encoder_state_t to frame
Moves fields prepared and frame_done from encoder_state_t to encoder_state_config_frame_t.
This commit is contained in:
parent
97863cdaa2
commit
6c4f2d196a
|
@ -48,8 +48,11 @@ static int encoder_state_config_frame_init(encoder_state_t * const state) {
|
|||
state->frame->poc = 0;
|
||||
state->frame->total_bits_coded = 0;
|
||||
state->frame->cur_gop_bits_coded = 0;
|
||||
state->frame->prepared = 0;
|
||||
state->frame->done = 1;
|
||||
state->frame->rc_alpha = 3.2003;
|
||||
state->frame->rc_beta = -1.367;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -303,8 +306,6 @@ int kvz_encoder_state_init(encoder_state_t * const child_state, encoder_state_t
|
|||
child_state->children[0].encoder_control = NULL;
|
||||
child_state->tqj_bitstream_written = NULL;
|
||||
child_state->tqj_recon_done = NULL;
|
||||
child_state->prepared = 0;
|
||||
child_state->frame_done = 1;
|
||||
|
||||
if (!parent_state) {
|
||||
const encoder_control_t * const encoder = child_state->encoder_control;
|
||||
|
|
|
@ -967,7 +967,7 @@ void kvz_encode_one_frame(encoder_state_t * const state, kvz_picture* frame)
|
|||
assert(!state->tqj_bitstream_written);
|
||||
state->tqj_bitstream_written = job;
|
||||
}
|
||||
state->frame_done = 0;
|
||||
state->frame->done = 0;
|
||||
//kvz_threadqueue_flush(main_state->encoder_control->threadqueue);
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ void kvz_encoder_prepare(encoder_state_t *state)
|
|||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
|
||||
// The previous frame must be done before the next one is started.
|
||||
assert(state->frame_done);
|
||||
assert(state->frame->done);
|
||||
|
||||
if (state->frame->num == -1) {
|
||||
// We're at the first frame, so don't care about all this stuff.
|
||||
|
@ -993,7 +993,7 @@ void kvz_encoder_prepare(encoder_state_t *state)
|
|||
state->frame->poc = 0;
|
||||
assert(!state->tile->frame->source);
|
||||
assert(!state->tile->frame->rec);
|
||||
state->prepared = 1;
|
||||
state->frame->prepared = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ void kvz_encoder_prepare(encoder_state_t *state)
|
|||
state->frame->num = prev_state->frame->num + 1;
|
||||
state->frame->poc = prev_state->frame->poc + 1;
|
||||
|
||||
state->prepared = 1;
|
||||
state->frame->prepared = 1;
|
||||
}
|
||||
|
||||
coeff_scan_order_t kvz_get_scan_order(int8_t cu_type, int intra_mode, int depth)
|
||||
|
|
|
@ -88,6 +88,19 @@ typedef struct encoder_state_config_frame_t {
|
|||
double rc_alpha;
|
||||
double rc_beta;
|
||||
|
||||
/**
|
||||
* \brief Indicates that this encoder state is ready for encoding the
|
||||
* next frame i.e. kvz_encoder_prepare has been called.
|
||||
*/
|
||||
bool prepared;
|
||||
|
||||
/**
|
||||
* \brief Indicates that the previous frame has been encoded and the
|
||||
* encoded data written and the encoding the next frame has not been
|
||||
* started yet.
|
||||
*/
|
||||
bool done;
|
||||
|
||||
} encoder_state_config_frame_t;
|
||||
|
||||
typedef struct encoder_state_config_tile_t {
|
||||
|
@ -185,19 +198,6 @@ typedef struct encoder_state_t {
|
|||
bitstream_t stream;
|
||||
cabac_data_t cabac;
|
||||
|
||||
/**
|
||||
* \brief Indicates that this encoder state is ready for encoding the
|
||||
* next frame i.e. kvz_encoder_prepare has been called.
|
||||
*/
|
||||
int prepared;
|
||||
|
||||
/**
|
||||
* \brief Indicates that the previous frame has been encoded and the
|
||||
* encoded data written and the encoding the next frame has not been
|
||||
* started yet.
|
||||
*/
|
||||
int frame_done;
|
||||
|
||||
uint32_t stats_bitstream_length; //Bitstream length written in bytes
|
||||
|
||||
//Jobs to wait for
|
||||
|
|
|
@ -213,7 +213,7 @@ static int kvazaar_encode(kvz_encoder *enc,
|
|||
|
||||
encoder_state_t *state = &enc->states[enc->cur_state_num];
|
||||
|
||||
if (!state->prepared) {
|
||||
if (!state->frame->prepared) {
|
||||
kvz_encoder_prepare(state);
|
||||
}
|
||||
|
||||
|
@ -235,13 +235,13 @@ static int kvazaar_encode(kvz_encoder *enc,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!state->frame_done) {
|
||||
if (!state->frame->done) {
|
||||
// We started encoding a frame; move to the next encoder state.
|
||||
enc->cur_state_num = (enc->cur_state_num + 1) % (enc->num_encoder_states);
|
||||
}
|
||||
|
||||
encoder_state_t *output_state = &enc->states[enc->out_state_num];
|
||||
if (!output_state->frame_done &&
|
||||
if (!output_state->frame->done &&
|
||||
(pic_in == NULL || enc->cur_state_num == enc->out_state_num)) {
|
||||
|
||||
kvz_threadqueue_waitfor(enc->control->threadqueue, output_state->tqj_bitstream_written);
|
||||
|
@ -256,8 +256,8 @@ static int kvazaar_encode(kvz_encoder *enc,
|
|||
if (src_out) *src_out = kvz_image_copy_ref(output_state->tile->frame->source);
|
||||
if (info_out) set_frame_info(info_out, output_state);
|
||||
|
||||
output_state->frame_done = 1;
|
||||
output_state->prepared = 0;
|
||||
output_state->frame->done = 1;
|
||||
output_state->frame->prepared = 0;
|
||||
enc->frames_done += 1;
|
||||
|
||||
enc->out_state_num = (enc->out_state_num + 1) % (enc->num_encoder_states);
|
||||
|
|
Loading…
Reference in a new issue