add debug of frame and align to 32bytes

This commit is contained in:
Isaac Connor 2021-05-19 16:11:25 -04:00
parent bfd3131e63
commit db944cbca8
1 changed files with 6 additions and 4 deletions

View File

@ -159,11 +159,11 @@ int SWScale::Convert(
} }
#endif #endif
int alignment = 1; int alignment = width % 32 ? 1 : 32;
/* Check the buffer sizes */ /* Check the buffer sizes */
size_t needed_insize = GetBufferSize(in_pf, width, height); size_t needed_insize = GetBufferSize(in_pf, width, height);
if ( needed_insize > in_buffer_size ) { if (needed_insize > in_buffer_size) {
Debug(1, Warning(
"The input buffer size does not match the expected size for the input format. Required: %zu for %dx%d %d Available: %zu", "The input buffer size does not match the expected size for the input format. Required: %zu for %dx%d %d Available: %zu",
needed_insize, needed_insize,
width, width,
@ -172,7 +172,7 @@ int SWScale::Convert(
in_buffer_size); in_buffer_size);
} }
size_t needed_outsize = GetBufferSize(out_pf, new_width, new_height); size_t needed_outsize = GetBufferSize(out_pf, new_width, new_height);
if ( needed_outsize > out_buffer_size ) { if (needed_outsize > out_buffer_size) {
Error("The output buffer is undersized for the output format. Required: %zu Available: %zu", Error("The output buffer is undersized for the output format. Required: %zu Available: %zu",
needed_outsize, needed_outsize,
out_buffer_size); out_buffer_size);
@ -200,6 +200,7 @@ int SWScale::Convert(
Error("Failed filling input frame with input buffer"); Error("Failed filling input frame with input buffer");
return -7; return -7;
} }
zm_dump_frame(input_avframe, "convert in frame");
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0) #if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
if (av_image_fill_arrays(output_avframe->data, output_avframe->linesize, if (av_image_fill_arrays(output_avframe->data, output_avframe->linesize,
out_buffer, out_pf, new_width, new_height, alignment) <= 0) { out_buffer, out_pf, new_width, new_height, alignment) <= 0) {
@ -210,6 +211,7 @@ int SWScale::Convert(
Error("Failed filling output frame with output buffer"); Error("Failed filling output frame with output buffer");
return -8; return -8;
} }
zm_dump_frame(output_avframe, "convert out frame");
/* Do the conversion */ /* Do the conversion */
if ( !sws_scale(swscale_ctx, if ( !sws_scale(swscale_ctx,