diff mbox

[FFmpeg-devel] "assert(a && b)" --> "assert(a); assert(b)" for more precise diagnostics, except for libformat

Message ID CAGn-TgikxiJsZz1DRnpPA=BddZ=MkXV1ZrDwojZHzz0danR9YA@mail.gmail.com
State New
Headers show

Commit Message

Adam Richter May 12, 2019, 3:24 p.m. UTC
This patch separates statements of the form "assert(a && b);" into
"assert(a);" and "assert(b);", typically involving an assertion
function like av_assert0.

This patch covers all of ffmpeg, except for the libavformat, which I
have already submitted separately.

I have not tested this patch other than observing that ffmpeg still
builds without any apparent new complaints, that no complaints in the
build contain "assert", and that "make fate" seems to succeed.

Thanks in advance for considering the attached patch.

Adam

Comments

Mark Thompson May 12, 2019, 4:58 p.m. UTC | #1
On 12/05/2019 16:24, Adam Richter wrote:
> This patch separates statements of the form "assert(a && b);" into
> "assert(a);" and "assert(b);", typically involving an assertion
> function like av_assert0.
> 
> This patch covers all of ffmpeg, except for the libavformat, which I
> have already submitted separately.
> 
> I have not tested this patch other than observing that ffmpeg still
> builds without any apparent new complaints, that no complaints in the
> build contain "assert", and that "make fate" seems to succeed.
> 
> Thanks in advance for considering the attached patch.
> 
> Adam
> 
> 
> From f815a2481a19cfd191b9f97e246b307b71d6c790 Mon Sep 17 00:00:00 2001
> From: Adam Richter <adamrichter4@gmail.com>
> Date: Sun, 12 May 2019 08:02:51 -0700
> Subject: [PATCH] "assert(a && b)" --> "assert(a); assert(b)" for more
>  precise diagnostics, except for libformat.
> 
> This patch separates statements of the form "assert(a && b);" into
> "assert(a);" and "assert(b);", for more precise diagnostics when
> an assertion fails, which can be especially important in cases where
> the problem may not be easily reproducible and save developer time.
> Usually, this involves functions like av_assert0.

I don't feel very convinced by the general case of this argument.  Assertions are primarily present to assist a developer reading/writing the code; they should never be triggering at runtime in non-development contexts.

Where the statements a and b are not related then yes, splitting them is a good idea.  But when it's something like a bounds check on one variable ("av_assert0(A < n && n < B)", as appears quite a few times below) then I think keeping it as one statement feels clearer.  Similarly for highly related conditions ("av_assert0(p && p->f)" or "av_assert0(x < width && y < height)").

