DEBUG: hex-dump OUTPUT and CAPTURE buffer contents per frame
Diagnostic-only patch (NOT for upstream). Hex-dumps:
- First 32 bytes of OUTPUT buffer at QBUF time in
picture.c::RequestEndPicture (i.e. what we feed the kernel)
- First 32 bytes of CAPTURE Y-plane after DQBUF in
surface.c::RequestSyncSurface (i.e. what kernel returned)
Lets us see whether:
- OUTPUT bitstream begins with valid ANNEX_B start code + NAL
header byte (e.g. `00 00 01 65` for IDR slice)
- CAPTURE Y-plane after decode contains varied luma data
(working) vs. all-zeros / repeating pattern (kernel didn't
write anything).
Removed once Step 1 decode is verified working. Output goes via
existing request_log() to stderr.
Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "mpeg2.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <errno.h>
|
||||
@@ -354,6 +355,27 @@ VAStatus RequestEndPicture(VADriverContextP context, VAContextID context_id)
|
||||
if (rc < 0)
|
||||
return VA_STATUS_ERROR_OPERATION_FAILED;
|
||||
|
||||
/*
|
||||
* DEBUG INSTRUMENTATION (0010): hex-dump first 32 bytes of the
|
||||
* OUTPUT buffer at the moment we hand it to the kernel. Helps
|
||||
* pin down whether our bitstream prepend logic is correct.
|
||||
* For a valid ANNEX_B IDR slice the dump should start
|
||||
* 00 00 01 65 ... (00 00 01 = start code; 0x65 = nal_ref_idc=3,
|
||||
* nal_unit_type=5 = IDR slice). Removed once Step 1 decode is
|
||||
* verified working.
|
||||
*/
|
||||
{
|
||||
const unsigned char *p = surface_object->source_data;
|
||||
char hex[32 * 3 + 1] = { 0 };
|
||||
unsigned int i, n = surface_object->slices_size < 32 ?
|
||||
surface_object->slices_size : 32;
|
||||
for (i = 0; i < n; i++)
|
||||
snprintf(hex + i * 3, 4, " %02x", p[i]);
|
||||
request_log("OUTPUT[idx=%u, len=%u]:%s\n",
|
||||
surface_object->source_index,
|
||||
surface_object->slices_size, hex);
|
||||
}
|
||||
|
||||
rc = v4l2_queue_buffer(driver_data->video_fd, request_fd, output_type,
|
||||
&surface_object->timestamp,
|
||||
surface_object->source_index,
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -364,6 +365,30 @@ VAStatus RequestSyncSurface(VADriverContextP context, VASurfaceID surface_id)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* DEBUG INSTRUMENTATION (0010): hex-dump first 32 bytes of the
|
||||
* decoded CAPTURE Y-plane after DQBUF. If the kernel actually
|
||||
* decoded the frame, these should reflect a real Y-luma pattern
|
||||
* (varied bytes). All-zero or all-identical means no decode
|
||||
* landed pixels in the buffer. Removed once Step 1 is verified.
|
||||
*/
|
||||
{
|
||||
const unsigned char *p =
|
||||
(unsigned char *)surface_object->destination_map[0];
|
||||
char hex[32 * 3 + 1] = { 0 };
|
||||
unsigned int i;
|
||||
if (p == NULL) {
|
||||
request_log("CAPTURE[idx=%u, plane0]: (NULL)\n",
|
||||
surface_object->destination_index);
|
||||
} else {
|
||||
for (i = 0; i < 32; i++)
|
||||
snprintf(hex + i * 3, 4, " %02x", p[i]);
|
||||
request_log("CAPTURE[idx=%u, plane0]:%s\n",
|
||||
surface_object->destination_index,
|
||||
hex);
|
||||
}
|
||||
}
|
||||
|
||||
surface_object->status = VASurfaceDisplaying;
|
||||
|
||||
status = VA_STATUS_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user