Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away
@ 2024-01-24 19:50 Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading Andreas Rheinhardt
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:50 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: 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;
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 3/7] avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func Andreas Rheinhardt
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

The old code set a common struct from each thread;
this only "worked" (but is still UB) because the values
written are the same for each thread.
Fix this by moving the assignments to the main thread.

(This also avoids casting const away from a const AVFrame*.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dxvenc.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 10473038cc..94e522d72b 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -130,25 +130,6 @@ typedef struct DXVEncContext {
     HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
 } DXVEncContext;
 
-static int compress_texture_thread(AVCodecContext *avctx, void *arg,
-                                   int slice, int thread_nb)
-{
-    DXVEncContext *ctx = avctx->priv_data;
-    AVFrame *frame = arg;
-
-    if (ctx->enc.tex_funct) {
-        ctx->enc.tex_data.out = ctx->tex_data;
-        ctx->enc.frame_data.in = frame->data[0];
-        ctx->enc.stride = frame->linesize[0];
-        return ff_texturedsp_compress_thread(avctx, &ctx->enc, slice, thread_nb);
-    } else {
-        /* unimplemented: YCoCg formats */
-        return AVERROR_INVALIDDATA;
-    }
-
-    return 0;
-}
-
 /* Converts an index offset value to a 2-bit opcode and pushes it to a stream.
  * Inverse of CHECKPOINT in dxv.c.  */
 #define PUSH_OP(x)                                                            \
@@ -252,7 +233,15 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
     if (ret < 0)
         return ret;
 
-    avctx->execute2(avctx, compress_texture_thread, (void*)frame, NULL, ctx->enc.slice_count);
+    if (ctx->enc.tex_funct) {
+        ctx->enc.tex_data.out = ctx->tex_data;
+        ctx->enc.frame_data.in = frame->data[0];
+        ctx->enc.stride = frame->linesize[0];
+        avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
+    } else {
+        /* unimplemented: YCoCg formats */
+        return AVERROR_INVALIDDATA;
+    }
 
     bytestream2_init_writer(pbc, pkt->data, pkt->size);
 
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 3/7] avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 4/7] avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack Andreas Rheinhardt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Effectively reverts 50a20de6b9edd1d893fe0ea652ccf796dd9850fb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/texturedspenc.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 7ae28ea134..54cf6fe6e0 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -647,28 +647,11 @@ static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
     return 16;
 }
 
