[FFmpeg-devel] [PATCH 03/16] vaapi_vc1: Constify pointers

Mark Thompson sw at jkqxz.net
Sun Jan 8 20:10:07 EET 2017


(cherry picked from commit 01d6f84f49a55fd591aa120960fce2b9dba92d0d)
---
 libavcodec/vaapi_vc1.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 4e82be1ae1..7a9b8d3920 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -39,7 +39,7 @@ static int get_VAMvModeVC1(enum MVModes mv_mode)
 }
 
 /** Check whether the MVTYPEMB bitplane is present */
-static inline int vc1_has_MVTYPEMB_bitplane(VC1Context *v)
+static inline int vc1_has_MVTYPEMB_bitplane(const VC1Context *v)
 {
     if (v->mv_type_is_raw)
         return 0;
@@ -50,7 +50,7 @@ static inline int vc1_has_MVTYPEMB_bitplane(VC1Context *v)
 }
 
 /** Check whether the SKIPMB bitplane is present */
-static inline int vc1_has_SKIPMB_bitplane(VC1Context *v)
+static inline int vc1_has_SKIPMB_bitplane(const VC1Context *v)
 {
     if (v->skip_is_raw)
         return 0;
@@ -59,7 +59,7 @@ static inline int vc1_has_SKIPMB_bitplane(VC1Context *v)
 }
 
 /** Check whether the DIRECTMB bitplane is present */
-static inline int vc1_has_DIRECTMB_bitplane(VC1Context *v)
+static inline int vc1_has_DIRECTMB_bitplane(const VC1Context *v)
 {
     if (v->dmb_is_raw)
         return 0;
@@ -67,7 +67,7 @@ static inline int vc1_has_DIRECTMB_bitplane(VC1Context *v)
 }
 
 /** Check whether the ACPRED bitplane is present */
-static inline int vc1_has_ACPRED_bitplane(VC1Context *v)
+static inline int vc1_has_ACPRED_bitplane(const VC1Context *v)
 {
     if (v->acpred_is_raw)
         return 0;
@@ -77,7 +77,7 @@ static inline int vc1_has_ACPRED_bitplane(VC1Context *v)
 }
 
 /** Check whether the OVERFLAGS bitplane is present */
-static inline int vc1_has_OVERFLAGS_bitplane(VC1Context *v)
+static inline int vc1_has_OVERFLAGS_bitplane(const VC1Context *v)
 {
     if (v->overflg_is_raw)
         return 0;
@@ -89,9 +89,9 @@ static inline int vc1_has_OVERFLAGS_bitplane(VC1Context *v)
 }
 
 /** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */
-static int vc1_get_PTYPE(VC1Context *v)
+static int vc1_get_PTYPE(const VC1Context *v)
 {
-    MpegEncContext * const s = &v->s;
+    const MpegEncContext *s = &v->s;
     switch (s->pict_type) {
     case AV_PICTURE_TYPE_I: return 0;
     case AV_PICTURE_TYPE_P: return v->p_frame_skipped ? 4 : 1;
@@ -101,7 +101,7 @@ static int vc1_get_PTYPE(VC1Context *v)
 }
 
 /** Reconstruct bitstream MVMODE (7.1.1.32) */
-static inline VAMvModeVC1 vc1_get_MVMODE(VC1Context *v)
+static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
 {
     if (v->s.pict_type == AV_PICTURE_TYPE_P ||
         (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type))
@@ -110,7 +110,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE(VC1Context *v)
 }
 
 /** Reconstruct bitstream MVMODE2 (7.1.1.33) */
-static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v)
+static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
 {
     if (v->s.pict_type == AV_PICTURE_TYPE_P && v->mv_mode == MV_PMODE_INTENSITY_COMP)
         return get_VAMvModeVC1(v->mv_mode2);
@@ -118,7 +118,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v)
 }
 
 /** Reconstruct bitstream TTFRM (7.1.1.41, Table-53) */
-static inline int vc1_get_TTFRM(VC1Context *v)
+static inline int vc1_get_TTFRM(const VC1Context *v)
 {
     switch (v->ttfrm) {
     case TT_8X8: return 0;
@@ -146,9 +146,9 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f
 
 static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
 {
-    VC1Context * const v = avctx->priv_data;
-    MpegEncContext * const s = &v->s;
-    FFVAContext * const vactx = ff_vaapi_get_context(avctx);
+    const VC1Context *v = avctx->priv_data;
+    const MpegEncContext *s = &v->s;
+    FFVAContext *vactx = ff_vaapi_get_context(avctx);
     VAPictureParameterBufferVC1 *pic_param;
 
     vactx->slice_param_size = sizeof(VASliceParameterBufferVC1);
@@ -311,9 +311,9 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
 
 static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
 {
-    VC1Context * const v = avctx->priv_data;
-    MpegEncContext * const s = &v->s;
-    FFVAContext * const vactx = ff_vaapi_get_context(avctx);
+    const VC1Context *v = avctx->priv_data;
+    const MpegEncContext *s = &v->s;
+    FFVAContext *vactx = ff_vaapi_get_context(avctx);
     VASliceParameterBufferVC1 *slice_param;
 
     /* Current bit buffer is beyond any marker for VC-1, so skip it */
-- 
2.11.0


More information about the ffmpeg-devel mailing list