1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-22 20:21:30 +02:00

dnn_backend_native_layer_avgpool: Fix invalid assignment, use av_assert

dnn_execute_layer_avg_pool() contains the following line:

assert(avgpool_params->padding_method = VALID);

This statement contains an assignment where obviously a comparison was
intended. Furthermore, *avgpool_params is const, so that the attempted
assignment leads to a compilation failure if asserts are enabled
(i.e. if DEBUG is defined which leads libavutil/internal.h to not define
NDEBUG). Moreover, the enumeration constant VALID actually has the value 0,
so that the assert would be triggered if a compiler compiles this with
asserts enabled. Finally, the statement uses assert() directly instead
of av_assert*().

All these errors have been fixed.

Thanks to ubitux for providing a FATE-box [1] where DEBUG is defined.

[1]: http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-ddebug

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
This commit is contained in:
Andreas Rheinhardt 2020-08-21 13:47:27 +02:00 committed by Guo, Yejun
parent d2206f0c5b
commit 128e6df1cd

View File

@ -91,7 +91,7 @@ int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operan
output_height = ceil(height / (kernel_strides * 1.0));
output_width = ceil(width / (kernel_strides * 1.0));
} else {
assert(avgpool_params->padding_method = VALID);
av_assert0(avgpool_params->padding_method == VALID);
height_end = height - avgpool_params->kernel_size + 1;
width_end = width - avgpool_params->kernel_size + 1;
height_radius = 0;