[FFmpeg-cvslog] avcodec/dxva2(h264|mpeg2|vc1): use av_assert0 instead of assert

Tong Wu git at videolan.org
Fri Jan 5 05:53:46 EET 2024


ffmpeg | branch: master | Tong Wu <tong1.wu-at-intel.com at ffmpeg.org> | Thu Dec 28 11:10:42 2023 +0800| [270cd14bbbd26f3f379dedc2ec6e3146c3f191c2] | committer: Haihao Xiang

avcodec/dxva2(h264|mpeg2|vc1): use av_assert0 instead of assert

Signed-off-by: Tong Wu <tong1.wu at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=270cd14bbbd26f3f379dedc2ec6e3146c3f191c2
---

 libavcodec/dxva2.c       |  4 ++--
 libavcodec/dxva2_h264.c  | 16 ++++++++--------
 libavcodec/dxva2_mpeg2.c |  2 +-
 libavcodec/dxva2_vc1.c   |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index a6ad5e4dc7..ec0d9e7d1c 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -20,10 +20,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <assert.h>
 #include <string.h>
 #include <initguid.h>
 
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/log.h"
 #include "libavutil/time.h"
@@ -1012,7 +1012,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
 
     /* TODO Film Grain when possible */
 
-    assert(buffer_count == 1 + (qm_size > 0) + 2);
+    av_assert0(buffer_count == 1 + (qm_size > 0) + 2);
 
 #if CONFIG_D3D11VA
     if (ff_dxva2_is_d3d11(avctx))
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index e0ec4878a7..0fe4152625 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -44,7 +44,7 @@ struct dxva2_picture_context {
 static void fill_picture_entry(DXVA_PicEntry_H264 *pic,
                                unsigned index, unsigned flag)
 {
-    assert((index&0x7f) == index && (flag&0x01) == flag);
+    av_assert0((index&0x7f) == index && (flag&0x01) == flag);
     pic->bPicEntry = index | (flag << 7);
 }
 
@@ -194,8 +194,8 @@ void ff_dxva2_h264_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext
 
 static int is_slice_short(const AVCodecContext *avctx, AVDXVAContext *ctx)
 {
-    assert(DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) == 1 ||
-           DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) == 2);
+    av_assert0(DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) == 1 ||
+               DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) == 2);
     return DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) == 2;
 }
 
@@ -348,10 +348,10 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
         static const unsigned start_code_size = sizeof(start_code);
         unsigned position, size;
 
-        assert(offsetof(DXVA_Slice_H264_Short, BSNALunitDataLocation) ==
-               offsetof(DXVA_Slice_H264_Long,  BSNALunitDataLocation));
-        assert(offsetof(DXVA_Slice_H264_Short, SliceBytesInBuffer) ==
-               offsetof(DXVA_Slice_H264_Long,  SliceBytesInBuffer));
+        av_assert0(offsetof(DXVA_Slice_H264_Short, BSNALunitDataLocation) ==
+                   offsetof(DXVA_Slice_H264_Long,  BSNALunitDataLocation));
+        av_assert0(offsetof(DXVA_Slice_H264_Short, SliceBytesInBuffer) ==
+                   offsetof(DXVA_Slice_H264_Long,  SliceBytesInBuffer));
 
         if (is_slice_short(avctx, ctx))
             slice = &ctx_pic->slice_short[i];
@@ -453,7 +453,7 @@ static int dxva2_h264_start_frame(AVCodecContext *avctx,
 
     if (!DXVA_CONTEXT_VALID(avctx, ctx))
         return -1;
-    assert(ctx_pic);
+    av_assert0(ctx_pic);
 
     /* Fill up DXVA_PicParams_H264 */
     ff_dxva2_h264_fill_picture_parameters(avctx, ctx, &ctx_pic->pp);
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index 4c9ed1d761..d31a8bb872 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -264,7 +264,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
 
     if (!DXVA_CONTEXT_VALID(avctx, ctx))
         return -1;
-    assert(ctx_pic);
+    av_assert0(ctx_pic);
 
     ff_dxva2_mpeg2_fill_picture_parameters(avctx, ctx, &ctx_pic->pp);
     ff_dxva2_mpeg2_fill_quantization_matrices(avctx, ctx, &ctx_pic->qm);
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index 2b1b3f97ea..f7513b2b15 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -321,7 +321,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx,
 
     if (!DXVA_CONTEXT_VALID(avctx, ctx))
         return -1;
-    assert(ctx_pic);
+    av_assert0(ctx_pic);
 
     ff_dxva2_vc1_fill_picture_parameters(avctx, ctx, &ctx_pic->pp);
 



More information about the ffmpeg-cvslog mailing list