> There are a couple of cases that this patch does not change:
> (1) assert conjunctions of the form assert(condition && "string literal
>     to pass to the user as a helpful tip."), and
> (2) assert condjunctions where the first part contained a variable
>     assignment that was used in the second part of the assertion and
>     not outside the assert (so that the variable assignment be elided
>     if the assertion checking omitted).
> 
> This patch covers all of ffmpeg except for libavformat, which was
> covered in a patch that I previously submitted separately.
> 
> These changes build without any new complaints that I noticed, and
> "make fate" succeeds, but I have not otherwise tested them.
> 
> Signed-off-by: Adam Richter <adamrichter4@gmail.com>
> ...
> diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> index fca692cb15..bef52e8b02 100644
> --- a/libavcodec/aacpsy.c
> +++ b/libavcodec/aacpsy.c
> @@ -504,9 +504,11 @@ static int calc_bit_demand(AacPsyContext *ctx, float pe, int bits, int size,
>      fill_level = av_clipf((float)ctx->fill_level / size, clip_low, clip_high);
>      clipped_pe = av_clipf(pe, ctx->pe.min, ctx->pe.max);
>      bit_save   = (fill_level + bitsave_add) * bitsave_slope;
> -    assert(bit_save <= 0.3f && bit_save >= -0.05000001f);
> +    assert(bit_save <= 0.3f);
> +    assert(bit_save >= -0.05000001f);
>      bit_spend  = (fill_level + bitspend_add) * bitspend_slope;
> -    assert(bit_spend <= 0.5f && bit_spend >= -0.1f);
> +    assert(bit_spend <= 0.5f);
> +    assert(bit_spend >= -0.1f);

While you're touching calls to traditional assert() please consider turning them into suitable av_assertN().

- Mark
Michael Niedermayer May 12, 2019, 6:16 p.m. UTC | #2
On Sun, May 12, 2019 at 05:58:50PM +0100, Mark Thompson wrote:
> On 12/05/2019 16:24, Adam Richter wrote:
> > This patch separates statements of the form "assert(a && b);" into
> > "assert(a);" and "assert(b);", typically involving an assertion
> > function like av_assert0.
> > 
> > This patch covers all of ffmpeg, except for the libavformat, which I
> > have already submitted separately.
> > 
> > I have not tested this patch other than observing that ffmpeg still
> > builds without any apparent new complaints, that no complaints in the
> > build contain "assert", and that "make fate" seems to succeed.
> > 
> > Thanks in advance for considering the attached patch.
> > 
> > Adam
> > 
> > 
> > From f815a2481a19cfd191b9f97e246b307b71d6c790 Mon Sep 17 00:00:00 2001
> > From: Adam Richter <adamrichter4@gmail.com>
> > Date: Sun, 12 May 2019 08:02:51 -0700
> > Subject: [PATCH] "assert(a && b)" --> "assert(a); assert(b)" for more
> >  precise diagnostics, except for libformat.
> > 
> > This patch separates statements of the form "assert(a && b);" into
> > "assert(a);" and "assert(b);", for more precise diagnostics when
> > an assertion fails, which can be especially important in cases where
> > the problem may not be easily reproducible and save developer time.
> > Usually, this involves functions like av_assert0.
> 
> I don't feel very convinced by the general case of this argument.  Assertions are primarily present to assist a developer reading/writing the code; they should never be triggering at runtime in non-development contexts.
> 
> Where the statements a and b are not related then yes, splitting them is a good idea.  But when it's something like a bounds check on one variable ("av_assert0(A < n && n < B)", as appears quite a few times below) then I think keeping it as one statement feels clearer.  Similarly for highly related conditions ("av_assert0(p && p->f)" or "av_assert0(x < width && y < height)").
> 
> > There are a couple of cases that this patch does not change:
> > (1) assert conjunctions of the form assert(condition && "string literal
> >     to pass to the user as a helpful tip."), and
> > (2) assert condjunctions where the first part contained a variable
> >     assignment that was used in the second part of the assertion and
> >     not outside the assert (so that the variable assignment be elided
> >     if the assertion checking omitted).
> > 
> > This patch covers all of ffmpeg except for libavformat, which was
> > covered in a patch that I previously submitted separately.
> > 
> > These changes build without any new complaints that I noticed, and
> > "make fate" succeeds, but I have not otherwise tested them.
> > 
> > Signed-off-by: Adam Richter <adamrichter4@gmail.com>
> > ...
> > diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> > index fca692cb15..bef52e8b02 100644
> > --- a/libavcodec/aacpsy.c
> > +++ b/libavcodec/aacpsy.c
> > @@ -504,9 +504,11 @@ static int calc_bit_demand(AacPsyContext *ctx, float pe, int bits, int size,
> >      fill_level = av_clipf((float)ctx->fill_level / size, clip_low, clip_high);
> >      clipped_pe = av_clipf(pe, ctx->pe.min, ctx->pe.max);
> >      bit_save   = (fill_level + bitsave_add) * bitsave_slope;
> > -    assert(bit_save <= 0.3f && bit_save >= -0.05000001f);
> > +    assert(bit_save <= 0.3f);
> > +    assert(bit_save >= -0.05000001f);
> >      bit_spend  = (fill_level + bitspend_add) * bitspend_slope;
> > -    assert(bit_spend <= 0.5f && bit_spend >= -0.1f);
> > +    assert(bit_spend <= 0.5f);
> > +    assert(bit_spend >= -0.1f);
> 
> While you're touching calls to traditional assert() please consider turning them into suitable av_assertN().

I agree that they should be changed to av_assertN() but it should be
in a seperate commit/patch

These assert -> av_assertN changes will likely in some cases "activate"
"dormant" checks which fail. Managing / Testing / Reviewing and correcting
these should be easier if they are not in a large change splitting asserts

Thanks

[...]
Michael Niedermayer May 13, 2019, 8:19 a.m. UTC | #3
On Sun, May 12, 2019 at 08:24:11AM -0700, Adam Richter wrote:
> This patch separates statements of the form "assert(a && b);" into
> "assert(a);" and "assert(b);", typically involving an assertion
> function like av_assert0.
> 
> This patch covers all of ffmpeg, except for the libavformat, which I
> have already submitted separately.
> 
> I have not tested this patch other than observing that ffmpeg still
> builds without any apparent new complaints, that no complaints in the
> build contain "assert", and that "make fate" seems to succeed.
> 
> Thanks in advance for considering the attached patch.
> 
> Adam

>  fftools/cmdutils.c                    |    3 +-
>  fftools/ffmpeg.c                      |    3 +-
>  libavcodec/4xm.c                      |   12 ++++++---
>  libavcodec/aaccoder_twoloop.h         |    3 +-
>  libavcodec/aacenc.c                   |    3 +-
>  libavcodec/aacenc_quantization_misc.h |    3 +-
>  libavcodec/aacpsy.c                   |    6 +++-
>  libavcodec/ac3enc.c                   |   15 ++++++++----
>  libavcodec/acelp_filters.c            |    3 +-
>  libavcodec/amfenc.c                   |    5 ++--
>  libavcodec/amrnbdec.c                 |    3 +-
>  libavcodec/av1_frame_split_bsf.c      |    3 +-
>  libavcodec/avpacket.c                 |    3 +-
>  libavcodec/cbs.c                      |   42 ++++++++++++++++++++++------------
>  libavcodec/cbs_av1.c                  |    9 ++++---
>  libavcodec/cbs_av1_syntax_template.c  |    3 +-
>  libavcodec/cbs_h2645.c                |   10 ++++----
>  libavcodec/cbs_mpeg2.c                |    4 +--
>  libavcodec/cbs_vp9.c                  |    8 ++++--
>  libavcodec/celp_filters.c             |    3 +-
>  libavcodec/dca_core.c                 |    3 +-
>  libavcodec/decode.c                   |    4 +--
>  libavcodec/dvdsubdec.c                |    3 +-
>  libavcodec/dvenc.c                    |    3 +-
>  libavcodec/dxva2_h264.c               |    3 +-
>  libavcodec/dxva2_hevc.c               |    3 +-
>  libavcodec/dxva2_vp9.c                |    3 +-
>  libavcodec/error_resilience.c         |    3 +-
>  libavcodec/ffv1dec.c                  |    3 +-
>  libavcodec/flacenc.c                  |    6 +++-
>  libavcodec/get_bits.h                 |   35 +++++++++++++++++++---------
>  libavcodec/h263dec.c                  |    3 +-
>  libavcodec/h2645_parse.c              |    6 +++-
>  libavcodec/h264_refs.c                |    3 +-
>  libavcodec/h264_slice.c               |    3 +-
>  libavcodec/h264chroma_template.c      |   20 ++++++++++++----
>  libavcodec/hevc_filter.c              |    6 +++-
>  libavcodec/huffyuv.c                  |    3 +-
>  libavcodec/huffyuvenc.c               |    5 +++-
>  libavcodec/ituh263enc.c               |    3 +-
>  libavcodec/ivi.c                      |    4 ++-
>  libavcodec/jpeg2000dec.c              |    3 +-
>  libavcodec/lclenc.c                   |    3 +-
>  libavcodec/lpc.c                      |    5 ++--
>  libavcodec/lzwenc.c                   |    9 ++++---
>  libavcodec/mips/h264chroma_msa.c      |   31 +++++++++++++++++++------
>  libavcodec/mips/vc1dsp_mmi.c          |   20 ++++++++++++----
>  libavcodec/mjpegdec.c                 |   11 +++++---
>  libavcodec/motion_est.c               |   12 ++++++++-
>  libavcodec/motion_est_template.c      |   10 ++++++--
>  libavcodec/mpeg12.c                   |    3 +-
>  libavcodec/mpeg12enc.c                |    6 +++-
>  libavcodec/mpeg4videoenc.c            |    6 +++-
>  libavcodec/mpegaudiodec_template.c    |    3 +-
>  libavcodec/mpegaudioenc_template.c    |    6 +++-
>  libavcodec/mpegutils.c                |    6 +++-
>  libavcodec/mpegvideo_enc.c            |    9 ++++---
>  libavcodec/mpegvideo_xvmc.c           |    3 +-
>  libavcodec/mpegvideoencdsp.c          |    3 +-
>  libavcodec/mqcenc.c                   |    3 +-
>  libavcodec/put_bits.h                 |    9 ++++---
>  libavcodec/rv34.c                     |    3 +-
>  libavcodec/rv40dsp.c                  |   10 ++++++--
>  libavcodec/sanm.c                     |    3 +-
>  libavcodec/sinewin_tablegen.h         |    3 +-
>  libavcodec/snow.c                     |    3 +-
>  libavcodec/snow.h                     |    3 +-
>  libavcodec/snow_dwt.c                 |    3 +-
>  libavcodec/snowenc.c                  |   14 +++++++----
>  libavcodec/svq1enc.c                  |   24 ++++++++++++-------
>  libavcodec/vaapi_encode.c             |    8 ++++--
>  libavcodec/vaapi_encode_h264.c        |    3 +-
>  libavcodec/vaapi_encode_h265.c        |    6 +++-
>  libavcodec/vaapi_encode_vp9.c         |    4 +--
>  libavcodec/vc1_pred.c                 |    3 +-
>  libavcodec/vc1dsp.c                   |   20 ++++++++++++----
>  libavcodec/videodsp_template.c        |    6 +++-
>  libavcodec/vp9.c                      |    3 +-
>  libavcodec/vp9recon.c                 |    3 +-
>  libavcodec/wmaenc.c                   |    6 +++-
>  libavcodec/x86/videodsp_init.c        |    6 +++-
>  libavdevice/avdevice.c                |    3 +-
>  libavdevice/opengl_enc.c              |    3 +-
>  libavfilter/af_atempo.c               |    9 ++++---
>  libavfilter/af_dynaudnorm.c           |    3 +-
>  libavfilter/af_surround.c             |    8 ++++--
>  libavfilter/asrc_sinc.c               |    3 +-
>  libavfilter/avfilter.c                |    3 +-
>  libavfilter/colorspacedsp_template.c  |    3 +-
>  libavfilter/transform.c               |    6 +++-
>  libavfilter/vf_curves.c               |    7 ++++-
>  libavfilter/vf_fieldmatch.c           |    4 ++-
>  libavfilter/vf_lut3d.c                |    3 +-
>  libavfilter/vf_mergeplanes.c          |    3 +-
>  libavfilter/vf_nlmeans.c              |    4 ++-
>  libavfilter/vsrc_testsrc.c            |    3 +-
>  libavutil/frame.c                     |    6 +++-
>  libavutil/hwcontext_opencl.c          |    4 +--
>  libavutil/integer.c                   |    3 +-
>  libavutil/mathematics.c               |    3 +-
>  libavutil/pixdesc.c                   |   12 +++++++--
>  libavutil/rational.c                  |    3 +-
>  libavutil/softfloat.h                 |    3 +-
>  libswresample/resample.c              |    3 +-
>  libswscale/swscale_unscaled.c         |    7 ++++-
>  libswscale/utils.c                    |    3 +-
>  libswscale/vscale.c                   |    3 +-
>  tests/checkasm/vf_nlmeans.c           |    3 +-
>  108 files changed, 471 insertions(+), 211 deletions(-)
> 725d72dbcf528676417e50eac7e0c55becd05474  0003-assert-a-b-assert-a-assert-b-for-more-precise-diagno.patch
> From f815a2481a19cfd191b9f97e246b307b71d6c790 Mon Sep 17 00:00:00 2001
> From: Adam Richter <adamrichter4@gmail.com>
> Date: Sun, 12 May 2019 08:02:51 -0700
> Subject: [PATCH] "assert(a && b)" --> "assert(a); assert(b)" for more
>  precise diagnostics, except for libformat.
> 
> This patch separates statements of the form "assert(a && b);" into
> "assert(a);" and "assert(b);", for more precise diagnostics when
> an assertion fails, which can be especially important in cases where
> the problem may not be easily reproducible and save developer time.
> Usually, this involves functions like av_assert0.
> 
> There are a couple of cases that this patch does not change:
> (1) assert conjunctions of the form assert(condition && "string literal
>     to pass to the user as a helpful tip."), and
> (2) assert condjunctions where the first part contained a variable
>     assignment that was used in the second part of the assertion and
>     not outside the assert (so that the variable assignment be elided
>     if the assertion checking omitted).
> 
> This patch covers all of ffmpeg except for libavformat, which was
> covered in a patch that I previously submitted separately.
> 
> These changes build without any new complaints that I noticed, and
> "make fate" succeeds, but I have not otherwise tested them.
> 
> Signed-off-by: Adam Richter <adamrichter4@gmail.com>
> ---
>  fftools/cmdutils.c                    |  3 +-
>  fftools/ffmpeg.c                      |  3 +-
>  libavcodec/4xm.c                      | 12 +++++---
>  libavcodec/aaccoder_twoloop.h         |  3 +-
>  libavcodec/aacenc.c                   |  3 +-
>  libavcodec/aacenc_quantization_misc.h |  3 +-
>  libavcodec/aacpsy.c                   |  6 ++--
>  libavcodec/ac3enc.c                   | 15 ++++++----
>  libavcodec/acelp_filters.c            |  3 +-
>  libavcodec/amfenc.c                   |  5 ++--
>  libavcodec/amrnbdec.c                 |  3 +-
>  libavcodec/av1_frame_split_bsf.c      |  3 +-
>  libavcodec/avpacket.c                 |  3 +-
>  libavcodec/cbs.c                      | 42 ++++++++++++++++++---------
>  libavcodec/cbs_av1.c                  |  9 ++++--
>  libavcodec/cbs_av1_syntax_template.c  |  3 +-
>  libavcodec/cbs_h2645.c                | 10 ++++---
>  libavcodec/cbs_mpeg2.c                |  4 +--
>  libavcodec/cbs_vp9.c                  |  8 +++--
>  libavcodec/celp_filters.c             |  3 +-
>  libavcodec/dca_core.c                 |  3 +-
>  libavcodec/decode.c                   |  4 +--
>  libavcodec/dvdsubdec.c                |  3 +-
>  libavcodec/dvenc.c                    |  3 +-
>  libavcodec/dxva2_h264.c               |  3 +-
>  libavcodec/dxva2_hevc.c               |  3 +-
>  libavcodec/dxva2_vp9.c                |  3 +-
>  libavcodec/error_resilience.c         |  3 +-
>  libavcodec/ffv1dec.c                  |  3 +-
>  libavcodec/flacenc.c                  |  6 ++--
>  libavcodec/get_bits.h                 | 35 +++++++++++++++-------
>  libavcodec/h263dec.c                  |  3 +-
>  libavcodec/h2645_parse.c              |  6 ++--
>  libavcodec/h264_refs.c                |  3 +-
>  libavcodec/h264_slice.c               |  3 +-
>  libavcodec/h264chroma_template.c      | 20 ++++++++++---
>  libavcodec/hevc_filter.c              |  6 ++--
>  libavcodec/huffyuv.c                  |  3 +-
>  libavcodec/huffyuvenc.c               |  5 +++-
>  libavcodec/ituh263enc.c               |  3 +-
>  libavcodec/ivi.c                      |  4 ++-
>  libavcodec/jpeg2000dec.c              |  3 +-
>  libavcodec/lclenc.c                   |  3 +-
>  libavcodec/lpc.c                      |  5 ++--
>  libavcodec/lzwenc.c                   |  9 ++++--
>  libavcodec/mips/h264chroma_msa.c      | 31 +++++++++++++++-----
>  libavcodec/mips/vc1dsp_mmi.c          | 20 ++++++++++---
>  libavcodec/mjpegdec.c                 | 11 ++++---
>  libavcodec/motion_est.c               | 12 ++++++--
>  libavcodec/motion_est_template.c      | 10 +++++--
>  libavcodec/mpeg12.c                   |  3 +-
>  libavcodec/mpeg12enc.c                |  6 ++--
>  libavcodec/mpeg4videoenc.c            |  6 ++--
>  libavcodec/mpegaudiodec_template.c    |  3 +-
>  libavcodec/mpegaudioenc_template.c    |  6 ++--
>  libavcodec/mpegutils.c                |  6 ++--
>  libavcodec/mpegvideo_enc.c            |  9 ++++--
>  libavcodec/mpegvideo_xvmc.c           |  3 +-
>  libavcodec/mpegvideoencdsp.c          |  3 +-
>  libavcodec/mqcenc.c                   |  3 +-
>  libavcodec/put_bits.h                 |  9 ++++--
>  libavcodec/rv34.c                     |  3 +-
>  libavcodec/rv40dsp.c                  | 10 +++++--
>  libavcodec/sanm.c                     |  3 +-
>  libavcodec/sinewin_tablegen.h         |  3 +-
>  libavcodec/snow.c                     |  3 +-
>  libavcodec/snow.h                     |  3 +-
>  libavcodec/snow_dwt.c                 |  3 +-
>  libavcodec/snowenc.c                  | 14 +++++----
>  libavcodec/svq1enc.c                  | 24 ++++++++++-----
>  libavcodec/vaapi_encode.c             |  8 +++--
>  libavcodec/vaapi_encode_h264.c        |  3 +-
>  libavcodec/vaapi_encode_h265.c        |  6 ++--
>  libavcodec/vaapi_encode_vp9.c         |  4 +--
>  libavcodec/vc1_pred.c                 |  3 +-
>  libavcodec/vc1dsp.c                   | 20 ++++++++++---
>  libavcodec/videodsp_template.c        |  6 ++--
>  libavcodec/vp9.c                      |  3 +-
>  libavcodec/vp9recon.c                 |  3 +-
>  libavcodec/wmaenc.c                   |  6 ++--
>  libavcodec/x86/videodsp_init.c        |  6 ++--
>  libavdevice/avdevice.c                |  3 +-
>  libavdevice/opengl_enc.c              |  3 +-
>  libavfilter/af_atempo.c               |  9 +++---
>  libavfilter/af_dynaudnorm.c           |  3 +-
>  libavfilter/af_surround.c             |  8 +++--
>  libavfilter/asrc_sinc.c               |  3 +-
>  libavfilter/avfilter.c                |  3 +-
>  libavfilter/colorspacedsp_template.c  |  3 +-
>  libavfilter/transform.c               |  6 ++--
>  libavfilter/vf_curves.c               |  7 +++--
>  libavfilter/vf_fieldmatch.c           |  4 ++-
>  libavfilter/vf_lut3d.c                |  3 +-
>  libavfilter/vf_mergeplanes.c          |  3 +-
>  libavfilter/vf_nlmeans.c              |  4 ++-
>  libavfilter/vsrc_testsrc.c            |  3 +-
>  libavutil/frame.c                     |  6 ++--
>  libavutil/hwcontext_opencl.c          |  4 +--
>  libavutil/integer.c                   |  3 +-
>  libavutil/mathematics.c               |  3 +-
>  libavutil/pixdesc.c                   | 12 ++++++--
>  libavutil/rational.c                  |  3 +-
>  libavutil/softfloat.h                 |  3 +-
>  libswresample/resample.c              |  3 +-
>  libswscale/swscale_unscaled.c         |  7 +++--
>  libswscale/utils.c                    |  3 +-
>  libswscale/vscale.c                   |  3 +-
>  tests/checkasm/vf_nlmeans.c           |  3 +-
>  108 files changed, 471 insertions(+), 211 deletions(-)

patch looks good to me, but others maybe dislike it (so i am not
applying it, just saying that from my point of view the change
is fine)

thanks

[...]
Adam Richter May 14, 2019, 9:17 p.m. UTC | #4
On Sun, May 12, 2019 at 11:16 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Sun, May 12, 2019 at 05:58:50PM +0100, Mark Thompson wrote:
> > On 12/05/2019 16:24, Adam Richter wrote:
> > > This patch separates statements of the form "assert(a && b);" into
> > > "assert(a);" and "assert(b);", typically involving an assertion
> > > function like av_assert0.
> > >
> > > This patch covers all of ffmpeg, except for the libavformat, which I
> > > have already submitted separately.
> > >
> > > I have not tested this patch other than observing that ffmpeg still
> > > builds without any apparent new complaints, that no complaints in the
> > > build contain "assert", and that "make fate" seems to succeed.
> > >
> > > Thanks in advance for considering the attached patch.
> > >
> > > Adam
> > >
> > >
> > > From f815a2481a19cfd191b9f97e246b307b71d6c790 Mon Sep 17 00:00:00 2001
> > > From: Adam Richter <adamrichter4@gmail.com>
> > > Date: Sun, 12 May 2019 08:02:51 -0700
> > > Subject: [PATCH] "assert(a && b)" --> "assert(a); assert(b)" for more
> > >  precise diagnostics, except for libformat.
> > >
> > > This patch separates statements of the form "assert(a && b);" into
> > > "assert(a);" and "assert(b);", for more precise diagnostics when
> > > an assertion fails, which can be especially important in cases where
> > > the problem may not be easily reproducible and save developer time.
> > > Usually, this involves functions like av_assert0.
> >
> > I don't feel very convinced by the general case of this argument.  Assertions are primarily present to assist a developer reading/writing the code; they should never be triggering at runtime in non-development contexts.
> >
> > Where the statements a and b are not related then yes, splitting them is a good idea.  But when it's something like a bounds check on one variable ("av_assert0(A < n && n < B)", as appears quite a few times below) then I think keeping it as one statement feels clearer.  Similarly for highly related conditions ("av_assert0(p && p->f)" or "av_assert0(x < width && y < height)").
> >
> > > There are a couple of cases that this patch does not change:
> > > (1) assert conjunctions of the form assert(condition && "string literal
> > >     to pass to the user as a helpful tip."), and
> > > (2) assert condjunctions where the first part contained a variable
> > >     assignment that was used in the second part of the assertion and
> > >     not outside the assert (so that the variable assignment be elided
> > >     if the assertion checking omitted).
> > >
> > > This patch covers all of ffmpeg except for libavformat, which was
> > > covered in a patch that I previously submitted separately.
> > >
> > > These changes build without any new complaints that I noticed, and
> > > "make fate" succeeds, but I have not otherwise tested them.
> > >
> > > Signed-off-by: Adam Richter <adamrichter4@gmail.com>
> > > ...
> > > diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> > > index fca692cb15..bef52e8b02 100644
> > > --- a/libavcodec/aacpsy.c
> > > +++ b/libavcodec/aacpsy.c
> > > @@ -504,9 +504,11 @@ static int calc_bit_demand(AacPsyContext *ctx, float pe, int bits, int size,
> > >      fill_level = av_clipf((float)ctx->fill_level / size, clip_low, clip_high);
> > >      clipped_pe = av_clipf(pe, ctx->pe.min, ctx->pe.max);
> > >      bit_save   = (fill_level + bitsave_add) * bitsave_slope;
> > > -    assert(bit_save <= 0.3f && bit_save >= -0.05000001f);
> > > +    assert(bit_save <= 0.3f);
> > > +    assert(bit_save >= -0.05000001f);
> > >      bit_spend  = (fill_level + bitspend_add) * bitspend_slope;
> > > -    assert(bit_spend <= 0.5f && bit_spend >= -0.1f);
> > > +    assert(bit_spend <= 0.5f);
> > > +    assert(bit_spend >= -0.1f);
> >
> > While you're touching calls to traditional assert() please consider turning them into suitable av_assertN().
>
> I agree that they should be changed to av_assertN() but it should be
> in a seperate commit/patch
>
> These assert -> av_assertN changes will likely in some cases "activate"
> "dormant" checks which fail. Managing / Testing / Reviewing and correcting
> these should be easier if they are not in a large change splitting asserts
>
> Thanks
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
[...]

Hello, Michael and Mark.

Thank you for your reviews of my proposed changes that would split
most assertions
of the form "a && b" into separate assertions.

Michael, if I understand correctly, you are OK with the patches after
having looked at
them to spot problems, but are not advocating for or against their
inclusion.  Mark, if I
understand correctly, you would rather see assertions split only where "a and
b are not related."  I don't think anyone else has chimed in, but I
would welcome being
told if I missed anyone else's expressed opinion or if anyone wants to
add anything now.

To make the most efficient use of your time, I would like to proceed
as follows.  In the rest
of this message, I will include an argument, primarily in the hopes of
persuading you,
Mark.  After that, if you're still not on board with merging all of
the patches, and if there
are no other replies in the next day or two, then I encourage you to
post a subset of my
patches which you think should be merged (if any, and if you have the
time).  Otherwise,
probably around this weekend, I will try to make a new subset of these
patches that I
think you might be OK with and post that for comments.

However, first, in the hopes that we can avoid picking out which part
of the patches to
merge, here is a response, Mark, to your previously stated objections.

As a preliminary, regarding your remark "Assertions are primarily
present to assist a
developer reading/writing the code", I just want to clarify something
for other readers
that, av_assert0 statements are always compiled in, and, as for the
other assertions,
there may be some small value in reducing their costs so that they
result in timing
behavior that is a bit closer to the behavior without the assertions,
which might be
where a bug occurred.  So, there may still be some small value in
being able to pass
branch predictions to the compiler in the assertion statement, although I was
surprised to see that neither glibc nor ffmpeg appear currently to do this.

However, I recognize that most of your argument, Mark, is about readability.

At least in my limited experience, I think that, separated assertions
are actually
almost always more readable, sometimes eliminating parentheses, often
making references to the same values line up on the same columns, which
can make range checks more obvious, and sometimes changing
multi-line conditions to separate single line conditions, which can
be recognized separately.

Consider, for example, if you agree that columnization makes this range check
more recognizable in a glance and makes it easier to spot what the bounds are
(the sixteen space indentation is taken from the code in which it appeared):

                av_assert0(par->bits_per_coded_sample >= 0 &&
par->bits_per_coded_sample <= 8);

                            ...vs...

                av_assert0(par->bits_per_coded_sample >= 0);
                av_assert0(par->bits_per_coded_sample <= 8);

A possible counter-argument to this might be that, in a long sequence
of assertions, can be informative to group related assertions
together, which I think is true, but it is possible to get this other
means, such as by using blank lines to separate express such grouping.

So, Mark, if you decide you are OK with my complete patches, I encourage
you to let me know.  Otherwise, if there are any of those changes which you
are OK with, I would like to just to to get those merged.  Finally, if you would
rather see none of those changes merged (one one to split the assertions in
libavformat and one was for everywhere else in ffmpeg), please let me know
about that too, in which case, if no one advocates for their
inclusion, I'll drop
my proposal to merge these changes.

By the way, after this, regarding the your (Mark and Michael's) discussion of
changing the few assert() call that my patches effected to av_assertN, I have
not looked in much depth, but I think that all such cases may be in pretty
busy paths, so it might be most appropriate to replace them with av_assert2,
which normally is not compiled in.

Also after this, I may take a look at adding a branch hint to the av_assertN
macros if nobody objects.

In any case, thanks for your thoughtful consideration of these proposed
edits.

Adam
Hendrik Leppkes May 14, 2019, 11 p.m. UTC | #5
On Tue, May 14, 2019 at 11:25 PM Adam Richter <adamrichter4@gmail.com> wrote:
>
> Consider, for example, if you agree that columnization makes this range check
> more recognizable in a glance and makes it easier to spot what the bounds are
> (the sixteen space indentation is taken from the code in which it appeared):
>
>                 av_assert0(par->bits_per_coded_sample >= 0 &&
> par->bits_per_coded_sample <= 8);
>
>                             ...vs...
>
>                 av_assert0(par->bits_per_coded_sample >= 0);
>                 av_assert0(par->bits_per_coded_sample <= 8);
>
> A possible counter-argument to this might be that, in a long sequence
> of assertions, can be informative to group related assertions
> together, which I think is true, but it is possible to get this other
> means, such as by using blank lines to separate express such grouping.
>
> So, Mark, if you decide you are OK with my complete patches, I encourage
> you to let me know.  Otherwise, if there are any of those changes which you
> are OK with, I would like to just to to get those merged.  Finally, if you would
> rather see none of those changes merged (one one to split the assertions in
> libavformat and one was for everywhere else in ffmpeg), please let me know
> about that too, in which case, if no one advocates for their
> inclusion, I'll drop
> my proposal to merge these changes.
>

Unfortunately I have to agree with Mark. asserst that check the same
value or extremely closely related values should stay combined.

>
> Also after this, I may take a look at adding a branch hint to the av_assertN
> macros if nobody objects.
>

Please don't, we don't do branch hints anywhere, and this is a bad
place to start.
If an assert is truely performance sensitive (as in, it makes a
measurable difference), it should probably be moved from assert0 to
assert1, and as such is only enabled in testing builds.

- Hendrik
Jun Zhao May 15, 2019, 1:40 a.m. UTC | #6
On Wed, May 15, 2019 at 7:01 AM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
>
> On Tue, May 14, 2019 at 11:25 PM Adam Richter <adamrichter4@gmail.com> wrote:
> >
> > Consider, for example, if you agree that columnization makes this range check
> > more recognizable in a glance and makes it easier to spot what the bounds are
> > (the sixteen space indentation is taken from the code in which it appeared):
> >
> >                 av_assert0(par->bits_per_coded_sample >= 0 &&
> > par->bits_per_coded_sample <= 8);
> >
> >                             ...vs...
> >
> >                 av_assert0(par->bits_per_coded_sample >= 0);
> >                 av_assert0(par->bits_per_coded_sample <= 8);
> >
> > A possible counter-argument to this might be that, in a long sequence
> > of assertions, can be informative to group related assertions
> > together, which I think is true, but it is possible to get this other
> > means, such as by using blank lines to separate express such grouping.
> >
> > So, Mark, if you decide you are OK with my complete patches, I encourage
> > you to let me know.  Otherwise, if there are any of those changes which you
> > are OK with, I would like to just to to get those merged.  Finally, if you would
> > rather see none of those changes merged (one one to split the assertions in
> > libavformat and one was for everywhere else in ffmpeg), please let me know
> > about that too, in which case, if no one advocates for their
> > inclusion, I'll drop
> > my proposal to merge these changes.
> >
>
> Unfortunately I have to agree with Mark. asserst that check the same
> value or extremely closely related values should stay combined.
>
I agree this part
> >
> > Also after this, I may take a look at adding a branch hint to the av_assertN
> > macros if nobody objects.
> >
>
> Please don't, we don't do branch hints anywhere, and this is a bad
> place to start.
> If an assert is truely performance sensitive (as in, it makes a
> measurable difference), it should probably be moved from assert0 to
> assert1, and as such is only enabled in testing builds.
>
If assert0 or assert1 lead to performance drop, we need some profiling
data, then try to fix it.
> - Hendrik
Adam Richter May 15, 2019, 7:13 p.m. UTC | #7
On Tue, May 14, 2019 at 6:48 PM mypopy@gmail.com <mypopy@gmail.com> wrote:
>
> On Wed, May 15, 2019 at 7:01 AM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> >
> > On Tue, May 14, 2019 at 11:25 PM Adam Richter <adamrichter4@gmail.com> wrote:
> > >
> > > Consider, for example, if you agree that columnization makes this range check
> > > more recognizable in a glance and makes it easier to spot what the bounds are
> > > (the sixteen space indentation is taken from the code in which it appeared):
> > >
> > >                 av_assert0(par->bits_per_coded_sample >= 0 &&
> > > par->bits_per_coded_sample <= 8);
> > >
> > >                             ...vs...
> > >
> > >                 av_assert0(par->bits_per_coded_sample >= 0);
> > >                 av_assert0(par->bits_per_coded_sample <= 8);
> > >
> > > A possible counter-argument to this might be that, in a long sequence
> > > of assertions, can be informative to group related assertions
> > > together, which I think is true, but it is possible to get this other
> > > means, such as by using blank lines to separate express such grouping.
> > >
> > > So, Mark, if you decide you are OK with my complete patches, I encourage
> > > you to let me know.  Otherwise, if there are any of those changes which you
> > > are OK with, I would like to just to to get those merged.  Finally, if you would
> > > rather see none of those changes merged (one one to split the assertions in
> > > libavformat and one was for everywhere else in ffmpeg), please let me know
> > > about that too, in which case, if no one advocates for their
> > > inclusion, I'll drop
> > > my proposal to merge these changes.
> > >
> >
> > Unfortunately I have to agree with Mark. asserst that check the same
> > value or extremely closely related values should stay combined.
> >
> I agree this part

I am trying to understand what problem you see with this.

It occurs to me that you might be concerned about generating less
efficient code for the common assert success case, in particular,
in the example I showed for readability, potentially dereferencing
"par" twice, but I made a test program (attached) and determined
from reading the generated assembly that at least for gcc with
optimization -O2 on x86_64, x86_32, aarch64 and arm32, as
long as the abort function has "__attribute__ ((noreturn))", the
compiler seems to be able to avoid repeating the memory fetch
for the second assertion.  I also check this for clang -O2 on
on x86_64.

Of course, without the noreturn attribute on the abort function,
the compiler realizes that the abort function could have written
to memory, so it refetches the value in the split assertion case,
which I think might have been your concern, but as long as
the abort function is declared with an attribute noreturn, we
should be OK for gcc.

On the other hand, I'm not sure what compilers people use
for other platforms such as Microsoft Windows and if you tell
me that it is a known problem on a specific platform that is
potentially relevant to ffmpeg, that would probably change my
mind.

Of course, it's not necessary for you change my mind or for
you to invest further time in this discussion, as I imagine you
and other participants have other things to do.  So, if I don't
get a further explanation, I may still believe that you're wrong,
but I'll respect your need to prioritize tasks other than continuing
this discussion, and will not expect to see my proposed change
merged unless the predominant opinion of others in this discussion
changes to being in favor it, which, so far, I acknowledge, it is not.

> > >
> > > Also after this, I may take a look at adding a branch hint to the av_assertN
> > > macros if nobody objects.
> > >
> >
> > Please don't, we don't do branch hints anywhere, and this is a bad
> > place to start.
> > If an assert is truely performance sensitive (as in, it makes a
> > measurable difference), it should probably be moved from assert0 to
> > assert1, and as such is only enabled in testing builds.
> >
> If assert0 or assert1 lead to performance drop, we need some profiling
> data, then try to fix it.

The above comments by Hendrick and you does not identify a cost to
adding a branch hint to assert.  There would be a downside in the form of
a few lines of code complexity in libavutil/avassert.h.  If that is
your concern,
I guess our disagreement is that I see reducing the cost of assert so that
perhaps CPU usage with and without would be a tiny bit more similar for
reproducing problems and maybe (I'm not saying it's likely) it might tip a
trade-off in favor of keeping an assert enabled in some borderline
circumstance.  I'd take that trade (add the branch prediction).

If you want to educate me on some other reason why I may be wrong,
about adding the branch prediction for assertion checks, I'd been keen
to know, but I realize everyone's time is limited, and if I haven't
convinced you and also created consensus in favor of adding the
branch prediction to assertion checking, then I don't expect to advocate
further on this list for merging such a change into your tree at this time.

Thanks to everyone who has participated in this discussion for your input.

Adam
Hendrik Leppkes May 15, 2019, 8:57 p.m. UTC | #8
On Wed, May 15, 2019 at 9:21 PM Adam Richter <adamrichter4@gmail.com> wrote:
>
> On Tue, May 14, 2019 at 6:48 PM mypopy@gmail.com <mypopy@gmail.com> wrote:
> >
> > On Wed, May 15, 2019 at 7:01 AM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> > >
> > > On Tue, May 14, 2019 at 11:25 PM Adam Richter <adamrichter4@gmail.com> wrote:
> > > >
> > > > Consider, for example, if you agree that columnization makes this range check
> > > > more recognizable in a glance and makes it easier to spot what the bounds are
> > > > (the sixteen space indentation is taken from the code in which it appeared):
> > > >
> > > >                 av_assert0(par->bits_per_coded_sample >= 0 &&
> > > > par->bits_per_coded_sample <= 8);
> > > >
> > > >                             ...vs...
> > > >
> > > >                 av_assert0(par->bits_per_coded_sample >= 0);
> > > >                 av_assert0(par->bits_per_coded_sample <= 8);
> > > >
> > > > A possible counter-argument to this might be that, in a long sequence
> > > > of assertions, can be informative to group related assertions
> > > > together, which I think is true, but it is possible to get this other
> > > > means, such as by using blank lines to separate express such grouping.
> > > >
> > > > So, Mark, if you decide you are OK with my complete patches, I encourage
> > > > you to let me know.  Otherwise, if there are any of those changes which you
> > > > are OK with, I would like to just to to get those merged.  Finally, if you would
> > > > rather see none of those changes merged (one one to split the assertions in
> > > > libavformat and one was for everywhere else in ffmpeg), please let me know
> > > > about that too, in which case, if no one advocates for their
> > > > inclusion, I'll drop
> > > > my proposal to merge these changes.
> > > >
> > >
> > > Unfortunately I have to agree with Mark. asserst that check the same
> > > value or extremely closely related values should stay combined.
> > >
> > I agree this part
>
> I am trying to understand what problem you see with this.
>
> It occurs to me that you might be concerned about generating less
> efficient code for the common assert success case, in particular,
> in the example I showed for readability, potentially dereferencing
> "par" twice, but I made a test program (attached) and determined
> from reading the generated assembly that at least for gcc with
> optimization -O2 on x86_64, x86_32, aarch64 and arm32, as
> long as the abort function has "__attribute__ ((noreturn))", the
> compiler seems to be able to avoid repeating the memory fetch
> for the second assertion.  I also check this for clang -O2 on
> on x86_64.
>
> Of course, without the noreturn attribute on the abort function,
> the compiler realizes that the abort function could have written
> to memory, so it refetches the value in the split assertion case,
> which I think might have been your concern, but as long as
> the abort function is declared with an attribute noreturn, we
> should be OK for gcc.
>
> On the other hand, I'm not sure what compilers people use
> for other platforms such as Microsoft Windows and if you tell
> me that it is a known problem on a specific platform that is
> potentially relevant to ffmpeg, that would probably change my
> mind.
>
> Of course, it's not necessary for you change my mind or for
> you to invest further time in this discussion, as I imagine you
> and other participants have other things to do.  So, if I don't
> get a further explanation, I may still believe that you're wrong,
> but I'll respect your need to prioritize tasks other than continuing
> this discussion, and will not expect to see my proposed change
> merged unless the predominant opinion of others in this discussion
> changes to being in favor it, which, so far, I acknowledge, it is not.

You seem to be totally overthinking this. I'm not concerned about code
generation or anything like that, just the simple fact that I believe
that the checks are more logical and actually easier to understand if
they are logically grouped and combined. And I really don't see the
advantage in any of these changes, personally.

>
> > > >
> > > > Also after this, I may take a look at adding a branch hint to the av_assertN
> > > > macros if nobody objects.
> > > >
> > >
> > > Please don't, we don't do branch hints anywhere, and this is a bad
> > > place to start.
> > > If an assert is truely performance sensitive (as in, it makes a
> > > measurable difference), it should probably be moved from assert0 to
> > > assert1, and as such is only enabled in testing builds.
> > >
> > If assert0 or assert1 lead to performance drop, we need some profiling
> > data, then try to fix it.
>
> The above comments by Hendrick and you does not identify a cost to
> adding a branch hint to assert.  There would be a downside in the form of
> a few lines of code complexity in libavutil/avassert.h.  If that is
> your concern,
> I guess our disagreement is that I see reducing the cost of assert so that
> perhaps CPU usage with and without would be a tiny bit more similar for
> reproducing problems and maybe (I'm not saying it's likely) it might tip a
> trade-off in favor of keeping an assert enabled in some borderline
> circumstance.  I'd take that trade (add the branch prediction).
>
> If you want to educate me on some other reason why I may be wrong,
> about adding the branch prediction for assertion checks, I'd been keen
> to know, but I realize everyone's time is limited, and if I haven't
> convinced you and also created consensus in favor of adding the
> branch prediction to assertion checking, then I don't expect to advocate
> further on this list for merging such a change into your tree at this time.
>

Check the mailing list archives for previous discussion of using
"likely"/"unlikely" and the likes. There is serious contention to
their usefulness in general, so we should rather avoid making a
precedent for them in some debug statements.

- Hendrik
Michael Niedermayer May 17, 2019, 9:08 a.m. UTC | #9
On Wed, May 15, 2019 at 12:13:07PM -0700, Adam Richter wrote:
> On Tue, May 14, 2019 at 6:48 PM mypopy@gmail.com <mypopy@gmail.com> wrote:
> >
> > On Wed, May 15, 2019 at 7:01 AM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> > >
> > > On Tue, May 14, 2019 at 11:25 PM Adam Richter <adamrichter4@gmail.com> wrote:
[...]
> > > >
> > > > Also after this, I may take a look at adding a branch hint to the av_assertN
> > > > macros if nobody objects.
> > > >
> > >
> > > Please don't, we don't do branch hints anywhere, and this is a bad
> > > place to start.
> > > If an assert is truely performance sensitive (as in, it makes a
> > > measurable difference), it should probably be moved from assert0 to
> > > assert1, and as such is only enabled in testing builds.
> > >
> > If assert0 or assert1 lead to performance drop, we need some profiling
> > data, then try to fix it.
> 
> The above comments by Hendrick and you does not identify a cost to
> adding a branch hint to assert.  There would be a downside in the form of
> a few lines of code complexity in libavutil/avassert.h.  If that is
> your concern,
> I guess our disagreement is that I see reducing the cost of assert so that
> perhaps CPU usage with and without would be a tiny bit more similar for
> reproducing problems and maybe (I'm not saying it's likely) it might tip a
> trade-off in favor of keeping an assert enabled in some borderline
> circumstance.  I'd take that trade (add the branch prediction).
> 
> If you want to educate me on some other reason why I may be wrong,
> about adding the branch prediction for assertion checks, I'd been keen
> to know, but I realize everyone's time is limited, and if I haven't
> convinced you and also created consensus in favor of adding the
> branch prediction to assertion checking, then I don't expect to advocate
> further on this list for merging such a change into your tree at this time.

I think a key question here would be if a speedeffect or code generation
improvment can be shown to have actually occured. Instead of assuming that
it could.

[...]
diff mbox

Patch

From f815a2481a19cfd191b9f97e246b307b71d6c790 Mon Sep 17 00:00:00 2001
From: Adam Richter <adamrichter4@gmail.com>
Date: Sun, 12 May 2019 08:02:51 -0700
Subject: [PATCH] "assert(a && b)" --> "assert(a); assert(b)" for more
 precise diagnostics, except for libformat.

This patch separates statements of the form "assert(a && b);" into
"assert(a);" and "assert(b);", for more precise diagnostics when
an assertion fails, which can be especially important in cases where
the problem may not be easily reproducible and save developer time.
Usually, this involves functions like av_assert0.

There are a couple of cases that this patch does not change:
(1) assert conjunctions of the form assert(condition && "string literal
    to pass to the user as a helpful tip."), and
(2) assert condjunctions where the first part contained a variable
    assignment that was used in the second part of the assertion and
    not outside the assert (so that the variable assignment be elided
    if the assertion checking omitted).

This patch covers all of ffmpeg except for libavformat, which was
covered in a patch that I previously submitted separately.

These changes build without any new complaints that I noticed, and
"make fate" succeeds, but I have not otherwise tested them.

Signed-off-by: Adam Richter <adamrichter4@gmail.com>
---
 fftools/cmdutils.c                    |  3 +-
 fftools/ffmpeg.c                      |  3 +-
 libavcodec/4xm.c                      | 12 +++++---
 libavcodec/aaccoder_twoloop.h         |  3 +-
 libavcodec/aacenc.c                   |  3 +-
 libavcodec/aacenc_quantization_misc.h |  3 +-
 libavcodec/aacpsy.c                   |  6 ++--
 libavcodec/ac3enc.c                   | 15 ++++++----
 libavcodec/acelp_filters.c            |  3 +-
 libavcodec/amfenc.c                   |  5 ++--
 libavcodec/amrnbdec.c                 |  3 +-
 libavcodec/av1_frame_split_bsf.c      |  3 +-
 libavcodec/avpacket.c                 |  3 +-
 libavcodec/cbs.c                      | 42 ++++++++++++++++++---------
 libavcodec/cbs_av1.c                  |  9 ++++--
 libavcodec/cbs_av1_syntax_template.c  |  3 +-
 libavcodec/cbs_h2645.c                | 10 ++++---
 libavcodec/cbs_mpeg2.c                |  4 +--
 libavcodec/cbs_vp9.c                  |  8 +++--
 libavcodec/celp_filters.c             |  3 +-
 libavcodec/dca_core.c                 |  3 +-
 libavcodec/decode.c                   |  4 +--
 libavcodec/dvdsubdec.c                |  3 +-
 libavcodec/dvenc.c                    |  3 +-
 libavcodec/dxva2_h264.c               |  3 +-
 libavcodec/dxva2_hevc.c               |  3 +-
 libavcodec/dxva2_vp9.c                |  3 +-
 libavcodec/error_resilience.c         |  3 +-
 libavcodec/ffv1dec.c                  |  3 +-
 libavcodec/flacenc.c                  |  6 ++--
 libavcodec/get_bits.h                 | 35 +++++++++++++++-------
 libavcodec/h263dec.c                  |  3 +-
 libavcodec/h2645_parse.c              |  6 ++--
 libavcodec/h264_refs.c                |  3 +-
 libavcodec/h264_slice.c               |  3 +-
 libavcodec/h264chroma_template.c      | 20 ++++++++++---
 libavcodec/hevc_filter.c              |  6 ++--
 libavcodec/huffyuv.c                  |  3 +-
 libavcodec/huffyuvenc.c               |  5 +++-
 libavcodec/ituh263enc.c               |  3 +-
 libavcodec/ivi.c                      |  4 ++-
 libavcodec/jpeg2000dec.c              |  3 +-
 libavcodec/lclenc.c                   |  3 +-
 libavcodec/lpc.c                      |  5 ++--
 libavcodec/lzwenc.c                   |  9 ++++--
 libavcodec/mips/h264chroma_msa.c      | 31 +++++++++++++++-----
 libavcodec/mips/vc1dsp_mmi.c          | 20 ++++++++++---
 libavcodec/mjpegdec.c                 | 11 ++++---
 libavcodec/motion_est.c               | 12 ++++++--
 libavcodec/motion_est_template.c      | 10 +++++--
 libavcodec/mpeg12.c                   |  3 +-
 libavcodec/mpeg12enc.c                |  6 ++--
 libavcodec/mpeg4videoenc.c            |  6 ++--
 libavcodec/mpegaudiodec_template.c    |  3 +-
 libavcodec/mpegaudioenc_template.c    |  6 ++--
 libavcodec/mpegutils.c                |  6 ++--
 libavcodec/mpegvideo_enc.c            |  9 ++++--
 libavcodec/mpegvideo_xvmc.c           |  3 +-
 libavcodec/mpegvideoencdsp.c          |  3 +-
 libavcodec/mqcenc.c                   |  3 +-
 libavcodec/put_bits.h                 |  9 ++++--
 libavcodec/rv34.c                     |  3 +-
 libavcodec/rv40dsp.c                  | 10 +++++--
 libavcodec/sanm.c                     |  3 +-
 libavcodec/sinewin_tablegen.h         |  3 +-
 libavcodec/snow.c                     |  3 +-
 libavcodec/snow.h                     |  3 +-
 libavcodec/snow_dwt.c                 |  3 +-
 libavcodec/snowenc.c                  | 14 +++++----
 libavcodec/svq1enc.c                  | 24 ++++++++++-----
 libavcodec/vaapi_encode.c             |  8 +++--
 libavcodec/vaapi_encode_h264.c        |  3 +-
 libavcodec/vaapi_encode_h265.c        |  6 ++--
 libavcodec/vaapi_encode_vp9.c         |  4 +--
 libavcodec/vc1_pred.c                 |  3 +-
 libavcodec/vc1dsp.c                   | 20 ++++++++++---
 libavcodec/videodsp_template.c        |  6 ++--
 libavcodec/vp9.c                      |  3 +-
 libavcodec/vp9recon.c                 |  3 +-
 libavcodec/wmaenc.c                   |  6 ++--
 libavcodec/x86/videodsp_init.c        |  6 ++--
 libavdevice/avdevice.c                |  3 +-
 libavdevice/opengl_enc.c              |  3 +-
 libavfilter/af_atempo.c               |  9 +++---
 libavfilter/af_dynaudnorm.c           |  3 +-
 libavfilter/af_surround.c             |  8 +++--
 libavfilter/asrc_sinc.c               |  3 +-
 libavfilter/avfilter.c                |  3 +-
 libavfilter/colorspacedsp_template.c  |  3 +-
 libavfilter/transform.c               |  6 ++--
 libavfilter/vf_curves.c               |  7 +++--
 libavfilter/vf_fieldmatch.c           |  4 ++-
 libavfilter/vf_lut3d.c                |  3 +-
 libavfilter/vf_mergeplanes.c          |  3 +-
 libavfilter/vf_nlmeans.c              |  4 ++-
 libavfilter/vsrc_testsrc.c            |  3 +-
 libavutil/frame.c                     |  6 ++--
 libavutil/hwcontext_opencl.c          |  4 +--
 libavutil/integer.c                   |  3 +-
 libavutil/mathematics.c               |  3 +-
 libavutil/pixdesc.c                   | 12 ++++++--
 libavutil/rational.c                  |  3 +-
 libavutil/softfloat.h                 |  3 +-
 libswresample/resample.c              |  3 +-
 libswscale/swscale_unscaled.c         |  7 +++--
 libswscale/utils.c                    |  3 +-
 libswscale/vscale.c                   |  3 +-
 tests/checkasm/vf_nlmeans.c           |  3 +-
 108 files changed, 471 insertions(+), 211 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9cfbc45c2b..8cbff328bc 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -2257,7 +2257,8 @@  static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionar
     int ret;
     if (arg) {
         char *opts_str = NULL;
-        av_assert0(dev && opts);
+        av_assert0(dev);
+        av_assert0(opts);
         *dev = av_strdup(arg);
         if (!*dev)
             return AVERROR(ENOMEM);
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..53cf1794b0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3060,7 +3060,8 @@  static int init_output_stream_streamcopy(OutputStream *ost)
     int i, ret;
     uint32_t codec_tag = par_dst->codec_tag;
 
-    av_assert0(ist && !ost->filter);
+    av_assert0(ist);
+    av_assert0(!ost->filter);
 
     ret = avcodec_parameters_to_context(ost->enc_ctx, ist->st->codecpar);
     if (ret >= 0)
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 2b88c899d0..7b3246b1ff 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -346,7 +346,8 @@  static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
     uint16_t *start, *end;
     unsigned dc = 0;
 
-    av_assert0(log2w >= 0 && log2h >= 0);
+    av_assert0(log2w >= 0);
+    av_assert0(log2h >= 0);
 
     index = size2index[log2h][log2w];
     av_assert0(index >= 0);
@@ -354,7 +355,8 @@  static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
     h     = 1 << log2h;
     code  = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
                      BLOCK_TYPE_VLC_BITS, 1);
-    av_assert0(code >= 0 && code <= 6);
+    av_assert0(code >= 0);
+    av_assert0(code <= 6);
 
     start = f->last_frame_buffer;
     end   = start + stride * (f->avctx->height - h + 1) - (1 << log2w);
@@ -409,7 +411,8 @@  static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
             av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
             return AVERROR_INVALIDDATA;
         }
-        av_assert0(start <= src && src <= end);
+        av_assert0(start <= src);
+        av_assert0(src <= end);
         scale = 0;
         dc    = bytestream2_get_le16(&f->g2);
     }
@@ -836,7 +839,8 @@  static int decode_frame(AVCodecContext *avctx, void *data,
     if (buf_size < 20)
         return AVERROR_INVALIDDATA;
 
-    av_assert0(avctx->width % 16 == 0 && avctx->height % 16 == 0);
+    av_assert0(avctx->width % 16 == 0);
+    av_assert0(avctx->height % 16 == 0);
 
     if (buf_size < AV_RL32(buf + 4) + 8) {
         av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %"PRIu32"\n",
diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h
index 8e1bc88a85..328d8c9cd1 100644
--- a/libavcodec/aaccoder_twoloop.h
+++ b/libavcodec/aaccoder_twoloop.h
@@ -749,7 +749,8 @@  static void search_for_quantizers_twoloop(AVCodecContext *avctx,
             if (!sce->zeroes[w*16+g]) {
                 if (prev != -1) {
                     av_unused int sfdiff = sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO;
-                    av_assert1(sfdiff >= 0 && sfdiff <= 2*SCALE_MAX_DIFF);
+                    av_assert1(sfdiff >= 0);
+                    av_assert1(sfdiff <= 2*SCALE_MAX_DIFF);
                 } else if (sce->zeroes[0]) {
                     /** Set global gain to something useful */
                     sce->sf_idx[0] = sce->sf_idx[w*16+g];
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 4d0abb107f..c8e6281e11 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -407,7 +407,8 @@  static void encode_scale_factors(AVCodecContext *avctx, AACEncContext *s,
                     off_sf = sce->sf_idx[w*16 + i];
                 }
                 diff += SCALE_DIFF_ZERO;
-                av_assert0(diff >= 0 && diff <= 120);
+                av_assert0(diff >= 0);
+                av_assert0(diff <= 120);
                 put_bits(&s->pb, ff_aac_scalefactor_bits[diff], ff_aac_scalefactor_code[diff]);
             }
         }
diff --git a/libavcodec/aacenc_quantization_misc.h b/libavcodec/aacenc_quantization_misc.h
index 28676ca8d5..efc6f92d41 100644
--- a/libavcodec/aacenc_quantization_misc.h
+++ b/libavcodec/aacenc_quantization_misc.h
@@ -34,7 +34,8 @@  static inline float quantize_band_cost_cached(struct AACEncContext *s, int w, in
                                 int *bits, float *energy, int rtz)
 {
     AACQuantizeBandCostCacheEntry *entry;
-    av_assert1(scale_idx >= 0 && scale_idx < 256);
+    av_assert1(scale_idx >= 0);
+    av_assert1(scale_idx < 256);
     entry = &s->quantize_band_cost_cache[scale_idx][w*16+g];
     if (entry->generation != s->quantize_band_cost_cache_generation || entry->cb != cb || entry->rtz != rtz) {
         entry->rd = quantize_band_cost(s, in, scaled, size, scale_idx,
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index fca692cb15..bef52e8b02 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -504,9 +504,11 @@  static int calc_bit_demand(AacPsyContext *ctx, float pe, int bits, int size,
     fill_level = av_clipf((float)ctx->fill_level / size, clip_low, clip_high);
     clipped_pe = av_clipf(pe, ctx->pe.min, ctx->pe.max);
     bit_save   = (fill_level + bitsave_add) * bitsave_slope;
-    assert(bit_save <= 0.3f && bit_save >= -0.05000001f);
+    assert(bit_save <= 0.3f);
+    assert(bit_save >= -0.05000001f);
     bit_spend  = (fill_level + bitspend_add) * bitspend_slope;
-    assert(bit_spend <= 0.5f && bit_spend >= -0.1f);
+    assert(bit_spend <= 0.5f);
+    assert(bit_spend >= -0.1f);
     /* The bit factor graph in the spec is obviously incorrect.
      *      bit_spend + ((bit_spend - bit_spend))...
      * The reference encoder subtracts everything from 1, but also seems incorrect.
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index e7e18af92d..cf0d7b0c10 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -606,19 +606,22 @@  void ff_ac3_group_exponents(AC3EncodeContext *s)
                 exp1   = p[0];
                 p     += group_size;
                 delta0 = exp1 - exp0 + 2;
-                av_assert2(delta0 >= 0 && delta0 <= 4);
+                av_assert2(delta0 >= 0);
+                av_assert2(delta0 <= 4);
 
                 exp0   = exp1;
                 exp1   = p[0];
                 p     += group_size;
                 delta1 = exp1 - exp0 + 2;
-                av_assert2(delta1 >= 0 && delta1 <= 4);
+                av_assert2(delta1 >= 0);
+                av_assert2(delta1 <= 4);
 
                 exp0   = exp1;
                 exp1   = p[0];
                 p     += group_size;
                 delta2 = exp1 - exp0 + 2;
-                av_assert2(delta2 >= 0 && delta2 <= 4);
+                av_assert2(delta2 >= 0);
+                av_assert2(delta2 <= 4);
 
                 block->grouped_exp[ch][i] = ((delta0 * 5 + delta1) * 5) + delta2;
             }
@@ -1166,7 +1169,8 @@  int ff_ac3_compute_bit_allocation(AC3EncodeContext *s)
 static inline int sym_quant(int c, int e, int levels)
 {
     int v = (((levels * c) >> (24 - e)) + levels) >> 1;
-    av_assert2(v >= 0 && v < levels);
+    av_assert2(v >= 0);
+    av_assert2(v < levels);
     return v;
 }
 
@@ -2179,7 +2183,8 @@  static av_cold int validate_options(AC3EncodeContext *s)
 
         /* calculate words-per-frame for the selected bitrate */
         wpf = (avctx->bit_rate / 16) * frame_samples / s->sample_rate;
-        av_assert1(wpf > 0 && wpf <= 2048);
+        av_assert1(wpf > 0);
+        av_assert1(wpf <= 2048);
 
         /* find the closest AC-3 bitrate code to the selected bitrate.
            this is needed for lookup tables for bandwidth and coupling
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c
index 35aa863e7a..e7db362cc5 100644
--- a/libavcodec/acelp_filters.c
+++ b/libavcodec/acelp_filters.c
@@ -47,7 +47,8 @@  void ff_acelp_interpolate(int16_t* out, const int16_t* in,
 {
     int n, i;
 
-    av_assert1(frac_pos >= 0 && frac_pos < precision);
+    av_assert1(frac_pos >= 0);
+    av_assert1(frac_pos < precision);
 
     for (n = 0; n < length; n++) {
         int idx = 0;
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 384d8efc92..ad8aa22d51 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -618,8 +618,9 @@  int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame *frame)
                 ID3D11Texture2D *texture = (ID3D11Texture2D*)frame->data[0]; // actual texture
                 int index = (intptr_t)frame->data[1]; // index is a slice in texture array is - set to tell AMF which slice to use
 
-                av_assert0(frame->hw_frames_ctx       && ctx->hw_frames_ctx &&
-                           frame->hw_frames_ctx->data == ctx->hw_frames_ctx->data);
+                av_assert0(frame->hw_frames_ctx);
+                av_assert0(ctx->hw_frames_ctx);
+                av_assert0(frame->hw_frames_ctx->data == ctx->hw_frames_ctx->data);
 
                 texture->lpVtbl->SetPrivateData(texture, &AMFTextureArrayIndexGUID, sizeof(index), &index);
 
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index ea299acd4e..3c4f3c8474 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -499,7 +499,8 @@  static void decode_8_pulses_31bits(const int16_t *fixed_index,
 static void decode_fixed_sparse(AMRFixed *fixed_sparse, const uint16_t *pulses,
                                 const enum Mode mode, const int subframe)
 {
-    av_assert1(MODE_4k75 <= (signed)mode && mode <= MODE_12k2);
+    av_assert1(MODE_4k75 <= (signed)mode);
+    av_assert1(mode <= MODE_12k2);
 
     if (mode == MODE_12k2) {
         ff_decode_10_pulses_35bits(pulses, fixed_sparse, gray_decode, 5, 3);
diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c
index a386c6edc1..15f8929624 100644
--- a/libavcodec/av1_frame_split_bsf.c
+++ b/libavcodec/av1_frame_split_bsf.c
@@ -153,7 +153,8 @@  static int av1_frame_split_filter(AVBSFContext *ctx, AVPacket *out)
                 }
             }
         }
-        av_assert0(frame && s->cur_frame <= s->nb_frames);
+        av_assert0(frame);
+        av_assert0(s->cur_frame <= s->nb_frames);
 
         ret = av_packet_ref(out, s->buffer_pkt);
         if (ret < 0)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 2b20067211..1ada7b99dd 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -465,7 +465,8 @@  int av_packet_split_side_data(AVPacket *pkt){
         p= pkt->data + pkt->size - 8 - 5;
         for (i=0; ; i++){
             size= AV_RB32(p);
-            av_assert0(size<=INT_MAX - 5 && p - pkt->data >= size);
+            av_assert0(size<=INT_MAX - 5);
+            av_assert0(p - pkt->data >= size);
             pkt->side_data[i].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
             pkt->side_data[i].size = size;
             pkt->side_data[i].type = p[4]&127;
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 0260ba6f67..918ca569b2 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -180,7 +180,8 @@  static int cbs_read_fragment_content(CodedBitstreamContext *ctx,
         av_buffer_unref(&unit->content_ref);
         unit->content = NULL;
 
-        av_assert0(unit->data && unit->data_ref);
+        av_assert0(unit->data);
+        av_assert0(unit->data_ref);
 
         err = ctx->codec->read_unit(ctx, unit);
         if (err == AVERROR(ENOSYS)) {
@@ -201,7 +202,8 @@  static int cbs_fill_fragment_data(CodedBitstreamContext *ctx,
                                   CodedBitstreamFragment *frag,
                                   const uint8_t *data, size_t size)
 {
-    av_assert0(!frag->data && !frag->data_ref);
+    av_assert0(!frag->data);
+    av_assert0(!frag->data_ref);
 
     frag->data_ref =
         av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
@@ -301,7 +303,8 @@  int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx,
                    "(type %"PRIu32").\n", i, unit->type);
             return err;
         }
-        av_assert0(unit->data && unit->data_ref);
+        av_assert0(unit->data);
+        av_assert0(unit->data_ref);
     }
 
     av_buffer_unref(&frag->data_ref);
@@ -312,7 +315,8 @@  int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx,
         av_log(ctx->log_ctx, AV_LOG_ERROR, "Failed to assemble fragment.\n");
         return err;
     }
-    av_assert0(frag->data && frag->data_ref);
+    av_assert0(frag->data);
+    av_assert0(frag->data_ref);
 
     return 0;
 }
@@ -386,7 +390,8 @@  void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position,
     if (!ctx->trace_enable)
         return;
 
-    av_assert0(value >= INT_MIN && value <= UINT32_MAX);
+    av_assert0(value >= INT_MIN);
+    av_assert0(value <= UINT32_MAX);
 
     subs = subscripts ? subscripts[0] : 0;
     n = 0;
@@ -395,7 +400,8 @@  void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position,
             if (n < subs) {
                 ++n;
                 k = snprintf(name + j, sizeof(name) - j, "[%d", subscripts[n]);
-                av_assert0(k > 0 && j + k < sizeof(name));
+                av_assert0(k > 0);
+                av_assert0(j + k < sizeof(name));
                 j += k;
                 for (++i; str[i] && str[i] != ']'; i++);
                 av_assert0(str[i] == ']');
@@ -433,7 +439,8 @@  int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc,
     uint32_t value;
     int position;
 
-    av_assert0(width > 0 && width <= 32);
+    av_assert0(width > 0);
+    av_assert0(width <= 32);
 
     if (get_bits_left(gbc) < width) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid value at "
@@ -473,7 +480,8 @@  int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc,
                           const int *subscripts, uint32_t value,
                           uint32_t range_min, uint32_t range_max)
 {
-    av_assert0(width > 0 && width <= 32);
+    av_assert0(width > 0);
+    av_assert0(width <= 32);
 
     if (value < range_min || value > range_max) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
@@ -512,7 +520,8 @@  int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc,
     int32_t value;
     int position;
 
-    av_assert0(width > 0 && width <= 32);
+    av_assert0(width > 0);
+    av_assert0(width <= 32);
 
     if (get_bits_left(gbc) < width) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid value at "
@@ -552,7 +561,8 @@  int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc,
                         const int *subscripts, int32_t value,
                         int32_t range_min, int32_t range_max)
 {
-    av_assert0(width > 0 && width <= 32);
+    av_assert0(width > 0);
+    av_assert0(width <= 32);
 
     if (value < range_min || value > range_max) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
@@ -589,7 +599,8 @@  int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
                               size_t size,
                               void (*free)(void *opaque, uint8_t *data))
 {
-    av_assert0(!unit->content && !unit->content_ref);
+    av_assert0(!unit->content);
+    av_assert0(!unit->content_ref);
 
     unit->content = av_mallocz(size);
     if (!unit->content)
@@ -609,7 +620,8 @@  int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
                            CodedBitstreamUnit *unit,
                            size_t size)
 {
-    av_assert0(!unit->data && !unit->data_ref);
+    av_assert0(!unit->data);
+    av_assert0(!unit->data_ref);
 
     unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
     if (!unit->data_ref)
@@ -675,7 +687,8 @@  int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
 
     if (position == -1)
         position = frag->nb_units;
-    av_assert0(position >= 0 && position <= frag->nb_units);
+    av_assert0(position >= 0);
+    av_assert0(position <= frag->nb_units);
 
     if (content_buf) {
         content_ref = av_buffer_ref(content_buf);
@@ -712,7 +725,8 @@  int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
 
     if (position == -1)
         position = frag->nb_units;
-    av_assert0(position >= 0 && position <= frag->nb_units);
+    av_assert0(position >= 0);
+    av_assert0(position <= frag->nb_units);
 
     if (data_buf)
         data_ref = av_buffer_ref(data_buf);
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index eb2d03ef43..9c4d7e8bf5 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -314,7 +314,8 @@  static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc
     int position, i;
     char bits[33];
 
-    av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1);
+    av_assert0(range_min <= range_max);
+    av_assert0(range_max - range_min < sizeof(bits) - 1);
     if (ctx->trace_enable)
         position = get_bits_count(gbc);
 
@@ -349,7 +350,8 @@  static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb
 {
     int len;
 
-    av_assert0(range_min <= range_max && range_max - range_min < 32);
+    av_assert0(range_min <= range_max);
+    av_assert0(range_max - range_min < 32);
     if (value < range_min || value > range_max) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
                "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n",
@@ -784,7 +786,8 @@  static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
             obu_size = size - 1 - header.obu_extension_flag;
 
         pos = get_bits_count(&gbc);
-        av_assert0(pos % 8 == 0 && pos / 8 <= size);
+        av_assert0(pos % 8 == 0);
+        av_assert0(pos / 8 <= size);
 
         obu_length = pos / 8 + obu_size;
 
diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index b04cd51d55..5cdb9ca83f 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1482,7 +1482,8 @@  static int FUNC(frame_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
 
             HEADER("Redundant Frame Header");
 
-            av_assert0(priv->frame_header_ref && priv->frame_header);
+            av_assert0(priv->frame_header_ref);
+            av_assert0(priv->frame_header);
 
             init_get_bits(&fh, priv->frame_header,
                           priv->frame_header_size);
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 319202fc48..ccf9106c5a 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -588,7 +588,8 @@  static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
     GetByteContext gbc;
     int err;
 
-    av_assert0(frag->data && frag->nb_units == 0);
+    av_assert0(frag->data);
+    av_assert0(frag->nb_units == 0);
     if (frag->data_size == 0)
         return 0;
 
@@ -1097,8 +1098,8 @@  static int cbs_h2645_write_slice_data(CodedBitstreamContext *ctx,
     size_t rest  = data_size - (data_bit_start + 7) / 8;
     const uint8_t *pos = data + data_bit_start / 8;
 
-    av_assert0(data_bit_start >= 0 &&
-               8 * data_size > data_bit_start);
+    av_assert0(data_bit_start >= 0);
+    av_assert0(8 * data_size > data_bit_start);
 
     if (data_size * 8 + 8 > put_bits_left(pbc))
         return AVERROR(ENOSPC);
@@ -1651,7 +1652,8 @@  int ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
     H264RawSEI *sei = nal->content;
 
     av_assert0(nal->type == H264_NAL_SEI);
-    av_assert0(position >= 0 && position < sei->payload_count);
+    av_assert0(position >= 0);
+    av_assert0(position < sei->payload_count);
 
     if (position == 0 && sei->payload_count == 1) {
         // Deleting NAL unit entirely.
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index 8b8b266563..57371e7b6d 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -274,8 +274,8 @@  static int cbs_mpeg2_write_slice(CodedBitstreamContext *ctx,
         size_t rest = slice->data_size - (slice->data_bit_start + 7) / 8;
         uint8_t *pos = slice->data + slice->data_bit_start / 8;
 
-        av_assert0(slice->data_bit_start >= 0 &&
-                   8 * slice->data_size > slice->data_bit_start);
+        av_assert0(slice->data_bit_start >= 0);
+        av_assert0(8 * slice->data_size > slice->data_bit_start);
 
         if (slice->data_size * 8 + 8 > put_bits_left(pbc))
             return AVERROR(ENOSPC);
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
index 0b5f137ed8..d544b55a7a 100644
--- a/libavcodec/cbs_vp9.c
+++ b/libavcodec/cbs_vp9.c
@@ -100,7 +100,9 @@  static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc
     int position, i;
     char bits[8];
 
-    av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1);
+    av_assert0(range_min <= range_max);
+    av_assert0(range_max - range_min < sizeof(bits) - 1);
+
     if (ctx->trace_enable)
         position = get_bits_count(gbc);
 
@@ -134,7 +136,9 @@  static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb
 {
     int len;
 
-    av_assert0(range_min <= range_max && range_max - range_min < 8);
+    av_assert0(range_min <= range_max);
+    av_assert0(range_max - range_min < 8);
+
     if (value < range_min || value > range_max) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
                "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n",
diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c
index fafedd99a3..90d0612ac6 100644
--- a/libavcodec/celp_filters.c
+++ b/libavcodec/celp_filters.c
@@ -105,7 +105,8 @@  void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
     c -= filter_coeffs[1] * filter_coeffs[0];
     c -= filter_coeffs[0] * b;
 
-    av_assert2((filter_length&1)==0 && filter_length>=4);
+    av_assert2((filter_length&1) == 0);
+    av_assert2(filter_length >= 4);
 
     old_out0 = out[-4];
     old_out1 = out[-3];
diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index accc5efd51..67fc14ad1c 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -572,7 +572,8 @@  static inline int parse_huffman_codes(DCACoreDecoder *s, int32_t *audio, int abi
 
 static inline int extract_audio(DCACoreDecoder *s, int32_t *audio, int abits, int ch)
 {
-    av_assert1(abits >= 0 && abits <= DCA_ABITS_MAX);
+    av_assert1(abits >= 0);
+    av_assert1(abits <= DCA_ABITS_MAX);
 
     if (abits == 0) {
         // No bits allocated
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6c31166ec2..9e63433c10 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1102,8 +1102,8 @@  int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
                 sub->pts = av_rescale_q(avpkt->pts,
                                         avctx->pkt_timebase, AV_TIME_BASE_Q);
             ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
-            av_assert1((ret >= 0) >= !!*got_sub_ptr &&
-                       !!*got_sub_ptr >= !!sub->num_rects);
+            av_assert1((ret >= 0) >= !!*got_sub_ptr);
+            av_assert1(!!*got_sub_ptr >= !!sub->num_rects);
 
 #if FF_API_ASS_TIMING
             if (avctx->sub_text_format == FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 741ea9fd1e..ea3976e18c 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -554,7 +554,8 @@  static int append_to_cached_buf(AVCodecContext *avctx,
 {
     DVDSubContext *ctx = avctx->priv_data;
 
-    av_assert0(buf_size >= 0 && ctx->buf_size <= sizeof(ctx->buf));
+    av_assert0(buf_size >= 0);
+    av_assert0(ctx->buf_size <= sizeof(ctx->buf));
     if (buf_size >= sizeof(ctx->buf) - ctx->buf_size) {
         av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
                "too large SPU packets aborted.\n");
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index ce2fc75daa..c779ab8881 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -389,7 +389,8 @@  static inline void dv_guess_qnos(EncBlockInfo *blks, int *qnos)
                                     av_assert2(b->mb[b->next[k]]);
                                     b->bit_size[a2] += dv_rl2vlc_size(b->next[k] - prev - 1, b->mb[b->next[k]]) -
                                                        dv_rl2vlc_size(b->next[k] - k    - 1, b->mb[b->next[k]]);
-                                    av_assert2(b->prev[a2] == k && (a2 + 1 >= 4 || b->prev[a2 + 1] != k));
+                                    av_assert2(b->prev[a2] == k);
+                                    av_assert2(a2 + 1 >= 4 || b->prev[a2 + 1] != k);
                                     b->prev[a2] = prev;
                                 }
                                 b->next[prev] = b->next[k];
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 5b23b28f12..11f73e149b 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -41,7 +41,8 @@  struct dxva2_picture_context {
 static void fill_picture_entry(DXVA_PicEntry_H264 *pic,
                                unsigned index, unsigned flag)
 {
-    assert((index&0x7f) == index && (flag&0x01) == flag);
+    assert((index&0x7f) == index);
+    assert((flag&0x01) == flag);
     pic->bPicEntry = index | (flag << 7);
 }
 
diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index dbb701fb1c..cea920e742 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -40,7 +40,8 @@  struct hevc_dxva2_picture_context {
 static void fill_picture_entry(DXVA_PicEntry_HEVC *pic,
                                unsigned index, unsigned flag)
 {
-    av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
+    av_assert0((index & 0x7f) == index);
+    av_assert0((flag & 0x01) == flag);
     pic->bPicEntry = index | (flag << 7);
 }
 
diff --git a/libavcodec/dxva2_vp9.c b/libavcodec/dxva2_vp9.c
index eaeab3af7a..3e12f77aec 100644
--- a/libavcodec/dxva2_vp9.c
+++ b/libavcodec/dxva2_vp9.c
@@ -36,7 +36,8 @@  struct vp9_dxva2_picture_context {
 static void fill_picture_entry(DXVA_PicEntry_VPx *pic,
                                unsigned index, unsigned flag)
 {
-    av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
+    av_assert0((index & 0x7f) == index);
+    av_assert0((flag & 0x01) == flag);
     pic->bPicEntry = index | (flag << 7);
 }
 
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 35d0c609e5..39e2b62a21 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -499,7 +499,8 @@  static void guess_mv(ERContext *s)
 
 
                 av_assert1(!IS_INTRA(s->cur_pic.mb_type[mb_xy]));
-                av_assert1(s->last_pic.f && s->last_pic.f->data[0]);
+                av_assert1(s->last_pic.f);
+                av_assert1(s->last_pic.f->data[0]);
 
                 j = 0;
                 if (mb_x > 0)
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 261e0cf70c..bf0fe03e11 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -318,7 +318,8 @@  static int decode_slice(AVCodecContext *c, void *arg)
                       (fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count) * 8);
     }
 
-    av_assert1(width && height);
+    av_assert1(width);
+    av_assert1(height);
     if (f->colorspace == 0 && (f->chroma_planes || !fs->transparency)) {
         const int chroma_width  = AV_CEIL_RSHIFT(width,  f->chroma_h_shift);
         const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 170c3caf48..5b1ee0bf23 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -714,8 +714,10 @@  static uint64_t calc_rice_params(RiceContext *rc,
     RiceContext tmp_rc;
     int kmax = (1 << rc->coding_mode) - 2;
 
-    av_assert1(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
-    av_assert1(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
+    av_assert1(pmin >= 0);
+    av_assert1(pmin <= MAX_PARTITION_ORDER);
+    av_assert1(pmax >= 0);
+    av_assert1(pmax <= MAX_PARTITION_ORDER);
     av_assert1(pmin <= pmax);
 
     tmp_rc.coding_mode = rc->coding_mode;
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index c4ab607744..2dc4b7d400 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -259,7 +259,10 @@  static inline void refill_64(GetBitContext *s, int is_le)
 static inline uint64_t get_val(GetBitContext *s, unsigned n, int is_le)
 {
     uint64_t ret;
-    av_assert2(n>0 && n<=63);
+
+    av_assert2(n > 0);
+    av_assert2(n <= 63);
+
     if (is_le) {
         ret = s->cache & ((UINT64_C(1) << n) - 1);
         s->cache >>= n;
@@ -330,7 +333,8 @@  static inline int get_xbits(GetBitContext *s, int n)
     register int sign;
     register int32_t cache;
     OPEN_READER(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE(re, s);
     cache = GET_CACHE(re, s);
     sign  = ~cache >> 31;
@@ -346,7 +350,8 @@  static inline int get_xbits_le(GetBitContext *s, int n)
     register int sign;
     register int32_t cache;
     OPEN_READER(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE_LE(re, s);
     cache = GET_CACHE(re, s);
     sign  = sign_extend(~cache, n) >> 31;
@@ -360,11 +365,13 @@  static inline int get_sbits(GetBitContext *s, int n)
 {
     register int tmp;
 #if CACHED_BITSTREAM_READER
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     tmp = sign_extend(get_bits(s, n), n);
 #else
     OPEN_READER(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_SBITS(re, s, n);
     LAST_SKIP_BITS(re, s, n);
@@ -381,7 +388,8 @@  static inline unsigned int get_bits(GetBitContext *s, int n)
     register unsigned int tmp;
 #if CACHED_BITSTREAM_READER
 
-    av_assert2(n>0 && n<=32);
+    av_assert2(n > 0);
+    av_assert2(n <= 32);
     if (n > s->bits_left) {
 #ifdef BITSTREAM_READER_LE
         refill_32(s, 1);
@@ -399,7 +407,8 @@  static inline unsigned int get_bits(GetBitContext *s, int n)
 #endif
 #else
     OPEN_READER(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_UBITS(re, s, n);
     LAST_SKIP_BITS(re, s, n);
@@ -420,7 +429,8 @@  static av_always_inline int get_bitsz(GetBitContext *s, int n)
 static inline unsigned int get_bits_le(GetBitContext *s, int n)
 {
 #if CACHED_BITSTREAM_READER
-    av_assert2(n>0 && n<=32);
+    av_assert2(n > 0);
+    av_assert2(n <= 32);
     if (n > s->bits_left) {
         refill_32(s, 1);
         if (s->bits_left < 32)
@@ -431,7 +441,8 @@  static inline unsigned int get_bits_le(GetBitContext *s, int n)
 #else
     register int tmp;
     OPEN_READER(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE_LE(re, s);
     tmp = SHOW_UBITS_LE(re, s, n);
     LAST_SKIP_BITS(re, s, n);
@@ -457,7 +468,8 @@  static inline unsigned int show_bits(GetBitContext *s, int n)
     tmp = show_val(s, n);
 #else
     OPEN_READER_NOSIZE(re, s);
-    av_assert2(n>0 && n<=25);
+    av_assert2(n > 0);
+    av_assert2(n <= 25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_UBITS(re, s, n);
 #endif
@@ -545,7 +557,8 @@  static inline void skip_bits1(GetBitContext *s)
  */
 static inline unsigned int get_bits_long(GetBitContext *s, int n)
 {
-    av_assert2(n>=0 && n<=32);
+    av_assert2(n >= 0);
+    av_assert2(n <= 32);
     if (!n) {
         return 0;
 #if CACHED_BITSTREAM_READER
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 6f001f6d47..78ca244e3e 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -316,7 +316,8 @@  static int decode_slice(MpegEncContext *s)
         s->mb_x = 0;
     }
 
-    av_assert1(s->mb_x == 0 && s->mb_y == s->mb_height);
+    av_assert1(s->mb_x == 0);
+    av_assert1(s->mb_y == s->mb_height);
 
     // Detect incorrect padding with wrong stuffing codes used by NEC N-02B
     if (s->codec_id == AV_CODEC_ID_MPEG4         &&
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 24658b3dfa..595f5ca8f3 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -215,7 +215,8 @@  static const char *hevc_nal_type_name[64] = {
 
 static const char *hevc_nal_unit_name(int nal_type)
 {
-    av_assert0(nal_type >= 0 && nal_type < 64);
+    av_assert0(nal_type >= 0);
+    av_assert0(nal_type < 64);
     return hevc_nal_type_name[nal_type];
 }
 
@@ -256,7 +257,8 @@  static const char *h264_nal_type_name[32] = {
 
 static const char *h264_nal_unit_name(int nal_type)
 {
-    av_assert0(nal_type >= 0 && nal_type < 32);
+    av_assert0(nal_type >= 0);
+    av_assert0(nal_type < 32);
     return h264_nal_type_name[nal_type];
 }
 
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index eaf965e43d..226ded637a 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -511,7 +511,8 @@  static H264Picture *find_short(H264Context *h, int frame_num, int *idx)
  */
 static void remove_short_at_index(H264Context *h, int i)
 {
-    assert(i >= 0 && i < h->short_ref_count);
+    assert(i >= 0);
+    assert(i < h->short_ref_count);
     h->short_ref[i] = NULL;
     if (--h->short_ref_count)
         memmove(&h->short_ref[i], &h->short_ref[i + 1],
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 1c9a270fb6..a956447c5c 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -2799,7 +2799,8 @@  int ff_h264_execute_decode_slices(H264Context *h)
     if (h->avctx->hwaccel || context_count < 1)
         return 0;
 
-    av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height);
+    av_assert0(context_count);
+    av_assert0(h->slice_ctx[context_count - 1].mb_y < h->mb_height);
 
     if (context_count == 1) {
 
diff --git a/libavcodec/h264chroma_template.c b/libavcodec/h264chroma_template.c
index a3ca07b518..e5636b3a75 100644
--- a/libavcodec/h264chroma_template.c
+++ b/libavcodec/h264chroma_template.c
@@ -36,7 +36,10 @@  static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst /*align 8*/, uint8_t
     int i;\
     stride >>= sizeof(pixel)-1;\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x < 8);\
+    av_assert2(y < 8);\
+    av_assert2(x >= 0);\
+    av_assert2(y >= 0);\
 \
     if(D){\
         for(i=0; i<h; i++){\
@@ -71,7 +74,10 @@  static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst /*align 8*/, uint8_t
     int i;\
     stride >>= sizeof(pixel)-1;\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x<8);\
+    av_assert2(y<8);\
+    av_assert2(x>=0);\
+    av_assert2(y>=0);\
 \
     if(D){\
         for(i=0; i<h; i++){\
@@ -110,7 +116,10 @@  static void FUNCC(OPNAME ## h264_chroma_mc4)(uint8_t *_dst /*align 8*/, uint8_t
     int i;\
     stride >>= sizeof(pixel)-1;\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x < 8);\
+    av_assert2(y < 8);\
+    av_assert2(x >= 0);\
+    av_assert2(y >= 0);\
 \
     if(D){\
         for(i=0; i<h; i++){\
@@ -155,7 +164,10 @@  static void FUNCC(OPNAME ## h264_chroma_mc8)(uint8_t *_dst /*align 8*/, uint8_t
     int i;\
     stride >>= sizeof(pixel)-1;\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x < 8);\
+    av_assert2(y < 8);\
+    av_assert2(x >= 0);\
+    av_assert2(y >= 0);\
 \
     if(D){\
         for(i=0; i<h; i++){\
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 6b9824088c..681c7aec3d 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -112,8 +112,10 @@  static int get_qPy_pred(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
     else
         qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
 
-    av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
-    av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
+    av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset);
+    av_assert2(qPy_a < 52);
+    av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset);
+    av_assert2(qPy_b < 52);
 
     return (qPy_a + qPy_b + 1) >> 1;
 }
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index e582060cc3..8b797c3432 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -80,7 +80,8 @@  av_cold void ff_huffyuv_common_init(AVCodecContext *avctx)
     s->width = avctx->width;
     s->height = avctx->height;
 
-    av_assert1(s->width > 0 && s->height > 0);
+    av_assert1(s->width > 0);
+    av_assert1(s->height > 0);
 }
 
 av_cold void ff_huffyuv_common_end(HYuvContext *s)
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 3662c173ec..e2fb271bf7 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -165,7 +165,10 @@  static int store_table(HYuvContext *s, const uint8_t *len, uint8_t *buf)
         for (; i < n && len[i] == val && repeat < 255; i++)
             repeat++;
 
-        av_assert0(val < 32 && val >0 && repeat < 256 && repeat>0);
+        av_assert0(val < 32);
+        av_assert0(val > 0);
+        av_assert0(repeat < 256);
+        av_assert0(repeat > 0);
         if (repeat > 7) {
             buf[index++] = val;
             buf[index++] = repeat;
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index ee09f2974c..6117b5f6ab 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -227,7 +227,8 @@  void ff_h263_encode_picture_header(MpegEncContext * s, int picture_number)
     if(s->h263_slice_structured){
         put_bits(&s->pb, 1, 1);
 
-        av_assert1(s->mb_x == 0 && s->mb_y == 0);
+        av_assert1(s->mb_x == 0);
+        av_assert1(s->mb_y == 0);
         ff_h263_encode_mba(s);
 
         put_bits(&s->pb, 1, 1);
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index e9c4b9b831..8db5175d00 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -89,7 +89,9 @@  static int ivi_mc(const IVIBandDesc *band, ivi_mc_func mc, ivi_mc_avg_func mc_av
     int ref_size = (mc_type > 1) * band->pitch + (mc_type & 1);
 
     if (mc_type != -1) {
-        av_assert0(offs >= 0 && ref_offs >= 0 && band->ref_buf);
+        av_assert0(offs >= 0);
+        av_assert0(ref_offs >= 0);
+        av_assert0(band->ref_buf);
         av_assert0(buf_size - min_size >= offs);
         av_assert0(buf_size - min_size - ref_size >= ref_offs);
     }
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 019dc81f56..317653e2dc 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1541,7 +1541,8 @@  static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
     int term_cnt = 0;
     int coder_type;
 
-    av_assert0(width <= 1024U && height <= 1024U);
+    av_assert0(width <= 1024U);
+    av_assert0(height <= 1024U);
     av_assert0(width*height <= 4096);
 
     memset(t1->data, 0, t1->stride * height * sizeof(*t1->data));
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
index 357313df49..85a0e70317 100644
--- a/libavcodec/lclenc.c
+++ b/libavcodec/lclenc.c
@@ -115,7 +115,8 @@  static av_cold int encode_init(AVCodecContext *avctx)
 
     c->avctx= avctx;
 
-    av_assert0(avctx->width && avctx->height);
+    av_assert0(avctx->width);
+    av_assert0(avctx->height);
 
     avctx->extradata = av_mallocz(8 + AV_INPUT_BUFFER_PADDING_SIZE);
     if (!avctx->extradata)
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index f8da1e1266..2a099b176d 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -210,8 +210,9 @@  int ff_lpc_calc_coefs(LPCContext *s,
     int i, j, pass = 0;
     int opt_order;
 
-    av_assert2(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER &&
-           lpc_type > FF_LPC_TYPE_FIXED);
+    av_assert2(max_order >= MIN_LPC_ORDER);
+    av_assert2(max_order <= MAX_LPC_ORDER);
+    av_assert2(lpc_type > FF_LPC_TYPE_FIXED);
     av_assert0(lpc_type == FF_LPC_TYPE_CHOLESKY || lpc_type == FF_LPC_TYPE_LEVINSON);
 
     /* reinit LPC context if parameters have changed */
diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
index 03080ee587..644a99d025 100644
--- a/libavcodec/lzwenc.c
+++ b/libavcodec/lzwenc.c
@@ -77,7 +77,8 @@  static inline int hash(int head, const int add)
     head ^= (add << LZW_HASH_SHIFT);
     if (head >= LZW_HASH_SIZE)
         head -= LZW_HASH_SIZE;
-    av_assert2(head >= 0 && head < LZW_HASH_SIZE);
+    av_assert2(head >= 0);
+    av_assert2(head < LZW_HASH_SIZE);
     return head;
 }
 
@@ -112,7 +113,8 @@  static inline int hashOffset(const int head)
  */
 static inline void writeCode(LZWEncodeState * s, int c)
 {
-    av_assert2(0 <= c && c < 1 << s->bits);
+    av_assert2(0 <= c);
+    av_assert2(c < 1 << s->bits);
     s->put_bits(&s->pb, s->bits, c);
 }
 
@@ -208,7 +210,8 @@  void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize,
     s->maxbits = maxbits;
     init_put_bits(&s->pb, outbuf, outsize);
     s->bufsize = outsize;
-    av_assert0(s->maxbits >= 9 && s->maxbits <= LZW_MAXBITS);
+    av_assert0(s->maxbits >= 9);
+    av_assert0(s->maxbits <= LZW_MAXBITS);
     s->maxcode = 1 << s->maxbits;
     s->output_bytes = 0;
     s->last_code = LZW_PREFIX_EMPTY;
diff --git a/libavcodec/mips/h264chroma_msa.c b/libavcodec/mips/h264chroma_msa.c
index 4c25761194..dd84cc84d2 100644
--- a/libavcodec/mips/h264chroma_msa.c
+++ b/libavcodec/mips/h264chroma_msa.c
@@ -1905,7 +1905,10 @@  static void avg_width8_msa(uint8_t *src, uint8_t *dst, int32_t stride,
 void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src,
                                 ptrdiff_t stride, int height, int x, int y)
 {
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_8w_msa(src, dst, stride, x, (8 - x), y, (8 - y), height);
@@ -1921,7 +1924,10 @@  void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src,
 void ff_put_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src,
                                 ptrdiff_t stride, int height, int x, int y)
 {
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_4w_msa(src, dst, stride, x, (8 - x), y, (8 - y), height);
@@ -1939,7 +1945,10 @@  void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src,
 {
     int32_t cnt;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_2w_msa(src, dst, stride, x, (8 - x), y, (8 - y), height);
@@ -1960,8 +1969,10 @@  void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src,
 void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src,
                                 ptrdiff_t stride, int height, int x, int y)
 {
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
-
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_and_aver_dst_8w_msa(src, dst, stride, x, (8 - x), y,
@@ -1978,7 +1989,10 @@  void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src,
 void ff_avg_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src,
                                 ptrdiff_t stride, int height, int x, int y)
 {
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_and_aver_dst_4w_msa(src, dst, stride, x, (8 - x), y,
@@ -1997,7 +2011,10 @@  void ff_avg_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src,
 {
     int32_t cnt;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     if (x && y) {
         avc_chroma_hv_and_aver_dst_2w_msa(src, dst, stride, x, (8 - x), y,
diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index db314de496..f9f62b824c 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -2252,7 +2252,10 @@  void ff_put_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */,
     DECLARE_VAR_ALL64;
     DECLARE_VAR_ADDRT;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     __asm__ volatile(
         "li         %[tmp0],    0x06                                    \n\t"
@@ -2307,7 +2310,10 @@  void ff_put_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */,
     DECLARE_VAR_LOW32;
     DECLARE_VAR_ADDRT;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     __asm__ volatile(
         "li         %[tmp0],    0x06                                    \n\t"
@@ -2360,7 +2366,10 @@  void ff_avg_no_rnd_vc1_chroma_mc8_mmi(uint8_t *dst /* align 8 */,
     DECLARE_VAR_ALL64;
     DECLARE_VAR_ADDRT;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     __asm__ volatile(
         "li         %[tmp0],    0x06                                    \n\t"
@@ -2418,7 +2427,10 @@  void ff_avg_no_rnd_vc1_chroma_mc4_mmi(uint8_t *dst /* align 8 */,
     DECLARE_VAR_LOW32;
     DECLARE_VAR_ADDRT;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     __asm__ volatile(
         "li         %[tmp0],    0x06                                    \n\t"
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index e82c185433..2469a5193b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1180,7 +1180,8 @@  static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
     point_transform += bits - s->bits;
     mask = ((1 << s->bits) - 1) << point_transform;
 
-    av_assert0(nb_components>=1 && nb_components<=4);
+    av_assert0(nb_components >= 1);
+    av_assert0(nb_components <= 4);
 
     for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
         for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
@@ -1483,7 +1484,9 @@  static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
     int c = s->comp_index[0];
     uint16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]];
 
-    av_assert0(ss>=0 && Ah>=0 && Al>=0);
+    av_assert0(ss >= 0);
+    av_assert0(Ah >= 0);
+    av_assert0(Al >= 0);
     if (se < ss || se > 63) {
         av_log(s->avctx, AV_LOG_ERROR, "SS/SE %d/%d is invalid\n", ss, se);
         return AVERROR_INVALIDDATA;
@@ -1674,8 +1677,8 @@  next_field:
 
     if (s->avctx->hwaccel) {
         int bytes_to_start = get_bits_count(&s->gb) / 8;
-        av_assert0(bytes_to_start >= 0 &&
-                   s->raw_scan_buffer_size >= bytes_to_start);
+        av_assert0(bytes_to_start >= 0);
+        av_assert0(s->raw_scan_buffer_size >= bytes_to_start);
 
         ret = s->avctx->hwaccel->decode_slice(s->avctx,
                                               s->raw_scan_buffer      + bytes_to_start,
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 759eea479d..aa747bd3ef 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -115,7 +115,12 @@  static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, co
     uint8_t * const * const src= c->src[src_index];
     int d;
     //FIXME check chroma 4mv, (no crashes ...)
-        av_assert2(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1));
+
+        av_assert2(x >= c->xmin);
+        av_assert2(hx <= c->xmax<<(qpel+1));
+        av_assert2(y >= c->ymin);
+        av_assert2(hy <= c->ymax<<(qpel+1));
+
         if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){
             const int time_pp= s->pp_time;
             const int time_pb= s->pb_time;
@@ -1436,7 +1441,10 @@  static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
         if(s->mv_type == MV_TYPE_16X16) break;
     }
 
-    av_assert2(xmax <= 15 && ymax <= 15 && xmin >= -16 && ymin >= -16);
+    av_assert2(xmax <= 15);
+    av_assert2(ymax <= 15);
+    av_assert2(xmin >= -16);
+    av_assert2(ymin >= -16);
 
     if(xmax < 0 || xmin >0 || ymax < 0 || ymin > 0){
         s->b_direct_mv_table[mot_xy][0]= 0;
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index 014038e54f..42355e9778 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -143,7 +143,10 @@  static int hpel_motion_search(MpegEncContext * s,
             }
             CHECK_HALF_MV(0, 1, mx  , my)
         }
-        av_assert2(bx >= xmin*2 && bx <= xmax*2 && by >= ymin*2 && by <= ymax*2);
+        av_assert2(bx >= xmin*2);
+        av_assert2(bx <= xmax*2);
+        av_assert2(by >= ymin*2);
+        av_assert2(by <= ymax*2);
     }
 
     *mx_ptr = bx;
@@ -344,7 +347,10 @@  static int qpel_motion_search(MpegEncContext * s,
             CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2)
         }
 
-        av_assert2(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4);
+        av_assert2(bx >= xmin*4);
+        av_assert2(bx <= xmax*4);
+        av_assert2(by >= ymin*4);
+        av_assert2(by <= ymax*4);
 
         *mx_ptr = bx;
         *my_ptr = by;
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index ab6c19c615..d47189a62f 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -193,7 +193,8 @@  int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size,
 */
 
     for (i = 0; i < buf_size; i++) {
-        av_assert1(pc->frame_start_found >= 0 && pc->frame_start_found <= 4);
+        av_assert1(pc->frame_start_found >= 0);
+        av_assert1(pc->frame_start_found <= 4);
         if (pc->frame_start_found & 1) {
             if (state == EXT_START_CODE && (buf[i] & 0xF0) != 0x80)
                 pc->frame_start_found--;
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 2bc5289d63..ab8f9b72fe 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -620,7 +620,8 @@  static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
             sign = 1;
         }
 
-        av_assert2(code > 0 && code <= 16);
+        av_assert2(code > 0);
+        av_assert2(code <= 16);
 
         put_bits(&s->pb,
                  ff_mpeg12_mbMotionVectorTable[code][1],
@@ -864,7 +865,8 @@  static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
                 s->last_mv[0][1][0] = s->last_mv[0][0][0] = motion_x;
                 s->last_mv[0][1][1] = s->last_mv[0][0][1] = motion_y;
             } else {
-                av_assert2(!s->frame_pred_frame_dct && s->mv_type == MV_TYPE_FIELD);
+                av_assert2(!s->frame_pred_frame_dct);
+                av_assert2(s->mv_type == MV_TYPE_FIELD);
 
                 if (cbp) {
                     if (s->dquant) {
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index f6a5992df7..43b38e7349 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -497,7 +497,8 @@  void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
                     s->last_mv[i][1][1] = 0;
             }
 
-            av_assert2(s->dquant >= -2 && s->dquant <= 2);
+            av_assert2(s->dquant >= -2);
+            av_assert2(s->dquant <= 2);
             av_assert2((s->dquant & 1) == 0);
             av_assert2(mb_type >= 0);
 
@@ -561,7 +562,8 @@  void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
                 s->b_count++;
                 s->f_count++;
             } else {
-                av_assert2(mb_type > 0 && mb_type < 4);
+                av_assert2(mb_type > 0);
+                av_assert2(mb_type < 4);
                 if (s->mv_type != MV_TYPE_FIELD) {
                     if (s->mv_dir & MV_DIR_FORWARD) {
                         ff_h263_encode_motion_vector(s,
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 9cce88e263..7d1a8f172f 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1605,7 +1605,8 @@  static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
                 av_log(s->avctx, AV_LOG_ERROR, "invalid new backstep %d\n", i);
             i = FFMIN(BACKSTEP_SIZE, buf_size - HEADER_SIZE);
         }
-        av_assert1(i <= buf_size - HEADER_SIZE && i >= 0);
+        av_assert1(i <= buf_size - HEADER_SIZE);
+        av_assert1(i >= 0);
         memcpy(s->last_buf + s->last_buf_size, s->gb.buffer + buf_size - HEADER_SIZE - i, i);
         s->last_buf_size += i;
     }
diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 93363fe1d2..f08edd213a 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -413,7 +413,8 @@  static void compute_scale_factors(MpegAudioContext *s,
             ff_dlog(NULL, "%2d:%d in=%x %x %d\n",
                     j, i, vmax, s->scale_factor_table[index], index);
             /* store the scale factor */
-            av_assert2(index >=0 && index <= 63);
+            av_assert2(index >=0);
+            av_assert2(index <= 63);
             sf[i] = index;
         }
 
@@ -713,7 +714,8 @@  static void encode_frame(MpegAudioContext *s,
 #endif
                             if (q[m] >= steps)
                                 q[m] = steps - 1;
-                            av_assert2(q[m] >= 0 && q[m] < steps);
+                            av_assert2(q[m] >= 0);
+                            av_assert2(q[m] < steps);
                         }
                         bits = ff_mpa_quant_bits[qindex];
                         if (bits < 0) {
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index 3f94540616..84ccf877ab 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -236,7 +236,8 @@  void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
                     else if (!USES_LIST(mb_type, 0))
                         av_log(avctx, AV_LOG_DEBUG, "<");
                     else {
-                        av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
+                        av_assert2(USES_LIST(mb_type, 0));
+                        av_assert2(USES_LIST(mb_type, 1));
                         av_log(avctx, AV_LOG_DEBUG, "X");
                     }
 
@@ -335,7 +336,8 @@  void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
                     } else if (!USES_LIST(mb_type, 0)) {
                         COLOR(0, 48)
                     } else {
-                        av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
+                        av_assert2(USES_LIST(mb_type, 0));
+                        av_assert2(USES_LIST(mb_type, 1));
                         COLOR(300,48)
                     }
 
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ae3b131229..49df222f94 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1374,7 +1374,8 @@  static int estimate_best_b_count(MpegEncContext *s)
     int best_b_count = -1;
     int ret = 0;
 
-    av_assert0(scale >= 0 && scale <= 3);
+    av_assert0(scale >= 0);
+    av_assert0(scale <= 3);
 
     //emms_c();
     //s->next_picture_ptr->quality;
@@ -1809,7 +1810,8 @@  static int frame_start(MpegEncContext *s)
     }
 
     if (s->dct_error_sum) {
-        av_assert2(s->noise_reduction && s->encoding);
+        av_assert2(s->noise_reduction);
+        av_assert2(s->encoding);
         update_noise_reduction(s);
     }
 
@@ -3642,7 +3644,8 @@  static void set_frame_distances(MpegEncContext * s){
 
     if(s->pict_type==AV_PICTURE_TYPE_B){
         s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
-        av_assert1(s->pb_time > 0 && s->pb_time < s->pp_time);
+        av_assert1(s->pb_time > 0);
+        av_assert1(s->pb_time < s->pp_time);
     }else{
         s->pp_time= s->time - s->last_non_b_time;
         s->last_non_b_time= s->time;
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
index f06583768c..f4484152a6 100644
--- a/libavcodec/mpegvideo_xvmc.c
+++ b/libavcodec/mpegvideo_xvmc.c
@@ -43,7 +43,8 @@ 
 void ff_xvmc_init_block(MpegEncContext *s)
 {
     struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
-    assert(render && render->xvmc_id == AV_XVMC_ID);
+    assert(render);
+    assert(render->xvmc_id == AV_XVMC_ID);
 
     s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
 }
diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c
index a34ab3553e..f0e5fa78c8 100644
--- a/libavcodec/mpegvideoencdsp.c
+++ b/libavcodec/mpegvideoencdsp.c
@@ -40,7 +40,8 @@  static int try_8x8basis_c(int16_t rem[64], int16_t weight[64],
                           (BASIS_SHIFT - RECON_SHIFT));
         int w = weight[i];
         b >>= RECON_SHIFT;
-        av_assert2(-512 < b && b < 512);
+        av_assert2(-512 < b);
+        av_assert2(b < 512);
 
         sum += (w * b) * (w * b) >> 4;
     }
diff --git a/libavcodec/mqcenc.c b/libavcodec/mqcenc.c
index 7c9e1a0df9..72f71ddc20 100644
--- a/libavcodec/mqcenc.c
+++ b/libavcodec/mqcenc.c
@@ -130,7 +130,8 @@  int ff_mqc_flush_to(MqcState *mqc, uint8_t *dst, int *dst_len)
     if (mqc->bp < mqc->bpstart) {
         av_assert1(mqc->bpstart - mqc->bp == 1);
         av_assert1(*dst_len > 0);
-        av_assert1(mqc->bp[0] == 0 && dst[0] == 0);
+        av_assert1(mqc->bp[0] == 0);
+        av_assert1(dst[0] == 0);
         (*dst_len) --;
         memmove(dst, dst+1, *dst_len);
         return mqc->bp - mqc->bpstart + 1 + *dst_len;
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 1ceb1cc766..8067683d07 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -166,7 +166,8 @@  static inline void put_bits(PutBitContext *s, int n, unsigned int value)
     unsigned int bit_buf;
     int bit_left;
 
-    av_assert2(n <= 31 && value < (1U << n));
+    av_assert2(n <= 31);
+    av_assert2(value < (1U << n));
 
     bit_buf  = s->bit_buf;
     bit_left = s->bit_left;
@@ -214,7 +215,8 @@  static inline void put_bits_le(PutBitContext *s, int n, unsigned int value)
     unsigned int bit_buf;
     int bit_left;
 
-    av_assert2(n <= 31 && value < (1U << n));
+    av_assert2(n <= 31);
+    av_assert2(value < (1U << n));
 
     bit_buf  = s->bit_buf;
     bit_left = s->bit_left;
@@ -239,7 +241,8 @@  static inline void put_bits_le(PutBitContext *s, int n, unsigned int value)
 
 static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
 {
-    av_assert2(n >= 0 && n <= 31);
+    av_assert2(n >= 0);
+    av_assert2(n <= 31);
 
     put_bits(pb, n, av_mod_uintp2(value, n));
 }
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index d171e6e1bd..b752da80b5 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1815,7 +1815,8 @@  int ff_rv34_decode_frame(AVCodecContext *avctx,
             }else
                 r->si.end = si.start;
         }
-        av_assert0 (size >= 0 && size <= buf_size - offset);
+        av_assert0 (size >= 0);
+        av_assert0 (size <= buf_size - offset);
         last = rv34_decode_slice(r, r->si.end, buf + offset, size);
         if(last)
             break;
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 5579bd9bed..dd5bfe7ff0 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -303,7 +303,10 @@  static void OPNAME ## rv40_chroma_mc4_c(uint8_t *dst /*align 8*/,\
     int i;\
     int bias = rv40_bias[y>>1][x>>1];\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x < 8);\
+    av_assert2(y < 8);\
+    av_assert2(x >= 0);\
+    av_assert2(y >= 0);\
 \
     if(D){\
         for(i = 0; i < h; i++){\
@@ -339,7 +342,10 @@  static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/,\
     int i;\
     int bias = rv40_bias[y>>1][x>>1];\
     \
-    av_assert2(x<8 && y<8 && x>=0 && y>=0);\
+    av_assert2(x < 8);\
+    av_assert2(y < 8);\
+    av_assert2(x >= 0);\
+    av_assert2(y >= 0);\
 \
     if(D){\
         for(i = 0; i < h; i++){\
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 811fd2188e..1060227af4 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -841,7 +841,8 @@  static int process_block(SANMVideoContext *ctx, uint8_t *dst, uint8_t *prev1,
         int my = motion_vectors[code][1];
         int index = prev2 - (const uint8_t *)ctx->frm2;
 
-        av_assert2(index >= 0 && index < (ctx->buf_size >> 1));
+        av_assert2(index >= 0);
+        av_assert2(index < (ctx->buf_size >> 1));
 
         if (index < -mx - my * stride ||
             (ctx->buf_size >> 1) - index < mx + size + (my + size - 1) * stride) {
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index dc52234ed0..90e87ea2b4 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -74,7 +74,8 @@  av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) {
 }
 
 av_cold void AAC_RENAME(ff_init_ff_sine_windows)(int index) {
-    assert(index >= 0 && index < FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
+    assert(index >= 0);
+    assert(index < FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
 #if !CONFIG_HARDCODED_TABLES
     AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_windows)[index], 1 << index);
 #endif
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index a3e6afc86a..742f829873 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -175,7 +175,8 @@  static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
     int16_t *tmpI= tmpIt;
     uint8_t *tmp2= tmp2t[0];
     const uint8_t *hpel[11];
-    av_assert2(dx<16 && dy<16);
+    av_assert2(dx < 16);
+    av_assert2(dy < 16);
     r= brane[dx + 16*dy]&15;
     l= brane[dx + 16*dy]>>4;
 
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 41a3bef4de..32c3e97124 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -681,7 +681,8 @@  static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
                     else  max_run= FFMIN(run, w-x-1);
                     if(parent_xc)
                         max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);
-                    av_assert2(max_run >= 0 && max_run <= run);
+                    av_assert2(max_run >= 0);
+                    av_assert2(max_run <= run);
 
                     x+= max_run;
                     run-= max_run;
diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c
index 25681e7edd..5ead72781d 100644
--- a/libavcodec/snow_dwt.c
+++ b/libavcodec/snow_dwt.c
@@ -79,7 +79,8 @@  void ff_slice_buffer_release(slice_buffer *buf, int line)
 {
     IDWTELEM *buffer;
 
-    av_assert1(line >= 0 && line < buf->line_count);
+    av_assert1(line >= 0);
+    av_assert1(line < buf->line_count);
     av_assert1(buf->line[line]);
 
     buffer = buf->line[line];
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index df1729a083..2d8b1ae238 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -408,8 +408,10 @@  static int encode_q_branch(SnowContext *s, int level, int x, int y){
 
     av_assert1(iscore < 255*255*256 + s->lambda2*10);
     av_assert1(iscore >= 0);
-    av_assert1(l>=0 && l<=255);
-    av_assert1(pl>=0 && pl<=255);
+    av_assert1(l >= 0);
+    av_assert1(l <= 255);
+    av_assert1(pl >= 0);
+    av_assert1(pl <= 255);
 
     if(level==0){
         int varc= iscore >> 8;
@@ -908,8 +910,9 @@  static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int
     unsigned value;
     int rd, index;
 
-    av_assert2(mb_x>=0 && mb_y>=0);
-    av_assert2(mb_x<b_stride);
+    av_assert2(mb_x >= 0);
+    av_assert2(mb_y >= 0);
+    av_assert2(mb_x < b_stride);
 
     if(intra){
         block->color[0] = p[0];
@@ -962,7 +965,8 @@  static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_
     backup[2] = block[b_stride];
     backup[3] = block[b_stride + 1];
 
-    av_assert2(mb_x>=0 && mb_y>=0);
+    av_assert2(mb_x >= 0);
+    av_assert2(mb_y >= 0);
     av_assert2(mb_x<b_stride);
     av_assert2(((mb_x|mb_y)&1) == 0);
 
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 80a8af1ef7..ce705f015a 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -155,7 +155,8 @@  static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref,
                 score  = sqr - (diff * (int64_t)diff >> (level + 3)); // FIXME: 64 bits slooow
                 if (score < best_vector_score) {
                     int mean = diff + (size >> 1) >> (level + 3);
-                    av_assert2(mean > -300 && mean < 300);
+                    av_assert2(mean > -300);
+                    av_assert2(mean < 300);
                     mean               = av_clip(mean, intra ? 0 : -256, 255);
                     best_vector_score  = score;
                     best_vector[stage] = i;
@@ -208,8 +209,10 @@  static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref,
 
     if (!split) {
         av_assert1(best_mean >= 0 && best_mean < 256 || !intra);
-        av_assert1(best_mean >= -256 && best_mean < 256);
-        av_assert1(best_count >= 0 && best_count < 7);
+        av_assert1(best_mean >= -256);
+        av_assert1(best_mean < 256);
+        av_assert1(best_count >= 0);
+        av_assert1(best_count < 7);
         av_assert1(level < 4 || best_count == 0);
 
         /* output the encoding */
@@ -220,7 +223,8 @@  static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref,
                  mean_vlc[best_mean][0]);
 
         for (i = 0; i < best_count; i++) {
-            av_assert2(best_vector[i] >= 0 && best_vector[i] < 16);
+            av_assert2(best_vector[i] >= 0);
+            av_assert2(best_vector[i] < 16);
             put_bits(&s->reorder_pb[level], 4, best_vector[i]);
         }
 
@@ -419,10 +423,14 @@  static int svq1_encode_plane(SVQ1EncContext *s, int plane,
                     s->m.pb = s->reorder_pb[5];
                     mx      = motion_ptr[0];
                     my      = motion_ptr[1];
-                    av_assert1(mx     >= -32 && mx     <= 31);
-                    av_assert1(my     >= -32 && my     <= 31);
-                    av_assert1(pred_x >= -32 && pred_x <= 31);
-                    av_assert1(pred_y >= -32 && pred_y <= 31);
+                    av_assert1(mx     >= -32);
+                    av_assert1(mx     <= 31);
+                    av_assert1(my     >= -32);
+                    av_assert1(my     <= 31);
+                    av_assert1(pred_x >= -32);
+                    av_assert1(pred_x <= 31);
+                    av_assert1(pred_y >= -32);
+                    av_assert1(pred_y <= 31);
                     ff_h263_encode_motion(&s->m.pb, mx - pred_x, 1);
                     ff_h263_encode_motion(&s->m.pb, my - pred_y, 1);
                     s->reorder_pb[5] = s->m.pb;
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 2dda451882..79fbfa4c8c 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -688,7 +688,10 @@  static void vaapi_encode_set_b_pictures(AVCodecContext *avctx,
     VAAPIEncodePicture *pic, *next, *ref;
     int i, len;
 
-    av_assert0(start && end && start != end && start->next != end);
+    av_assert0(start);
+    av_assert0(end);
+    av_assert0(start != end);
+    av_assert0(start->next != end);
 
     // If we are at the maximum depth then encode all pictures as
     // non-referenced B-pictures.  Also do this if there is exactly one
@@ -899,7 +902,8 @@  static int vaapi_encode_clear_old(AVCodecContext *avctx)
     for (pic = ctx->pic_start; pic; pic = next) {
         next = pic->next;
         if (pic->encode_complete && pic->ref_count[1] == 0) {
-            av_assert0(pic->ref_removed[0] && pic->ref_removed[1]);
+            av_assert0(pic->ref_removed[0]);
+            av_assert0(pic->ref_removed[1]);
             if (prev)
                 prev->next = next;
             else
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 4cf99d7c78..27404f1e2c 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -712,7 +712,8 @@  static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
         VAAPIEncodePicture      *ref = pic->refs[i];
         VAAPIEncodeH264Picture *href;
 
-        av_assert0(ref && ref->encode_order < pic->encode_order);
+        av_assert0(ref);
+        av_assert0(ref->encode_order < pic->encode_order);
         href = ref->priv_data;
 
         vpic->ReferenceFrames[i] = (VAPictureH264) {
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 758bd40a37..624815e87b 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -703,7 +703,8 @@  static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
             hpic->pic_type       = 1;
         } else {
             VAAPIEncodePicture *irap_ref;
-            av_assert0(pic->refs[0] && pic->refs[1]);
+            av_assert0(pic->refs[0]);
+            av_assert0(pic->refs[1]);
             for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1]) {
                 if (irap_ref->type == PICTURE_TYPE_I)
                     break;
@@ -817,7 +818,8 @@  static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
         VAAPIEncodePicture      *ref = pic->refs[i];
         VAAPIEncodeH265Picture *href;
 
-        av_assert0(ref && ref->encode_order < pic->encode_order);
+        av_assert0(ref);
+        av_assert0(ref->encode_order < pic->encode_order);
         href = ref->priv_data;
 
         vpic->reference_frames[i] = (VAPictureHEVC) {
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index f89fd0d07a..c4f5c50ffa 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -116,8 +116,8 @@  static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx,
         {
             VAAPIEncodeVP9Picture *href0 = pic->refs[0]->priv_data,
                                   *href1 = pic->refs[1]->priv_data;
-            av_assert0(href0->slot < pic->b_depth + 1 &&
-                       href1->slot < pic->b_depth + 1);
+            av_assert0(href0->slot < pic->b_depth + 1);
+            av_assert0(href1->slot < pic->b_depth + 1);
 
             if (pic->b_depth == ctx->max_b_depth) {
                 // Unreferenced frame.
diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index 9e29b44a1f..8a123c87a2 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -658,7 +658,8 @@  void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y,
                     px = A[0];
                     py = A[1];
                 } else /*if (field_b && b_valid)*/ {
-                    av_assert1(field_b && b_valid);
+                    av_assert1(field_b);
+                    av_assert1(b_valid);
                     px = B[0];
                     py = B[1];
                 }
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index 778b811f1a..11285df7e0 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -793,7 +793,10 @@  static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
     const int D =     (x) *     (y);
     int i;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     for (i = 0; i < h; i++) {
         dst[0] = chroma_mc(0);
@@ -818,7 +821,10 @@  static void put_no_rnd_vc1_chroma_mc4_c(uint8_t *dst, uint8_t *src,
     const int D =     (x) *     (y);
     int i;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     for (i = 0; i < h; i++) {
         dst[0] = chroma_mc(0);
@@ -841,7 +847,10 @@  static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
     const int D =     (x) *     (y);
     int i;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     for (i = 0; i < h; i++) {
         dst[0] = avg2(dst[0], chroma_mc(0));
@@ -867,7 +876,10 @@  static void avg_no_rnd_vc1_chroma_mc4_c(uint8_t *dst /* align 8 */,
     const int D = (    x) * (    y);
     int i;
 
-    av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
+    av_assert2(x < 8);
+    av_assert2(y < 8);
+    av_assert2(x >= 0);
+    av_assert2(y >= 0);
 
     for (i = 0; i < h; i++) {
         dst[0] = avg2(dst[0], chroma_mc(0));
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index 94c1b7188d..4e6ab43f09 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -55,8 +55,10 @@  void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
     start_x = FFMAX(0, -src_x);
     end_y = FFMIN(block_h, h-src_y);
     end_x = FFMIN(block_w, w-src_x);
-    av_assert2(start_y < end_y && block_h);
-    av_assert2(start_x < end_x && block_w);
+    av_assert2(start_y < end_y);
+    av_assert2(block_h);
+    av_assert2(start_x < end_x);
+    av_assert2(block_w);
 
     w    = end_x - start_x;
     src += start_y * src_linesize + start_x * sizeof(pixel);
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index acf3ffc9e7..a4f410d492 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -180,7 +180,8 @@  static int update_size(AVCodecContext *avctx, int w, int h)
     int bytesperpixel = s->bytesperpixel, ret, cols, rows;
     int lflvl_len, i;
 
-    av_assert0(w > 0 && h > 0);
+    av_assert0(w > 0);
+    av_assert0(h > 0);
 
     if (!(s->pix_fmt == s->gf_fmt && w == s->w && h == s->h)) {
         if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 49bb04e1f4..d8068855ad 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -91,7 +91,8 @@  static av_always_inline int check_intra_mode(VP9TileData *td, int mode, uint8_t
         [DC_129_PRED]          = { 0 }
     };
 
-    av_assert2(mode >= 0 && mode < 10);
+    av_assert2(mode >= 0);
+    av_assert2(mode < 10);
     mode = mode_conv[mode][have_left][have_top];
     if (edges[mode].needs_top) {
         uint8_t *top, *topleft;
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 091bc2ac3b..18a573a6d0 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -162,7 +162,8 @@  static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param)
     q_end = q + s->block_len;
     if (s->version == 1) {
         last_exp = *exp_param++;
-        av_assert0(last_exp - 10 >= 0 && last_exp - 10 < 32);
+        av_assert0(last_exp - 10 >= 0);
+        av_assert0(last_exp - 10 < 32);
         put_bits(&s->pb, 5, last_exp - 10);
         q += *ptr++;
     } else
@@ -170,7 +171,8 @@  static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param)
     while (q < q_end) {
         int exp  = *exp_param++;
         int code = exp - last_exp + 60;
-        av_assert1(code >= 0 && code < 120);
+        av_assert1(code >= 0);
+        av_assert1(code < 120);
         put_bits(&s->pb, ff_aac_scalefactor_bits[code],
                  ff_aac_scalefactor_code[code]);
         /* XXX: use a table */
diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c
index eeebb41547..6106592106 100644
--- a/libavcodec/x86/videodsp_init.c
+++ b/libavcodec/x86/videodsp_init.c
@@ -185,8 +185,10 @@  static av_always_inline void emulated_edge_mc(uint8_t *dst, const uint8_t *src,
     start_x = FFMAX(0, -src_x);
     end_y   = FFMIN(block_h, h-src_y);
     end_x   = FFMIN(block_w, w-src_x);
-    av_assert2(start_x < end_x && block_w > 0);
-    av_assert2(start_y < end_y && block_h > 0);
+    av_assert2(start_x < end_x);
+    av_assert2(block_w > 0);
+    av_assert2(start_y < end_y);
+    av_assert2(block_h > 0);
 
     // fill in the to-be-copied part plus all above/below
     src += (src_y_add + start_y) * src_stride + start_x;
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 72e1b67887..88d99d20af 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -144,7 +144,8 @@  int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatConte
                                  AVDictionary **device_options)
 {
     int ret;
-    av_assert0(s && caps);
+    av_assert0(s);
+    av_assert0(caps);
     av_assert0(s->iformat || s->oformat);
     if ((s->oformat && !s->oformat->create_device_capabilities) ||
         (s->iformat && !s->iformat->create_device_capabilities))
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index fd0bb177d9..26e5534738 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -997,7 +997,8 @@  static av_cold int opengl_init_context(OpenGLContext *opengl)
         goto fail;
 
     desc = av_pix_fmt_desc_get(opengl->pix_fmt);
-    av_assert0(desc->nb_components > 0 && desc->nb_components <= 4);
+    av_assert0(desc->nb_components > 0);
+    av_assert0(desc->nb_components <= 4);
     glGenTextures(desc->nb_components, opengl->texture_name);
 
     opengl->glprocs.glGenBuffers(2, &opengl->index_buffer);
diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 688dac5464..1cf48f2d0a 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -802,9 +802,9 @@  static int yae_overlap_add(ATempoContext *atempo,
 
     uint8_t *dst = *dst_ref;
 
-    av_assert0(start_here <= stop_here &&
-               frag->position[1] <= start_here &&
-               overlap <= frag->nsamples);
+    av_assert0(start_here <= stop_here);
+    av_assert0(frag->position[1] <= start_here);
+    av_assert0(overlap <= frag->nsamples);
 
     if (atempo->format == AV_SAMPLE_FMT_U8) {
         yae_blend(uint8_t);
@@ -973,7 +973,8 @@  static int yae_flush(ATempoContext *atempo,
     start_here = FFMAX(atempo->position[1], overlap_end);
     stop_here  = frag->position[1] + frag->nsamples;
     offset     = start_here - frag->position[1];
-    av_assert0(start_here <= stop_here && frag->position[1] <= start_here);
+    av_assert0(start_here <= stop_here);
+    av_assert0(frag->position[1] <= start_here);
 
     src = frag->data + offset * atempo->stride;
     dst = (uint8_t *)*dst_ref;
diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c
index fd430884d7..b6388a8c34 100644
--- a/libavfilter/af_dynaudnorm.c
+++ b/libavfilter/af_dynaudnorm.c
@@ -492,7 +492,8 @@  static void update_gain_history(DynamicAudioNormalizerContext *s, int channel,
 
 static inline double update_value(double new, double old, double aggressiveness)
 {
-    av_assert0((aggressiveness >= 0.0) && (aggressiveness <= 1.0));
+    av_assert0(aggressiveness >= 0.0);
+    av_assert0(aggressiveness <= 1.0);
     return aggressiveness * new + (1.0 - aggressiveness) * old;
 }
 
diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index 5a4eca7755..070e814f6d 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -336,8 +336,12 @@  static void stereo_transform(float *x, float *y, float angle)
 
 static void stereo_position(float a, float p, float *x, float *y)
 {
-    av_assert2(a >= -1.f && a <= 1.f);
-    av_assert2(p >= 0.f && p <= M_PI);
+    av_assert2(a >= -1.f);
+    av_assert2(a <= 1.f);
+
+    av_assert2(p >= 0.f);
+    av_assert2(p <= M_PI);
+
     *x = av_clipf(a+a*FFMAX(0, p*p-M_PI_2), -1, 1);
     *y = av_clipf(cosf(a*M_PI_2+M_PI)*cosf(M_PI_2-p/M_PI)*M_LN10+1, -1, 1);
 }
diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c
index 0135eb9023..8f7dac5651 100644
--- a/libavfilter/asrc_sinc.c
+++ b/libavfilter/asrc_sinc.c
@@ -119,7 +119,8 @@  static float *make_lpf(int num_taps, float Fc, float beta, float rho,
     float *h = av_calloc(num_taps, sizeof(*h)), sum = 0;
     float mult = scale / bessel_I_0(beta), mult1 = 1.f / (.5f * m + rho);
 
-    av_assert0(Fc >= 0 && Fc <= 1);
+    av_assert0(Fc >= 0);
+    av_assert0(Fc <= 1);
 
     for (i = 0; i <= m / 2; i++) {
         float z = i - .5f * m, x = z * M_PI, y = z * mult1;
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 93e866b79c..2a7ecd8020 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -164,7 +164,8 @@  int avfilter_link(AVFilterContext *src, unsigned srcpad,
     link->srcpad  = &src->output_pads[srcpad];
     link->dstpad  = &dst->input_pads[dstpad];
     link->type    = src->output_pads[srcpad].type;
-    av_assert0(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
+    av_assert0(AV_PIX_FMT_NONE == -1);
+    av_assert0(AV_SAMPLE_FMT_NONE == -1);
     link->format  = -1;
     ff_framequeue_init(&link->fifo, &src->graph->internal->frame_queues);
 
diff --git a/libavfilter/colorspacedsp_template.c b/libavfilter/colorspacedsp_template.c
index 53ac0d7224..af49a2a439 100644
--- a/libavfilter/colorspacedsp_template.c
+++ b/libavfilter/colorspacedsp_template.c
@@ -70,7 +70,8 @@  static void fn(yuv2rgb)(int16_t *rgb[3], ptrdiff_t rgb_stride,
 
     av_assert2(yuv2rgb_coeffs[0][1][0] == 0);
     av_assert2(yuv2rgb_coeffs[2][2][0] == 0);
-    av_assert2(yuv2rgb_coeffs[1][0][0] == cy && yuv2rgb_coeffs[2][0][0] == cy);
+    av_assert2(yuv2rgb_coeffs[1][0][0] == cy);
+    av_assert2(yuv2rgb_coeffs[2][0][0] == cy);
 
     w = AV_CEIL_RSHIFT(w, SS_W);
     h = AV_CEIL_RSHIFT(h, SS_H);
diff --git a/libavfilter/transform.c b/libavfilter/transform.c
index f92fc4d42f..b02676f900 100644
--- a/libavfilter/transform.c
+++ b/libavfilter/transform.c
@@ -179,8 +179,10 @@  int avfilter_transform(const uint8_t *src, uint8_t *dst,
                     x_s = avpriv_mirror(x_s,  width-1);
                     y_s = avpriv_mirror(y_s, height-1);
 
-                    av_assert2(x_s >= 0 && y_s >= 0);
-                    av_assert2(x_s < width && y_s < height);
+                    av_assert2(x_s >= 0);
+                    av_assert2(y_s >= 0);
+                    av_assert2(x_s < width);
+                    av_assert2(y_s < height);
                     def = src[(int)y_s * src_stride + (int)x_s];
             }
 
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 883cc1c90c..b659e0ae29 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -311,8 +311,11 @@  static inline int interpolate(void *log_ctx, uint16_t *y,
         const int x_start = point->x       * scale;
         const int x_end   = point->next->x * scale;
 
-        av_assert0(x_start >= 0 && x_start < lut_size &&
-                   x_end   >= 0 && x_end   < lut_size);
+        av_assert0(x_start >= 0);
+        av_assert0(x_start < lut_size);
+
+        av_assert0(x_end   >= 0);
+        av_assert0(x_end   < lut_size);
 
         for (x = x_start; x <= x_end; x++) {
             const double xx = (x - x_start) * 1./scale;
diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index 5a73eb43b8..6b01e0928e 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -696,7 +696,9 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             prv = src;                                          \
         if (!prv) /* received only one frame at that point */   \
             return 0;                                           \
-        av_assert0(prv && src && nxt);                          \
+        av_assert0(prv);                                        \
+        av_assert0(src);                                        \
+        av_assert0(nxt);                                        \
 } while (0)
     if (FF_INLINK_IDX(inlink) == INPUT_MAIN) {
         av_assert0(fm->got_frame[INPUT_MAIN] == 0);
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index a525039baa..dfe228e328 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -991,7 +991,8 @@  static int config_clut(AVFilterLink *inlink)
         av_log(ctx, AV_LOG_WARNING, "The Hald CLUT width does not match the level\n");
         return AVERROR_INVALIDDATA;
     }
-    av_assert0(w == h && w == size);
+    av_assert0(w == h);
+    av_assert0(w == size);
     level *= level;
     if (level > MAX_LEVEL) {
         const int max_clut_level = sqrt(MAX_LEVEL);
diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index 4b4f91be5d..dc069b6f6e 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -86,7 +86,8 @@  static av_cold int init(AVFilterContext *ctx)
         s->nb_inputs = FFMAX(s->nb_inputs, s->map[i][1] + 1);
     }
 
-    av_assert0(s->nb_inputs && s->nb_inputs <= 4);
+    av_assert0(s->nb_inputs);
+    av_assert0(s->nb_inputs <= 4);
 
     for (i = 0; i < s->nb_inputs; i++) {
         AVFilterPad pad = { 0 };
diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c
index dcb5a03953..ef38c596e5 100644
--- a/libavfilter/vf_nlmeans.c
+++ b/libavfilter/vf_nlmeans.c
@@ -113,7 +113,9 @@  static void compute_safe_ssd_integral_image_c(uint32_t *dst, ptrdiff_t dst_lines
     const uint32_t *dst_top = dst - dst_linesize_32;
 
     /* SIMD-friendly assumptions allowed here */
-    av_assert2(!(w & 0xf) && w >= 16 && h >= 1);
+    av_assert2(!(w & 0xf));
+    av_assert2(w >= 16);
+    av_assert2(h >= 1);
 
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x += 4) {
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index f06714807f..d226531faf 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -301,7 +301,8 @@  static void haldclutsrc_fill_picture(AVFilterContext *ctx, AVFrame *frame)
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
     uint8_t rgba_map[4];
 
-    av_assert0(w == h && w == level*level*level);
+    av_assert0(w == h);
+    av_assert0(w == level*level*level);
 
     ff_fill_rgba_map(rgba_map, frame->format);
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index dcf1fc3d17..6f07109707 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -444,7 +444,8 @@  int av_frame_ref(AVFrame *dst, const AVFrame *src)
 {
     int i, ret = 0;
 
-    av_assert1(dst->width == 0 && dst->height == 0);
+    av_assert1(dst->width == 0);
+    av_assert1(dst->height == 0);
     av_assert1(dst->channels == 0);
 
     dst->format         = src->format;
@@ -581,7 +582,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
 void av_frame_move_ref(AVFrame *dst, AVFrame *src)
 {
-    av_assert1(dst->width == 0 && dst->height == 0);
+    av_assert1(dst->width == 0);
+    av_assert1(dst->height == 0);
     av_assert1(dst->channels == 0);
 
     *dst = *src;
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 41fdfe96f1..3038186056 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -500,8 +500,8 @@  static int opencl_device_create_internal(AVHWDeviceContext *hwdev,
          *device_name_src   = NULL;
     int err, found, p, d;
 
-    av_assert0(selector->enumerate_platforms &&
-               selector->enumerate_devices);
+    av_assert0(selector->enumerate_platforms);
+    av_assert0(selector->enumerate_devices);
 
     err = selector->enumerate_platforms(hwdev, &nb_platforms, &platforms,
                                         selector->context);
diff --git a/libavutil/integer.c b/libavutil/integer.c
index 78e252fbde..666ccad108 100644
--- a/libavutil/integer.c
+++ b/libavutil/integer.c
@@ -119,7 +119,8 @@  AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){
         return av_sub_i(zero_i, a);
     }
 
-    av_assert2((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b.v[AV_INTEGER_SIZE-1] >= 0);
+    av_assert2((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0);
+    av_assert2((int16_t)b.v[AV_INTEGER_SIZE-1] >= 0);
     av_assert2(av_log2_i(b)>=0);
 
     if(i > 0)
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 1bf044cdf1..d670fce1a7 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -60,7 +60,8 @@  int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
     int64_t r = 0;
     av_assert2(c > 0);
     av_assert2(b >=0);
-    av_assert2((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4);
+    av_assert2((unsigned)(rnd&~AV_ROUND_PASS_MINMAX) <= 5);
+    av_assert2((rnd&~AV_ROUND_PASS_MINMAX) != 4);
 
     if (c <= 0 || b < 0 || !((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4))
         return INT64_MIN;
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index fe38344d73..a653e0d5e3 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2566,13 +2566,18 @@  void ff_check_pixfmt_descriptors(void){
         av_assert0(d->log2_chroma_w <= 3);
         av_assert0(d->log2_chroma_h <= 3);
         av_assert0(d->nb_components <= 4);
-        av_assert0(d->name && d->name[0]);
+        av_assert0(d->name);
+        av_assert0(d->name[0]);
         av_assert2(av_get_pix_fmt(d->name) == i);
 
         for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
             const AVComponentDescriptor *c = &d->comp[j];
             if(j>=d->nb_components) {
-                av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
+                av_assert0(!c->plane);
+                av_assert0(!c->step);
+                av_assert0(!c->offset);
+                av_assert0(!c->shift);
+                av_assert0(!c->depth);
                 continue;
             }
             if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
@@ -2583,7 +2588,8 @@  void ff_check_pixfmt_descriptors(void){
             if (d->flags & AV_PIX_FMT_FLAG_BAYER)
                 continue;
             av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
-            av_assert0(tmp[0] == 0 && tmp[1] == 0);
+            av_assert0(tmp[0] == 0);
+            av_assert0(tmp[1] == 0);
             tmp[0] = tmp[1] = (1<<c->depth) - 1;
             av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
         }
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 35ee08877f..3691b9db4e 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -69,7 +69,8 @@  int av_reduce(int *dst_num, int *dst_den,
         den = next_den;
     }
     av_assert2(av_gcd(a1.num, a1.den) <= 1U);
-    av_assert2(a1.num <= max && a1.den <= max);
+    av_assert2(a1.num <= max);
+    av_assert2(a1.den <= max);
 
     *dst_num = sign ? -a1.num : a1.num;
     *dst_den = a1.den;
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index a651406f74..da1df76ebc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -82,7 +82,8 @@  static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){
         a.exp++;
         a.mant>>=1;
     }
-    av_assert2(a.mant < 0x40000000 && a.mant > -0x40000000);
+    av_assert2(a.mant < 0x40000000);
+    av_assert2(a.mant > -0x40000000);
     av_assert2(a.exp <= MAX_EXP);
     return a;
 #elif 1
diff --git a/libswresample/resample.c b/libswresample/resample.c
index df49505bf9..d816d51e6a 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -390,7 +390,8 @@  static int rebuild_filter_bank_with_compensation(ResampleContext *c)
     if (phase_count == c->phase_count)
         return 0;
 
-    av_assert0(!c->frac && !c->dst_incr_mod);
+    av_assert0(!c->frac);
+    av_assert0(!c->dst_incr_mod);
 
     new_filter_bank = av_calloc(c->filter_alloc, (phase_count + 1) * c->felem_size);
     if (!new_filter_bank)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index be04a236d8..266cfa8d2f 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -202,8 +202,11 @@  static int planarToP01xWrapper(SwsContext *c, const uint8_t *src8[],
         src_format->comp[2].depth - src_format->comp[2].shift,
     };
 
-    av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 ||
-                 dstStride[0] % 2 || dstStride[1] % 2));
+    av_assert0(!(srcStride[0] % 2));
+    av_assert0(!(srcStride[1] % 2));
+    av_assert0(!(srcStride[2] % 2));
+    av_assert0(!(dstStride[0] % 2));
+    av_assert0(!(dstStride[1] % 2));
 
     for (y = 0; y < srcSliceH; y++) {
         uint16_t *tdstY = dstY;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index df68bcc0d9..7c2ab3b637 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1223,7 +1223,8 @@  av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
         return AVERROR(EINVAL);
     }
     }
-    av_assert2(desc_src && desc_dst);
+    av_assert2(desc_src);
+    av_assert2(desc_dst);
 
     i = flags & (SWS_POINT         |
                  SWS_AREA          |
diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 72352dedb3..09be0acb52 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -194,7 +194,8 @@  static int any_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
                         desc->dst->plane[2].line[dp2],
                         desc->alpha ? desc->dst->plane[3].line[dp3] : NULL };
 
-    av_assert1(!c->yuv2packed1 && !c->yuv2packed2);
+    av_assert1(!c->yuv2packed1);
+    av_assert1(!c->yuv2packed2);
     ((yuv2anyX_fn)inst->pfn)(c, lum_filter + sliceY * lum_fsize,
              (const int16_t**)src0, lum_fsize, chr_filter + sliceY * chr_fsize,
              (const int16_t**)src1, (const int16_t**)src2, chr_fsize, (const int16_t**)src3, dst, dstW, sliceY);
diff --git a/tests/checkasm/vf_nlmeans.c b/tests/checkasm/vf_nlmeans.c
index 32c6931a4b..d37fad7dc5 100644
--- a/tests/checkasm/vf_nlmeans.c
+++ b/tests/checkasm/vf_nlmeans.c
@@ -74,7 +74,8 @@  void checkasm_check_nlmeans(void)
                     const int safe_pw = (u_endx_safe - startx_safe) & ~0xf;
                     const int safe_ph = endy_safe - starty_safe;
 
-                    av_assert0(safe_pw && safe_ph);
+                    av_assert0(safe_pw);
+                    av_assert0(safe_ph);
                     av_assert0(startx_safe - s1x >= 0); av_assert0(startx_safe - s1x < w);
                     av_assert0(starty_safe - s1y >= 0); av_assert0(starty_safe - s1y < h);
                     av_assert0(startx_safe - s2x >= 0); av_assert0(startx_safe - s2x < w);
-- 
2.21.0