dec/vp8l.c: add assertions in EmitRescaledRowsRGBA/YUVA

Add assertions to make sure the number of lines that are imported
into rescaler is as expected.

Change-Id: I3e9e4202e696bb09f7aa54519285b6b0deb84c1a
This commit is contained in:
hui su 2016-09-01 17:27:17 -07:00 committed by James Zern
parent 43bd895879
commit 9e478f808e

View File

@ -547,11 +547,14 @@ static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec,
uint8_t* const row_out = out + num_lines_out * out_stride; uint8_t* const row_out = out + num_lines_out * out_stride;
const int lines_left = mb_h - num_lines_in; const int lines_left = mb_h - num_lines_in;
const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left); const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
int lines_imported;
assert(needed_lines > 0 && needed_lines <= lines_left); assert(needed_lines > 0 && needed_lines <= lines_left);
WebPMultARGBRows(row_in, in_stride, WebPMultARGBRows(row_in, in_stride,
dec->rescaler->src_width, needed_lines, 0); dec->rescaler->src_width, needed_lines, 0);
lines_imported =
WebPRescalerImport(dec->rescaler, lines_left, row_in, in_stride); WebPRescalerImport(dec->rescaler, lines_left, row_in, in_stride);
num_lines_in += needed_lines; assert(lines_imported == needed_lines);
num_lines_in += lines_imported;
num_lines_out += Export(dec->rescaler, colorspace, out_stride, row_out); num_lines_out += Export(dec->rescaler, colorspace, out_stride, row_out);
} }
return num_lines_out; return num_lines_out;
@ -623,9 +626,12 @@ static int EmitRescaledRowsYUVA(const VP8LDecoder* const dec,
while (num_lines_in < mb_h) { while (num_lines_in < mb_h) {
const int lines_left = mb_h - num_lines_in; const int lines_left = mb_h - num_lines_in;
const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left); const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
int lines_imported;
WebPMultARGBRows(in, in_stride, dec->rescaler->src_width, needed_lines, 0); WebPMultARGBRows(in, in_stride, dec->rescaler->src_width, needed_lines, 0);
lines_imported =
WebPRescalerImport(dec->rescaler, lines_left, in, in_stride); WebPRescalerImport(dec->rescaler, lines_left, in, in_stride);
num_lines_in += needed_lines; assert(lines_imported == needed_lines);
num_lines_in += lines_imported;
in += needed_lines * in_stride; in += needed_lines * in_stride;
y_pos += ExportYUVA(dec, y_pos); y_pos += ExportYUVA(dec, y_pos);
} }