diff mbox series

[FFmpeg-devel,1/7] avcodec/dxvenc: Don't cast const away

Message ID AS8P250MB0744B4D31626D49493AE03358F7B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 555879ca7cf50f265c4beae365cc5142f3eb660e
Headers show
Series [FFmpeg-devel,1/7] avcodec/dxvenc: Don't cast const away | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 24, 2024, 7:50 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dxvenc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Connor Worley Jan. 24, 2024, 8:49 p.m. UTC | #1
Thanks for fixing this :)
Are you planning more work on the DXV side following this? I have a patch
to follow that replaces `decompress_texture_thread` with purely
texdsp calls (HQ BC4/BC5 textures can be decompressed with
`rgtc1u_gray_block`).

On Wed, Jan 24, 2024 at 11:49 AM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/dxvenc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
> index 3a5b310c9b..10473038cc 100644
> --- a/libavcodec/dxvenc.c
> +++ b/libavcodec/dxvenc.c
> @@ -56,7 +56,7 @@ static void ht_init(HTEntry *ht)
>      }
>  }
>
> -static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
> +static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
>                                      uint32_t key, uint32_t pos)
>  {
>      uint32_t ret = -1;
> @@ -74,7 +74,7 @@ static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC
> *hash_ctx,
>      return ret;
>  }
>
> -static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
> +static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
>                        uint32_t key, uint32_t pos)
>  {
>      HTEntry *removed_entry = NULL;
> @@ -124,7 +124,7 @@ typedef struct DXVEncContext {
>      enum DXVTextureFormat tex_fmt;
>      int (*compress_tex)(AVCodecContext *avctx);
>
> -    AVCRC *crc_ctx;
> +    const AVCRC *crc_ctx;
>
>      HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
>      HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
> @@ -309,7 +309,7 @@ static av_cold int dxv_init(AVCodecContext *avctx)
>          return AVERROR(ENOMEM);
>      }
>
> -    ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
> +    ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
>      if (!ctx->crc_ctx) {
>          av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC table.\n");
>          return AVERROR_BUG;
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Andreas Rheinhardt Jan. 25, 2024, 3:04 a.m. UTC | #2
Connor Worley:
> Thanks for fixing this :)
> Are you planning more work on the DXV side following this? I have a patch
> to follow that replaces `decompress_texture_thread` with purely
> texdsp calls (HQ BC4/BC5 textures can be decompressed with
> `rgtc1u_gray_block`).
> 

I don't intend to work on this after this patchset (which removes
decompress_texture_thread in 2/7).

- Andreas
Andreas Rheinhardt Jan. 26, 2024, 7 p.m. UTC | #3
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/dxvenc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
> index 3a5b310c9b..10473038cc 100644
> --- a/libavcodec/dxvenc.c
> +++ b/libavcodec/dxvenc.c
> @@ -56,7 +56,7 @@ static void ht_init(HTEntry *ht)
>      }
>  }
>  
> -static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
> +static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
>                                      uint32_t key, uint32_t pos)
>  {
>      uint32_t ret = -1;
> @@ -74,7 +74,7 @@ static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
>      return ret;
>  }
>  
> -static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
> +static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
>                        uint32_t key, uint32_t pos)
>  {
>      HTEntry *removed_entry = NULL;
> @@ -124,7 +124,7 @@ typedef struct DXVEncContext {
>      enum DXVTextureFormat tex_fmt;
>      int (*compress_tex)(AVCodecContext *avctx);
>  
> -    AVCRC *crc_ctx;
> +    const AVCRC *crc_ctx;
>  
>      HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
>      HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
> @@ -309,7 +309,7 @@ static av_cold int dxv_init(AVCodecContext *avctx)
>          return AVERROR(ENOMEM);
>      }
>  
> -    ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
> +    ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
>      if (!ctx->crc_ctx) {
>          av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC table.\n");
>          return AVERROR_BUG;

Will apply this patchset tomorrow unless there are objections.

- Andreas
Connor Worley Jan. 26, 2024, 7:15 p.m. UTC | #4
I tested against
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10566, seems happy.

On Fri, Jan 26, 2024 at 10:58 AM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Andreas Rheinhardt:
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> > ---
> >  libavcodec/dxvenc.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
> > index 3a5b310c9b..10473038cc 100644
> > --- a/libavcodec/dxvenc.c
> > +++ b/libavcodec/dxvenc.c
> > @@ -56,7 +56,7 @@ static void ht_init(HTEntry *ht)
> >      }
> >  }
> >
> > -static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
> > +static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
> >                                      uint32_t key, uint32_t pos)
> >  {
> >      uint32_t ret = -1;
> > @@ -74,7 +74,7 @@ static uint32_t ht_lookup_and_upsert(HTEntry *ht,
> AVCRC *hash_ctx,
> >      return ret;
> >  }
> >
> > -static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
> > +static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
> >                        uint32_t key, uint32_t pos)
> >  {
> >      HTEntry *removed_entry = NULL;
> > @@ -124,7 +124,7 @@ typedef struct DXVEncContext {
> >      enum DXVTextureFormat tex_fmt;
> >      int (*compress_tex)(AVCodecContext *avctx);
> >
> > -    AVCRC *crc_ctx;
> > +    const AVCRC *crc_ctx;
> >
> >      HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
> >      HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
> > @@ -309,7 +309,7 @@ static av_cold int dxv_init(AVCodecContext *avctx)
> >          return AVERROR(ENOMEM);
> >      }
> >
> > -    ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
> > +    ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
> >      if (!ctx->crc_ctx) {
> >          av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC
> table.\n");
> >          return AVERROR_BUG;
>
> Will apply this patchset tomorrow unless there are objections.
>
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 3a5b310c9b..10473038cc 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -56,7 +56,7 @@  static void ht_init(HTEntry *ht)
     }
 }
 
-static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
+static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
                                     uint32_t key, uint32_t pos)
 {
     uint32_t ret = -1;
@@ -74,7 +74,7 @@  static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
     return ret;
 }
 
-static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
+static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
                       uint32_t key, uint32_t pos)
 {
     HTEntry *removed_entry = NULL;
@@ -124,7 +124,7 @@  typedef struct DXVEncContext {
     enum DXVTextureFormat tex_fmt;
     int (*compress_tex)(AVCodecContext *avctx);
 
-    AVCRC *crc_ctx;
+    const AVCRC *crc_ctx;
 
     HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
     HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
@@ -309,7 +309,7 @@  static av_cold int dxv_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
-    ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
+    ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
     if (!ctx->crc_ctx) {
         av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC table.\n");
         return AVERROR_BUG;