From 5dcf2177d5d3cfb33197d2a6119880e72fcf3bd7 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 14 Oct 2025 14:16:05 +0900 Subject: [PATCH] TAV: no delta coding by default (but allows skip coding) --- assets/disk0/tvdos/i18n/hang_hi.chr | Bin 1920 -> 1920 bytes assets/disk0/tvdos/i18n/hang_lo.chr | Bin 1920 -> 1920 bytes video_encoder/encoder_tav.c | 21 +++++++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/assets/disk0/tvdos/i18n/hang_hi.chr b/assets/disk0/tvdos/i18n/hang_hi.chr index b0e1d66dfd22b0168d876ddf59901373fe144ba0..cd28dfe5e5fbbffe59b378b4f3c96c723daeb3cb 100644 GIT binary patch delta 140 zcmZqRZ{XjM$Ws4M)S&SG$UH!j`*Y?@1w!SSKgc`-gNiczstd_level = DEFAULT_ZSTD_LEVEL; // Default Zstd compression level enc->progressive_mode = 1; // Default to progressive mode enc->grain_synthesis = 0; // Default: disable grain synthesis (only do it on the decoder) + enc->use_delta_encoding = 0; // disable by default: no longer brings size benefit return enc; } @@ -2010,9 +2013,13 @@ static size_t compress_and_write_frame(tav_encoder_t *enc, uint8_t packet_type) if (enc->verbose && tile_x == 0 && tile_y == 0) { printf(" → Using SKIP mode (copying from reference I-frame)\n"); } - } else { + } else if (enc->use_delta_encoding) { mode = TAV_MODE_DELTA; // P-frames use coefficient delta encoding count_delta++; + } else { + // Delta encoding disabled: use INTRA mode (packet_type is already I-frame from main loop) + mode = TAV_MODE_INTRA; + count_intra++; } // Determine tile data size and allocate buffers @@ -3756,6 +3763,7 @@ int main(int argc, char *argv[]) { {"interlace", no_argument, 0, 1015}, {"interlaced", no_argument, 0, 1015}, // {"no-grain-synthesis", no_argument, 0, 1016}, + {"enable-delta", no_argument, 0, 1017}, {"help", no_argument, 0, '?'}, {0, 0, 0, 0} }; @@ -3908,6 +3916,9 @@ int main(int argc, char *argv[]) { case 1016: // --no-grain-synthesis enc->grain_synthesis = 0; break; + case 1017: // --enable-delta + enc->use_delta_encoding = 1; + break; case 'a': int bitrate = atoi(optarg); int valid_bitrate = validate_mp2_bitrate(bitrate); @@ -4202,10 +4213,12 @@ int main(int argc, char *argv[]) { // Un-skip threshold is the negation of SKIP threshold: content must change to break the run int suppress_keyframe_timer = in_skip_run && is_still; - // Keyframe decision: intra-only mode, time-based (unless suppressed by SKIP run), or scene change + // Keyframe decision: intra-only mode, time-based (unless suppressed by SKIP run), scene change, + // or when delta encoding is disabled and skip mode cannot be used (pure INTRA frames) int is_keyframe = enc->intra_only || (is_time_keyframe && !suppress_keyframe_timer) || - is_scene_change; + is_scene_change || + (!enc->use_delta_encoding && !can_use_skip); // Track if we'll use SKIP mode this frame (continues the SKIP run) enc->used_skip_mode_last_frame = can_use_skip && !is_keyframe;