Commit e4d6f9bf authored by Sebastien Alaiwan's avatar Sebastien Alaiwan Committed by Frédéric BARBIER

Simplify flow of control

Change-Id: Idded8f8774c10c53fba59e7b834583399e57225c
parent a1d0c4d5
......@@ -1225,47 +1225,47 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
return AOM_CODEC_ERROR;
}
#endif
if (frame_size) {
// Pack invisible frames with the next visible frame
if (!cpi->common.show_frame) {
if (ctx->pending_cx_data == 0) ctx->pending_cx_data = cx_data;
ctx->pending_cx_data_sz += frame_size;
ctx->pending_frame_sizes[ctx->pending_frame_count++] = frame_size;
cx_data += frame_size;
cx_data_sz -= frame_size;
continue;
}
// Add the frame packet to the list of returned packets.
aom_codec_cx_pkt_t pkt;
pkt.kind = AOM_CODEC_CX_FRAME_PKT;
pkt.data.frame.pts = ticks_to_timebase_units(timebase, dst_time_stamp);
pkt.data.frame.duration = (unsigned long)ticks_to_timebase_units(
timebase, dst_end_time_stamp - dst_time_stamp);
pkt.data.frame.flags = get_frame_pkt_flags(cpi, lib_flags);
if (ctx->pending_cx_data) {
ctx->pending_frame_sizes[ctx->pending_frame_count++] = frame_size;
ctx->pending_cx_data_sz += frame_size;
frame_size += write_superframe_index(ctx);
pkt.data.frame.buf = ctx->pending_cx_data;
pkt.data.frame.sz = ctx->pending_cx_data_sz;
ctx->pending_cx_data = NULL;
ctx->pending_cx_data_sz = 0;
ctx->pending_frame_count = 0;
} else {
pkt.data.frame.buf = cx_data;
pkt.data.frame.sz = frame_size;
}
pkt.data.frame.partition_id = -1;
aom_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
if (!frame_size) continue;
// Pack invisible frames with the next visible frame
if (!cpi->common.show_frame) {
if (ctx->pending_cx_data == 0) ctx->pending_cx_data = cx_data;
ctx->pending_cx_data_sz += frame_size;
ctx->pending_frame_sizes[ctx->pending_frame_count++] = frame_size;
cx_data += frame_size;
cx_data_sz -= frame_size;
continue;
}
// Add the frame packet to the list of returned packets.
aom_codec_cx_pkt_t pkt;
pkt.kind = AOM_CODEC_CX_FRAME_PKT;
pkt.data.frame.pts = ticks_to_timebase_units(timebase, dst_time_stamp);
pkt.data.frame.duration = (uint32_t)ticks_to_timebase_units(
timebase, dst_end_time_stamp - dst_time_stamp);
pkt.data.frame.flags = get_frame_pkt_flags(cpi, lib_flags);
if (ctx->pending_cx_data) {
ctx->pending_frame_sizes[ctx->pending_frame_count++] = frame_size;
ctx->pending_cx_data_sz += frame_size;
frame_size += write_superframe_index(ctx);
pkt.data.frame.buf = ctx->pending_cx_data;
pkt.data.frame.sz = ctx->pending_cx_data_sz;
ctx->pending_cx_data = NULL;
ctx->pending_cx_data_sz = 0;
ctx->pending_frame_count = 0;
} else {
pkt.data.frame.buf = cx_data;
pkt.data.frame.sz = frame_size;
}
pkt.data.frame.partition_id = -1;
aom_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
cx_data += frame_size;
cx_data_sz -= frame_size;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment