Message ID | 20210224100402.22300-4-anton@khirnov.net |
---|---|
State | Accepted |
Commit | 8369a2873c4785068babd6fb398d35180a3ab992 |
Headers | show |
Series | [FFmpeg-devel,1/5] tests/api-band-test: simplify code | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On 2/24/2021 7:04 AM, Anton Khirnov wrote: > --- > tests/api/api-flac-test.c | 42 +++++++++++++++++++-------------------- > 1 file changed, 21 insertions(+), 21 deletions(-) > > diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c > index 3d83c56987..b67c3d7363 100644 > --- a/tests/api/api-flac-test.c > +++ b/tests/api/api-flac-test.c > @@ -201,27 +201,27 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx, > return result; > } > > - if (in_frame->nb_samples != out_frame->nb_samples) { > - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different number of samples\n"); > - return AVERROR_UNKNOWN; > - } > - > - if (in_frame->channel_layout != out_frame->channel_layout) { > - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different channel layout\n"); > - return AVERROR_UNKNOWN; > - } > - > - if (in_frame->format != out_frame->format) { > - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different sample format\n"); > - return AVERROR_UNKNOWN; > - } > - out_frame_bytes = out_frame->nb_samples * out_frame->channels * sizeof(uint16_t); > - if (out_frame_bytes > out_frame->linesize[0]) { > - av_log(NULL, AV_LOG_ERROR, "Incorrect value of output frame linesize\n"); > - return 1; > - } > - memcpy(raw_out + out_offset, out_frame->data[0], out_frame_bytes); > - out_offset += out_frame_bytes; > + if (in_frame->nb_samples != out_frame->nb_samples) { > + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different number of samples\n"); > + return AVERROR_UNKNOWN; > + } > + > + if (in_frame->channel_layout != out_frame->channel_layout) { > + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different channel layout\n"); > + return AVERROR_UNKNOWN; > + } > + > + if (in_frame->format != out_frame->format) { > + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different sample format\n"); > + return AVERROR_UNKNOWN; > + } > + out_frame_bytes = out_frame->nb_samples * out_frame->channels * sizeof(uint16_t); > + if (out_frame_bytes > out_frame->linesize[0]) { > + av_log(NULL, AV_LOG_ERROR, "Incorrect value of output frame linesize\n"); > + return 1; > + } > + memcpy(raw_out + out_offset, out_frame->data[0], out_frame_bytes); > + out_offset += out_frame_bytes; > } > } Trivial, so LGTM.
diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c index 3d83c56987..b67c3d7363 100644 --- a/tests/api/api-flac-test.c +++ b/tests/api/api-flac-test.c @@ -201,27 +201,27 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx, return result; } - if (in_frame->nb_samples != out_frame->nb_samples) { - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different number of samples\n"); - return AVERROR_UNKNOWN; - } - - if (in_frame->channel_layout != out_frame->channel_layout) { - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different channel layout\n"); - return AVERROR_UNKNOWN; - } - - if (in_frame->format != out_frame->format) { - av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different sample format\n"); - return AVERROR_UNKNOWN; - } - out_frame_bytes = out_frame->nb_samples * out_frame->channels * sizeof(uint16_t); - if (out_frame_bytes > out_frame->linesize[0]) { - av_log(NULL, AV_LOG_ERROR, "Incorrect value of output frame linesize\n"); - return 1; - } - memcpy(raw_out + out_offset, out_frame->data[0], out_frame_bytes); - out_offset += out_frame_bytes; + if (in_frame->nb_samples != out_frame->nb_samples) { + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different number of samples\n"); + return AVERROR_UNKNOWN; + } + + if (in_frame->channel_layout != out_frame->channel_layout) { + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different channel layout\n"); + return AVERROR_UNKNOWN; + } + + if (in_frame->format != out_frame->format) { + av_log(NULL, AV_LOG_ERROR, "Error frames before and after decoding has different sample format\n"); + return AVERROR_UNKNOWN; + } + out_frame_bytes = out_frame->nb_samples * out_frame->channels * sizeof(uint16_t); + if (out_frame_bytes > out_frame->linesize[0]) { + av_log(NULL, AV_LOG_ERROR, "Incorrect value of output frame linesize\n"); + return 1; + } + memcpy(raw_out + out_offset, out_frame->data[0], out_frame_bytes); + out_offset += out_frame_bytes; } }