Fix encoder reconstruction output for non multiple of 8 sized input.

Output changed so that only pixels within the conformance window are output.
This commit is contained in:
Ari Koivula 2014-03-19 13:23:41 +02:00
parent 34e453c880
commit eacad83ff9

View file

@ -302,10 +302,26 @@ int main(int argc, char *argv[])
encode_one_frame(encoder); encode_one_frame(encoder);
if (cfg->debug != NULL) { if (cfg->debug != NULL) {
// Write reconstructed frame out (for debugging purposes) // Write reconstructed frame out.
fwrite(encoder->in.cur_pic->y_recdata, cfg->width * cfg->height, 1, recout); // Use conformance-window dimensions instead of internal ones.
fwrite(encoder->in.cur_pic->u_recdata, (cfg->width * cfg->height)>>2, 1, recout); const int width = encoder->in.width;
fwrite(encoder->in.cur_pic->v_recdata, (cfg->width * cfg->height)>>2, 1, recout); const int height = encoder->in.height;
const int out_width = encoder->in.real_width;
const int out_height = encoder->in.real_height;
int y;
const pixel *y_rec = encoder->in.cur_pic->y_recdata;
const pixel *u_rec = encoder->in.cur_pic->u_recdata;
const pixel *v_rec = encoder->in.cur_pic->v_recdata;
for (y = 0; y < out_height; ++y) {
fwrite(&y_rec[y * width], sizeof(*y_rec), out_width, recout);
}
for (y = 0; y < out_height / 2; ++y) {
fwrite(&u_rec[y * width / 2], sizeof(*u_rec), out_width / 2, recout);
}
for (y = 0; y < out_height / 2; ++y) {
fwrite(&v_rec[y * width / 2], sizeof(*v_rec), out_width / 2, recout);
}
} }
// Calculate the bytes pushed to output for this frame // Calculate the bytes pushed to output for this frame