Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Emma Worley via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Emma Worley <emma@emma.gg>
Subject: [FFmpeg-devel] [PATCH] lavc/dxvenc: replace erroneous uses of "words" with "dwords"
Date: Sun, 11 Jan 2026 13:00:03 +0900
Message-ID: <20260111040002.94723-2-emma@emma.gg> (raw)

I made some references to words when I meant dwords.
This change corrects that language where appropriate in preparation for DXT5 support.

Signed-off-by: Emma Worley <emma@emma.gg>
---
 libavcodec/dxvenc.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index 0a2dd8077b..b4e639f76b 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -40,12 +40,12 @@
 #define DXV_ALIGN(x) FFALIGN(x, 16)
 
 /*
- * DXV uses LZ-like back-references to avoid copying words that have already
+ * DXV uses LZ-like back-references to avoid copying data that has already
  * appeared in the decompressed stream. Using a simple hash table (HT)
  * significantly speeds up the lookback process while encoding.
  */
-#define LOOKBACK_HT_ELEMS 0x20202
-#define LOOKBACK_WORDS    0x20202
+#define LOOKBACK_HT_ELEMS    0x20202
+#define LOOKBACK_DWORDS_DXT1 0x20202
 
 typedef struct DXVEncContext {
     AVClass *class;
@@ -70,7 +70,7 @@ typedef struct DXVEncContext {
 
 /* 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)                                                            \
+#define PUSH_OP(block_dwords)                                                 \
     do {                                                                      \
         if (state == 16) {                                                    \
             if (bytestream2_get_bytes_left_p(pbc) < 4) {                      \
@@ -80,13 +80,13 @@ typedef struct DXVEncContext {
             bytestream2_put_le32(pbc, 0);                                     \
             state = 0;                                                        \
         }                                                                     \
-        if (idx >= 0x102 * x) {                                               \
+        if (idx >= 0x102 * block_dwords) {                                    \
             op = 3;                                                           \
-            bytestream2_put_le16(pbc, (idx / x) - 0x102);                     \
-        } else if (idx >= 2 * x) {                                            \
+            bytestream2_put_le16(pbc, (idx / block_dwords) - 0x102);          \
+        } else if (idx >= 2 * block_dwords) {                                 \
             op = 2;                                                           \
-            bytestream2_put_byte(pbc, (idx / x) - 2);                         \
-        } else if (idx == x) {                                                \
+            bytestream2_put_byte(pbc, (idx / block_dwords) - 2);              \
+        } else if (idx == block_dwords) {                                     \
             op = 1;                                                           \
         } else {                                                              \
             op = 0;                                                           \
@@ -119,8 +119,8 @@ static int dxv_compress_dxt1(AVCodecContext *avctx)
         combo_idx = ff_hashtable_get(ctx->combo_ht, ctx->tex_data + pos * 4, &prev_pos) ? pos - prev_pos : 0;
         idx = combo_idx;
         PUSH_OP(2);
-        if (pos >= LOOKBACK_WORDS) {
-            old_pos = pos - LOOKBACK_WORDS;
+        if (pos >= LOOKBACK_DWORDS_DXT1) {
+            old_pos = pos - LOOKBACK_DWORDS_DXT1;
             if (ff_hashtable_get(ctx->combo_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
                 ff_hashtable_delete(ctx->combo_ht, ctx->tex_data + old_pos * 4);
         }
@@ -132,8 +132,8 @@ static int dxv_compress_dxt1(AVCodecContext *avctx)
             if (!idx)
                 bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + pos * 4));
         }
-        if (pos >= LOOKBACK_WORDS) {
-            old_pos = pos - LOOKBACK_WORDS;
+        if (pos >= LOOKBACK_DWORDS_DXT1) {
+            old_pos = pos - LOOKBACK_DWORDS_DXT1;
             if (ff_hashtable_get(ctx->color_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
                 ff_hashtable_delete(ctx->color_ht, ctx->tex_data + old_pos * 4);
         }
@@ -146,8 +146,8 @@ static int dxv_compress_dxt1(AVCodecContext *avctx)
             if (!idx)
                 bytestream2_put_le32(pbc, AV_RL32(ctx->tex_data + pos * 4));
         }
-        if (pos >= LOOKBACK_WORDS) {
-            old_pos = pos - LOOKBACK_WORDS;
+        if (pos >= LOOKBACK_DWORDS_DXT1) {
+            old_pos = pos - LOOKBACK_DWORDS_DXT1;
             if (ff_hashtable_get(ctx->lut_ht, ctx->tex_data + old_pos * 4, &prev_pos) && prev_pos <= old_pos)
                 ff_hashtable_delete(ctx->lut_ht, ctx->tex_data + old_pos * 4);
         }
@@ -166,8 +166,8 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
     int ret;
 
     /* unimplemented: needs to depend on compression ratio of tex format */
-    /* under DXT1, we need 3 words to encode load ops for 32 words.
-     * the first 2 words of the texture do not need load ops. */
+    /* under DXT1, we need 3 dwords to encode load ops for 32 dwords.
+     * the first 2 dwords of the texture do not need load ops. */
     ret = ff_alloc_packet(avctx, pkt, DXV_HEADER_LENGTH + ctx->tex_size + AV_CEIL_RSHIFT(ctx->tex_size - 8, 7) * 12);
     if (ret < 0)
         return ret;
-- 
2.48.0

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-01-11  4:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260111040002.94723-2-emma@emma.gg \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=emma@emma.gg \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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