iter29 DIAG: dump trailing 80 bytes of HEVC slice_data per slice

Env-gated via LIBVA_HEVC_DUMP_SLICE_TAIL=1. Goal: characterise the
40-byte inflation in libva's slice_data buffer vs ffmpeg-v4l2request
(see iter27/28 close — HEVC frame 2+ divergence at byte 1382401).

Dumps per slice: nal_unit_type, slice_data_size, slice_data_byte_offset,
and the last 80 bytes of source_data for that slice. Lets us see if the
trailing 40 bytes are (a) real entropy, (b) trailing zeros, (c) a
next-NAL start code prefix, or (d) random memory.
This commit is contained in:
2026-05-14 15:00:31 +00:00
parent 6646b1635e
commit 0eca3ffc6b
+21
View File
@@ -70,6 +70,7 @@
#include "surface.h" #include "surface.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -613,6 +614,26 @@ int h265_set_controls(struct request_data *driver_data,
cumulative_offset, cumulative_offset,
&slice_params_array[i]); &slice_params_array[i]);
/* iter29 DIAG: dump trailing 80 bytes of each HEVC slice.
* Set LIBVA_HEVC_DUMP_SLICE_TAIL=1 to enable. Goal: characterise
* the 40-byte inflation in ffmpeg-vaapi vs ffmpeg-v4l2request for
* frame 2+ slices (see iter27/28 close). */
if (getenv("LIBVA_HEVC_DUMP_SLICE_TAIL")) {
uint32_t sz = slice->slice_data_size;
uint32_t boff = slice->slice_data_byte_offset;
uint8_t *p = (uint8_t *)surface_object->source_data + cumulative_offset;
uint32_t dump_n = sz < 80 ? sz : 80;
uint32_t start = sz - dump_n;
uint32_t k;
fprintf(stderr, "iter29 slice[%u] nut=%u size=%u boff=%u start_in_slice=%u tail80:",
i, slice_params_array[i].nal_unit_type, sz, boff, start);
for (k = 0; k < dump_n; k++) {
if ((k & 0xf) == 0) fprintf(stderr, "\n +%04x:", start + k);
fprintf(stderr, " %02x", p[start + k]);
}
fprintf(stderr, "\n");
}
cumulative_offset += slice->slice_data_size; cumulative_offset += slice->slice_data_size;
} }