Fix for input_read_thread() in the case when interlaced source-scan-type is used

This commit is contained in:
Marko Viitanen 2016-01-25 10:15:02 +02:00
parent 198204a20a
commit 441ce7728f

View file

@ -165,8 +165,6 @@ static void* input_read_thread(void* in_args) {
if (args->field_parity == 0) { if (args->field_parity == 0) {
if (yuv_io_read(args->input, args->opts->config->width, args->opts->config->height, frame_in)) { if (yuv_io_read(args->input, args->opts->config->width, args->opts->config->height, frame_in)) {
args->img_in[frames_read & 1] = frame_in; args->img_in[frames_read & 1] = frame_in;
frames_read ++;
frame_in = NULL;
} else { } else {
// EOF or some error // EOF or some error
if (!feof(args->input)) { if (!feof(args->input)) {
@ -180,9 +178,16 @@ static void* input_read_thread(void* in_args) {
if (args->encoder->cfg->source_scan_type != 0) { if (args->encoder->cfg->source_scan_type != 0) {
args->img_in[frames_read & 1] = args->api->picture_alloc(args->encoder->in.width, args->encoder->in.height); args->img_in[frames_read & 1] = args->api->picture_alloc(args->encoder->in.width, args->encoder->in.height);
yuv_io_extract_field(frame_in, args->encoder->cfg->source_scan_type, args->field_parity, args->img_in[frames_read & 1]); yuv_io_extract_field(frame_in, args->encoder->cfg->source_scan_type, args->field_parity, args->img_in[frames_read & 1]);
if (args->field_parity == 1) args->api->picture_free(frame_in); if (args->field_parity == 1) {
args->field_parity ^= 1; //0->1 or 1->0 args->api->picture_free(frame_in);
frame_in = NULL;
} }
args->field_parity ^= 1; //0->1 or 1->0
} else {
frame_in = NULL;
}
frames_read++;
} else { } else {
goto exit_eof; goto exit_eof;
} }