-/**
- * Compress one block of RGBA pixels in a RGTC1U texture and store the
- * resulting bytes in 'dst'. Use the alpha channel of the input image.
- *
- * @param dst    output buffer.
- * @param stride scanline in bytes.
- * @param block  block to compress.
- * @return how much texture data has been written.
- */
-static int rgtc1u_alpha_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
-{
-    compress_alpha(dst, stride, block);
-
-    return 8;
-}
-
 av_cold void ff_texturedspenc_init(TextureDSPContext *c)
 {
     c->dxt1_block         = dxt1_block;
     c->dxt5_block         = dxt5_block;
     c->dxt5ys_block       = dxt5ys_block;
-    c->rgtc1u_alpha_block = rgtc1u_alpha_block;
 }
 
 #define TEXTUREDSP_FUNC_NAME ff_texturedsp_compress_thread
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 4/7] avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 3/7] avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 5/7] avcodec/texturedsp: Add separate TextureDSPEncContext Andreas Rheinhardt
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Only used during init.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dxvenc.c |  6 +++---
 libavcodec/hap.h    |  1 -
 libavcodec/hapdec.c | 15 ++++++++-------
 libavcodec/hapenc.c |  9 +++++----
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 94e522d72b..796f70da02 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -110,7 +110,6 @@ static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
 typedef struct DXVEncContext {
     AVClass *class;
 
-    TextureDSPContext texdsp;
     PutByteContext pbc;
 
     uint8_t *tex_data;   // Compressed texture
@@ -267,6 +266,7 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
 static av_cold int dxv_init(AVCodecContext *avctx)
 {
     DXVEncContext *ctx = avctx->priv_data;
+    TextureDSPContext texdsp;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
     if (ret < 0) {
@@ -275,12 +275,12 @@ static av_cold int dxv_init(AVCodecContext *avctx)
         return ret;
     }
 
-    ff_texturedspenc_init(&ctx->texdsp);
+    ff_texturedspenc_init(&texdsp);
 
     switch (ctx->tex_fmt) {
     case DXV_FMT_DXT1:
         ctx->compress_tex = dxv_compress_dxt1;
-        ctx->enc.tex_funct = ctx->texdsp.dxt1_block;
+        ctx->enc.tex_funct = texdsp.dxt1_block;
         ctx->enc.tex_ratio = 8;
         break;
     default:
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index fb5a4c4123..a888b58fd7 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -61,7 +61,6 @@ typedef struct HapChunk {
 typedef struct HapContext {
     AVClass *class;
 
-    TextureDSPContext dxtc;
     GetByteContext gbc;
 
     enum HapTextureFormat opt_tex_fmt; /* Texture type (encoder only) */
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index fee3c04d84..64e0494370 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -337,6 +337,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
 static av_cold int hap_init(AVCodecContext *avctx)
 {
     HapContext *ctx = avctx->priv_data;
+    TextureDSPContext dxtc;
     const char *texture_name;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
@@ -350,7 +351,7 @@ static av_cold int hap_init(AVCodecContext *avctx)
     avctx->coded_width  = FFALIGN(avctx->width,  TEXTURE_BLOCK_W);
     avctx->coded_height = FFALIGN(avctx->height, TEXTURE_BLOCK_H);
 
-    ff_texturedsp_init(&ctx->dxtc);
+    ff_texturedsp_init(&dxtc);
 
     ctx->texture_count  = 1;
     ctx->dec[0].raw_ratio = 16;
@@ -361,25 +362,25 @@ static av_cold int hap_init(AVCodecContext *avctx)
     case MKTAG('H','a','p','1'):
         texture_name = "DXT1";
         ctx->dec[0].tex_ratio = 8;
-        ctx->dec[0].tex_funct = ctx->dxtc.dxt1_block;
+        ctx->dec[0].tex_funct = dxtc.dxt1_block;
         avctx->pix_fmt = AV_PIX_FMT_RGB0;
         break;
     case MKTAG('H','a','p','5'):
         texture_name = "DXT5";
         ctx->dec[0].tex_ratio = 16;
-        ctx->dec[0].tex_funct = ctx->dxtc.dxt5_block;
+        ctx->dec[0].tex_funct = dxtc.dxt5_block;
         avctx->pix_fmt = AV_PIX_FMT_RGBA;
         break;
     case MKTAG('H','a','p','Y'):
         texture_name = "DXT5-YCoCg-scaled";
         ctx->dec[0].tex_ratio = 16;
-        ctx->dec[0].tex_funct = ctx->dxtc.dxt5ys_block;
+        ctx->dec[0].tex_funct = dxtc.dxt5ys_block;
         avctx->pix_fmt = AV_PIX_FMT_RGB0;
         break;
     case MKTAG('H','a','p','A'):
         texture_name = "RGTC1";
         ctx->dec[0].tex_ratio = 8;
-        ctx->dec[0].tex_funct = ctx->dxtc.rgtc1u_gray_block;
+        ctx->dec[0].tex_funct = dxtc.rgtc1u_gray_block;
         ctx->dec[0].raw_ratio = 4;
         avctx->pix_fmt = AV_PIX_FMT_GRAY8;
         break;
@@ -387,8 +388,8 @@ static av_cold int hap_init(AVCodecContext *avctx)
         texture_name  = "DXT5-YCoCg-scaled / RGTC1";
         ctx->dec[0].tex_ratio = 16;
         ctx->dec[1].tex_ratio = 8;
-        ctx->dec[0].tex_funct = ctx->dxtc.dxt5ys_block;
-        ctx->dec[1].tex_funct = ctx->dxtc.rgtc1u_alpha_block;
+        ctx->dec[0].tex_funct = dxtc.dxt5ys_block;
+        ctx->dec[1].tex_funct = dxtc.rgtc1u_alpha_block;
         ctx->dec[1].raw_ratio = 16;
         ctx->dec[1].slice_count = ctx->dec[0].slice_count;
         avctx->pix_fmt = AV_PIX_FMT_RGBA;
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index 7de7358e3d..2c8bc8e16a 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -232,6 +232,7 @@ static int hap_encode(AVCodecContext *avctx, AVPacket *pkt,
 static av_cold int hap_init(AVCodecContext *avctx)
 {
     HapContext *ctx = avctx->priv_data;
+    TextureDSPContext dxtc;
     int corrected_chunk_count;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
@@ -247,26 +248,26 @@ static av_cold int hap_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    ff_texturedspenc_init(&ctx->dxtc);
+    ff_texturedspenc_init(&dxtc);
 
     switch (ctx->opt_tex_fmt) {
     case HAP_FMT_RGBDXT1:
         ctx->enc.tex_ratio = 8;
         avctx->codec_tag = MKTAG('H', 'a', 'p', '1');
         avctx->bits_per_coded_sample = 24;
-        ctx->enc.tex_funct = ctx->dxtc.dxt1_block;
+        ctx->enc.tex_funct = dxtc.dxt1_block;
         break;
     case HAP_FMT_RGBADXT5:
         ctx->enc.tex_ratio = 16;
         avctx->codec_tag = MKTAG('H', 'a', 'p', '5');
         avctx->bits_per_coded_sample = 32;
-        ctx->enc.tex_funct = ctx->dxtc.dxt5_block;
+        ctx->enc.tex_funct = dxtc.dxt5_block;
         break;
     case HAP_FMT_YCOCGDXT5:
         ctx->enc.tex_ratio = 16;
         avctx->codec_tag = MKTAG('H', 'a', 'p', 'Y');
         avctx->bits_per_coded_sample = 24;
-        ctx->enc.tex_funct = ctx->dxtc.dxt5ys_block;
+        ctx->enc.tex_funct = dxtc.dxt5ys_block;
         break;
     default:
         av_log(avctx, AV_LOG_ERROR, "Invalid format %02X\n", ctx->opt_tex_fmt);
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 5/7] avcodec/texturedsp: Add separate TextureDSPEncContext
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 4/7] avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion Andreas Rheinhardt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

ff_texturedspenc_init() doesn't support most of the function types
supported for decoding; add a separate context containing only pointers
for the actually supported types.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dxvenc.c        | 2 +-
 libavcodec/hapenc.c        | 2 +-
 libavcodec/texturedsp.h    | 8 +++++++-
 libavcodec/texturedspenc.c | 2 +-
 libavcodec/vbnenc.c        | 2 +-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 796f70da02..280a965685 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -266,7 +266,7 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
 static av_cold int dxv_init(AVCodecContext *avctx)
 {
     DXVEncContext *ctx = avctx->priv_data;
-    TextureDSPContext texdsp;
+    TextureDSPEncContext texdsp;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
     if (ret < 0) {
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index 2c8bc8e16a..92cd9c4d31 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -232,7 +232,7 @@ static int hap_encode(AVCodecContext *avctx, AVPacket *pkt,
 static av_cold int hap_init(AVCodecContext *avctx)
 {
     HapContext *ctx = avctx->priv_data;
-    TextureDSPContext dxtc;
+    TextureDSPEncContext dxtc;
     int corrected_chunk_count;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
diff --git a/libavcodec/texturedsp.h b/libavcodec/texturedsp.h
index e15d3c2b02..6de8fda690 100644
--- a/libavcodec/texturedsp.h
+++ b/libavcodec/texturedsp.h
@@ -62,6 +62,12 @@ typedef struct TextureDSPContext {
     int (*dxn3dc_block)      (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
 } TextureDSPContext;
 
+typedef struct TextureDSPEncContext {
+    int (*dxt1_block)        (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+    int (*dxt5_block)        (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+    int (*dxt5ys_block)      (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+} TextureDSPEncContext;
+
 typedef struct TextureDSPThreadContext {
     union {
         const uint8_t *in;       // Input frame data
@@ -81,7 +87,7 @@ typedef struct TextureDSPThreadContext {
 } TextureDSPThreadContext;
 
 void ff_texturedsp_init(TextureDSPContext *c);
-void ff_texturedspenc_init(TextureDSPContext *c);
+void ff_texturedspenc_init(TextureDSPEncContext *c);
 
 int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
 int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 54cf6fe6e0..ffacf96d56 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -647,7 +647,7 @@ static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
     return 16;
 }
 
-av_cold void ff_texturedspenc_init(TextureDSPContext *c)
+av_cold void ff_texturedspenc_init(TextureDSPEncContext *c)
 {
     c->dxt1_block         = dxt1_block;
     c->dxt5_block         = dxt5_block;
diff --git a/libavcodec/vbnenc.c b/libavcodec/vbnenc.c
index 7ce91863d7..01c2482bff 100644
--- a/libavcodec/vbnenc.c
+++ b/libavcodec/vbnenc.c
@@ -36,7 +36,7 @@
 
 typedef struct VBNContext {
     AVClass *class;
-    TextureDSPContext dxtc;
+    TextureDSPEncContext dxtc;
     int format;
     TextureDSPThreadContext enc;
 } VBNContext;
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 5/7] avcodec/texturedsp: Add separate TextureDSPEncContext Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-25 19:27   ` Vittorio Giovara
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 7/7] avcodec/texturedsp: Factor common code out Andreas Rheinhardt
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It presumably exists because HapContext contains an AVClass*.
Yet AVClass is actually defined in log.h and even this inclusion
can be avoided by struct AVClass*. This avoids opt.h inclusions
in hap.c and hapdec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/hap.h               | 5 ++---
 libavcodec/hapqa_extract_bsf.c | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index a888b58fd7..1de6d45428 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -23,10 +23,9 @@
 #ifndef AVCODEC_HAP_H
 #define AVCODEC_HAP_H
 
+#include <stddef.h>
 #include <stdint.h>
 
-#include "libavutil/opt.h"
-
 #include "bytestream.h"
 #include "texturedsp.h"
 
@@ -59,7 +58,7 @@ typedef struct HapChunk {
 } HapChunk;
 
 typedef struct HapContext {
-    AVClass *class;
+    const struct AVClass *class;
 
     GetByteContext gbc;
 
diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c
index 0d9b40aaa6..eac9eafe42 100644
--- a/libavcodec/hapqa_extract_bsf.c
+++ b/libavcodec/hapqa_extract_bsf.c
@@ -30,6 +30,8 @@
 #include "bytestream.h"
 #include "hap.h"
 
+#include "libavutil/opt.h"
+
 typedef struct HapqaExtractContext {
     const AVClass *class;
     int texture;/* index of the texture to keep (0 for rgb or 1 for alpha) */
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH 7/7] avcodec/texturedsp: Factor common code out
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
                   ` (4 preceding siblings ...)
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion Andreas Rheinhardt
@ 2024-01-24 19:52 ` Andreas Rheinhardt
  2024-01-24 20:49 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Connor Worley
  2024-01-26 19:00 ` Andreas Rheinhardt
  7 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-24 19:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Namely calling avctx->execute2(avctx,...).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dds.c                 |  2 +-
 libavcodec/dxvenc.c              |  2 +-
 libavcodec/hapdec.c              |  2 +-
 libavcodec/hapenc.c              |  2 +-
 libavcodec/texturedsp.c          |  2 +-
 libavcodec/texturedsp.h          |  9 +++++----
 libavcodec/texturedsp_template.c | 13 ++++++++++---
 libavcodec/texturedspenc.c       |  2 +-
 libavcodec/vbndec.c              |  2 +-
 libavcodec/vbnenc.c              |  2 +-
 10 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 31a327a579..67e2325a2a 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -636,7 +636,7 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
         ctx->dec.tex_data.in = gbc->buffer;
         ctx->dec.frame_data.out = frame->data[0];
         ctx->dec.stride = frame->linesize[0];
-        avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count);
+        ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec);
     } else if (!ctx->paletted && ctx->bpp == 4 && avctx->pix_fmt == AV_PIX_FMT_PAL8) {
         uint8_t *dst = frame->data[0];
         int x, y, i;
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 280a965685..b274175689 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -236,7 +236,7 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
         ctx->enc.tex_data.out = ctx->tex_data;
         ctx->enc.frame_data.in = frame->data[0];
         ctx->enc.stride = frame->linesize[0];
-        avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
+        ff_texturedsp_exec_compress_threads(avctx, &ctx->enc);
     } else {
         /* unimplemented: YCoCg formats */
         return AVERROR_INVALIDDATA;
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 64e0494370..3a848e9f67 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -323,7 +323,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
 
         ctx->dec[t].frame_data.out = frame->data[0];
         ctx->dec[t].stride = frame->linesize[0];
-        avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec[t], NULL, ctx->dec[t].slice_count);
+        ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec[t]);
     }
 
     /* Frame is ready to be output */
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index 92cd9c4d31..1464f743d6 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -63,7 +63,7 @@ static int compress_texture(AVCodecContext *avctx, uint8_t *out, int out_length,
     ctx->enc.tex_data.out = out;
     ctx->enc.frame_data.in = f->data[0];
     ctx->enc.stride = f->linesize[0];
-    avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
+    ff_texturedsp_exec_compress_threads(avctx, &ctx->enc);
 
     return 0;
 }
diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c
index b8938213ef..5fb79937da 100644
--- a/libavcodec/texturedsp.c
+++ b/libavcodec/texturedsp.c
@@ -653,6 +653,6 @@ av_cold void ff_texturedsp_init(TextureDSPContext *c)
     c->dxn3dc_block       = dxn3dc_block;
 }
 
-#define TEXTUREDSP_FUNC_NAME ff_texturedsp_decompress_thread
+#define TEXTUREDSP_FUNC_NAME ff_texturedsp_exec_decompress_threads
 #define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(a, b, c)
 #include "texturedsp_template.c"
diff --git a/libavcodec/texturedsp.h b/libavcodec/texturedsp.h
index 6de8fda690..86c8eea02d 100644
--- a/libavcodec/texturedsp.h
+++ b/libavcodec/texturedsp.h
@@ -39,8 +39,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "avcodec.h"
-
 #define TEXTURE_BLOCK_W 4
 #define TEXTURE_BLOCK_H 4
 
@@ -89,7 +87,10 @@ typedef struct TextureDSPThreadContext {
 void ff_texturedsp_init(TextureDSPContext *c);
 void ff_texturedspenc_init(TextureDSPEncContext *c);
 
-int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
-int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
+struct AVCodecContext;
+int ff_texturedsp_exec_decompress_threads(struct AVCodecContext *avctx,
+                                          TextureDSPThreadContext *ctx);
+int ff_texturedsp_exec_compress_threads(struct AVCodecContext *avctx,
+                                        TextureDSPThreadContext *ctx);
 
 #endif /* AVCODEC_TEXTUREDSP_H */
diff --git a/libavcodec/texturedsp_template.c b/libavcodec/texturedsp_template.c
index bd193aa97c..9589cc4187 100644
--- a/libavcodec/texturedsp_template.c
+++ b/libavcodec/texturedsp_template.c
@@ -20,10 +20,12 @@
  *
  */
 
-int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, void *arg,
-                         int slice, int thread_nb)
+#include "avcodec.h"
+
+static int exec_func(AVCodecContext *avctx, void *arg,
+                     int slice, int thread_nb)
 {
-    TextureDSPThreadContext *ctx = arg;
+    const TextureDSPThreadContext *ctx = arg;
     uint8_t *d = ctx->tex_data.out;
     int w_block = avctx->coded_width / TEXTURE_BLOCK_W;
     int h_block = avctx->coded_height / TEXTURE_BLOCK_H;
@@ -55,3 +57,8 @@ int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, void *arg,
 
     return 0;
 }
+
+int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, TextureDSPThreadContext *ctx)
+{
+    return avctx->execute2(avctx, exec_func, ctx, NULL, ctx->slice_count);
+}
diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index ffacf96d56..5657a6ef61 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -654,6 +654,6 @@ av_cold void ff_texturedspenc_init(TextureDSPEncContext *c)
     c->dxt5ys_block       = dxt5ys_block;
 }
 
-#define TEXTUREDSP_FUNC_NAME ff_texturedsp_compress_thread
+#define TEXTUREDSP_FUNC_NAME ff_texturedsp_exec_compress_threads
 #define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(c, b, a)
 #include "texturedsp_template.c"
diff --git a/libavcodec/vbndec.c b/libavcodec/vbndec.c
index 02ed43f874..83ce9e994b 100644
--- a/libavcodec/vbndec.c
+++ b/libavcodec/vbndec.c
@@ -162,7 +162,7 @@ static int vbn_decode_frame(AVCodecContext *avctx,
         ctx->dec.raw_ratio = 16;
         ctx->dec.frame_data.out = frame->data[0] + frame->linesize[0] * (frame->height - 1);
         ctx->dec.stride = -frame->linesize[0];
-        avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count);
+        ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec);
     }
 
     *got_frame = 1;
diff --git a/libavcodec/vbnenc.c b/libavcodec/vbnenc.c
index 01c2482bff..abdc33c2c9 100644
--- a/libavcodec/vbnenc.c
+++ b/libavcodec/vbnenc.c
@@ -114,7 +114,7 @@ static int vbn_encode(AVCodecContext *avctx, AVPacket *pkt,
         ctx->enc.frame_data.in = (frame->height - 1) * frame->linesize[0] + frame->data[0];
         ctx->enc.stride = -frame->linesize[0];
         ctx->enc.tex_data.out = pkt->data + VBN_HEADER_SIZE;
-        avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count);
+        ff_texturedsp_exec_compress_threads(avctx, &ctx->enc);
     } else {
         const uint8_t *flipped = frame->data[0] + frame->linesize[0] * (frame->height - 1);
         av_image_copy_plane(pkt->data + VBN_HEADER_SIZE, linesize, flipped, -frame->linesize[0], linesize, frame->height);
-- 
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
                   ` (5 preceding siblings ...)
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 7/7] avcodec/texturedsp: Factor common code out Andreas Rheinhardt
@ 2024-01-24 20:49 ` Connor Worley
  2024-01-25  3:04   ` Andreas Rheinhardt
  2024-01-26 19:00 ` Andreas Rheinhardt
  7 siblings, 1 reply; 13+ messages in thread
From: Connor Worley @ 2024-01-24 20:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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".
>


-- 
Connor Worley
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away
  2024-01-24 20:49 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Connor Worley
@ 2024-01-25  3:04   ` Andreas Rheinhardt
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-25  3:04 UTC (permalink / raw)
  To: ffmpeg-devel

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

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion
  2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion Andreas Rheinhardt
@ 2024-01-25 19:27   ` Vittorio Giovara
  2024-01-26  6:41     ` Andreas Rheinhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Vittorio Giovara @ 2024-01-25 19:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Wed, Jan 24, 2024 at 9:06 PM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> It presumably exists because HapContext contains an AVClass*.
> Yet AVClass is actually defined in log.h and even this inclusion
> can be avoided by struct AVClass*. This avoids opt.h inclusions
> in hap.c and hapdec.c.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/hap.h               | 5 ++---
>  libavcodec/hapqa_extract_bsf.c | 2 ++
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/hap.h b/libavcodec/hap.h
> index a888b58fd7..1de6d45428 100644
> --- a/libavcodec/hap.h
> +++ b/libavcodec/hap.h
> @@ -23,10 +23,9 @@
>  #ifndef AVCODEC_HAP_H
>  #define AVCODEC_HAP_H
>
> +#include <stddef.h>
>  #include <stdint.h>
>
> -#include "libavutil/opt.h"
> -
>  #include "bytestream.h"
>  #include "texturedsp.h"
>
> @@ -59,7 +58,7 @@ typedef struct HapChunk {
>  } HapChunk;
>
>  typedef struct HapContext {
> -    AVClass *class;
> +    const struct AVClass *class;
>
>      GetByteContext gbc;
>
> diff --git a/libavcodec/hapqa_extract_bsf.c
> b/libavcodec/hapqa_extract_bsf.c
> index 0d9b40aaa6..eac9eafe42 100644
> --- a/libavcodec/hapqa_extract_bsf.c
> +++ b/libavcodec/hapqa_extract_bsf.c
> @@ -30,6 +30,8 @@
>  #include "bytestream.h"
>  #include "hap.h"
>
> +#include "libavutil/opt.h"
>

Is this include only for AVClass? Should it be log.h then?
-- 
Vittorio
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion
  2024-01-25 19:27   ` Vittorio Giovara
@ 2024-01-26  6:41     ` Andreas Rheinhardt
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-26  6:41 UTC (permalink / raw)
  To: ffmpeg-devel

Vittorio Giovara:
> On Wed, Jan 24, 2024 at 9:06 PM Andreas Rheinhardt <
> andreas.rheinhardt@outlook.com> wrote:
> 
>> It presumably exists because HapContext contains an AVClass*.
>> Yet AVClass is actually defined in log.h and even this inclusion
>> can be avoided by struct AVClass*. This avoids opt.h inclusions
>> in hap.c and hapdec.c.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>>  libavcodec/hap.h               | 5 ++---
>>  libavcodec/hapqa_extract_bsf.c | 2 ++
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/hap.h b/libavcodec/hap.h
>> index a888b58fd7..1de6d45428 100644
>> --- a/libavcodec/hap.h
>> +++ b/libavcodec/hap.h
>> @@ -23,10 +23,9 @@
>>  #ifndef AVCODEC_HAP_H
>>  #define AVCODEC_HAP_H
>>
>> +#include <stddef.h>
>>  #include <stdint.h>
>>
>> -#include "libavutil/opt.h"
>> -
>>  #include "bytestream.h"
>>  #include "texturedsp.h"
>>
>> @@ -59,7 +58,7 @@ typedef struct HapChunk {
>>  } HapChunk;
>>
>>  typedef struct HapContext {
>> -    AVClass *class;
>> +    const struct AVClass *class;
>>
>>      GetByteContext gbc;
>>
>> diff --git a/libavcodec/hapqa_extract_bsf.c
>> b/libavcodec/hapqa_extract_bsf.c
>> index 0d9b40aaa6..eac9eafe42 100644
>> --- a/libavcodec/hapqa_extract_bsf.c
>> +++ b/libavcodec/hapqa_extract_bsf.c
>> @@ -30,6 +30,8 @@
>>  #include "bytestream.h"
>>  #include "hap.h"
>>
>> +#include "libavutil/opt.h"
>>
> 
> Is this include only for AVClass? Should it be log.h then?

Yes. log.h can be avoided by using struct AVClass* (there is actually
still an implicit inclusion of log.h via bytestream.h).

- 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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away
  2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
                   ` (6 preceding siblings ...)
  2024-01-24 20:49 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Connor Worley
@ 2024-01-26 19:00 ` Andreas Rheinhardt
  2024-01-26 19:15   ` Connor Worley
  7 siblings, 1 reply; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-01-26 19:00 UTC (permalink / raw)
  To: ffmpeg-devel

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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away
  2024-01-26 19:00 ` Andreas Rheinhardt
@ 2024-01-26 19:15   ` Connor Worley
  0 siblings, 0 replies; 13+ messages in thread
From: Connor Worley @ 2024-01-26 19:15 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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".
>


-- 
Connor Worley
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-26 19:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 3/7] avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 4/7] avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 5/7] avcodec/texturedsp: Add separate TextureDSPEncContext Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion Andreas Rheinhardt
2024-01-25 19:27   ` Vittorio Giovara
2024-01-26  6:41     ` Andreas Rheinhardt
2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 7/7] avcodec/texturedsp: Factor common code out Andreas Rheinhardt
2024-01-24 20:49 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Connor Worley
2024-01-25  3:04   ` Andreas Rheinhardt
2024-01-26 19:00 ` Andreas Rheinhardt
2024-01-26 19:15   ` Connor Worley

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git