mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Restored parallelism, but it will be done in another way... OpenMP is not very efficient in these kind of dynamic situation
This commit is contained in:
parent
0e6f1c99fc
commit
b48a687d3c
|
@ -1154,8 +1154,32 @@ static void encoder_state_encode_tile(encoder_state * const encoder_state) {
|
|||
static void encoder_state_encode(encoder_state * const main_state) {
|
||||
//If we have children, encode at child level
|
||||
if (main_state->children[0].encoder_control) {
|
||||
int i=0;
|
||||
for (i=0; main_state->children[i].encoder_control; ++i) {
|
||||
int i=0, max_i=0;
|
||||
//OpenMP doesn't like aving a stop condition like main_state->children[i].encoder_control.
|
||||
//We compute max_i to avoid this.
|
||||
for (i=0; main_state->children[i].encoder_control; ++i);
|
||||
max_i = i;
|
||||
if (max_i > 1) {
|
||||
#pragma omp parallel for
|
||||
for (i=0; i < max_i; ++i) {
|
||||
encoder_state *sub_state = &(main_state->children[i]);
|
||||
|
||||
if (sub_state->tile != main_state->tile) {
|
||||
encoder_state_blit_pixels(sub_state, sub_state->tile->cur_pic->y_data, main_state, main_state->tile->cur_pic->y_data, 1);
|
||||
encoder_state_blit_pixels(sub_state, sub_state->tile->cur_pic->u_data, main_state, main_state->tile->cur_pic->u_data, 0);
|
||||
encoder_state_blit_pixels(sub_state, sub_state->tile->cur_pic->v_data, main_state, main_state->tile->cur_pic->v_data, 0);
|
||||
}
|
||||
encoder_state_encode(&main_state->children[i]);
|
||||
//FIXME: substream_write_bitstream(subencoder, (main_state->children[i+1].encoder_control) != NULL);
|
||||
|
||||
if (sub_state->tile != main_state->tile) {
|
||||
encoder_state_blit_pixels(main_state, main_state->tile->cur_pic->y_recdata, sub_state, sub_state->tile->cur_pic->y_recdata, 1);
|
||||
encoder_state_blit_pixels(main_state, main_state->tile->cur_pic->u_recdata, sub_state, sub_state->tile->cur_pic->u_recdata, 0);
|
||||
encoder_state_blit_pixels(main_state, main_state->tile->cur_pic->v_recdata, sub_state, sub_state->tile->cur_pic->v_recdata, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
i=0;
|
||||
encoder_state *sub_state = &(main_state->children[i]);
|
||||
|
||||
if (sub_state->tile != main_state->tile) {
|
||||
|
|
Loading…
Reference in a new issue