Fix POC bug

This commit is contained in:
Laurent Fasnacht 2014-06-11 10:09:38 +02:00
parent 8437229885
commit 6ca30367f9
3 changed files with 19 additions and 6 deletions

View file

@ -605,13 +605,19 @@ static void encoder_state_encode(encoder_state * const main_state) {
}
}
static void encoder_state_clear_refs(encoder_state *encoder_state) {
//FIXME: Do we need to handle children? At present they all share the same global
while (encoder_state->global->ref->used_size) {
image_list_rem(encoder_state->global->ref, encoder_state->global->ref->used_size - 1);
static void encoder_state_clear_refs(encoder_state *main_state) {
int i;
while (main_state->global->ref->used_size) {
image_list_rem(main_state->global->ref, main_state->global->ref->used_size - 1);
}
encoder_state->global->poc = 0;
main_state->global->poc = 0;
videoframe_set_poc(main_state->tile->frame, 0);
for (i=0; main_state->children[i].encoder_control; ++i) {
encoder_state *sub_state = &(main_state->children[i]);
encoder_state_clear_refs(sub_state);
}
}
static void encoder_state_new_frame(encoder_state * const main_state) {
@ -771,6 +777,7 @@ void encoder_next_frame(encoder_state *encoder_state) {
encoder_state->global->poc++;
encoder_state->tile->frame->rec = image_alloc(encoder_state->tile->frame->width, encoder_state->tile->frame->height, encoder_state->global->poc);
videoframe_set_poc(encoder_state->tile->frame, encoder_state->global->poc);
}

View file

@ -93,6 +93,12 @@ int videoframe_free(videoframe * const frame)
return 1;
}
void videoframe_set_poc(videoframe * const frame, const int32_t poc) {
frame->source->poc = poc;
frame->rec->poc = poc;
frame->poc = poc;
}
const cu_info* videoframe_get_cu_const(const videoframe * const frame, unsigned int x_in_scu, unsigned int y_in_scu) {
assert(x_in_scu < (frame->width_in_lcu << MAX_DEPTH));
assert(y_in_scu < (frame->height_in_lcu << MAX_DEPTH));

View file

@ -57,7 +57,7 @@ typedef struct videoframe
videoframe *videoframe_alloc(int32_t width, int32_t height, int32_t poc);
int videoframe_free(videoframe * const frame);
//void videoframe_set_poc(videoframe * frame, int32_t poc);
void videoframe_set_poc(videoframe * frame, int32_t poc);
const cu_info* videoframe_get_cu_const(const videoframe * const frame, unsigned int x_in_scu, unsigned int y_in_scu);
cu_info* videoframe_get_cu(videoframe * const frame, const unsigned int x_in_scu, const unsigned int y_in_scu);