summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-08-12 17:37:53 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-08-12 17:37:53 +0000
commit111a34fea559118cbd801435799fa747c2fdf5f3 (patch)
treee68563e3410a8b98b22119ac2521b7d93576d8c5 /src/tools
parentc2b9cb3b7eb9f4e41b6c3091e56d53db6dd167ca (diff)
Added video level detection and reporting to ldverify.
Removed channels parameter from avcomp decode configuration. Fixed incorrect test in winwork that led to spinning instead of using the nicely allocated events we had on hand. Forced a sound synchronization on each vsync in the laserdisc playback. This prevents overwriting the tail end of the buffer which was fouling up the MACH 3 audio decoding. Removed obsolete size check for uncompressable audio data.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/chdman.c15
-rw-r--r--src/tools/ldverify.c65
2 files changed, 54 insertions, 26 deletions
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index ac47b9f04fc..04049f4ad3a 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -84,20 +84,6 @@ static clock_t lastprogress = 0;
***************************************************************************/
/*-------------------------------------------------
- put_bigendian_uint32 - write a UINT32 in big-endian order to memory
--------------------------------------------------*/
-
-#ifdef UNUSED_FUNCTON
-INLINE void put_bigendian_uint32(UINT8 *base, UINT32 value)
-{
- base[0] = value >> 24;
- base[1] = value >> 16;
- base[2] = value >> 8;
- base[3] = value;
-}
-#endif
-
-/*-------------------------------------------------
print_big_int - 64-bit int printing with commas
-------------------------------------------------*/
@@ -1490,7 +1476,6 @@ static int do_extractav(int argc, char *argv[], int param)
avconfig.video = &fakebitmap;
/* allocate audio buffers */
- avconfig.channels = channels;
avconfig.maxsamples = ((UINT64)rate * 1000000 + fps_times_1million - 1) / fps_times_1million;
avconfig.actsamples = &numsamples;
for (chnum = 0; chnum < channels; chnum++)
diff --git a/src/tools/ldverify.c b/src/tools/ldverify.c
index 01037d921cf..b297f2bcbab 100644
--- a/src/tools/ldverify.c
+++ b/src/tools/ldverify.c
@@ -19,12 +19,6 @@
/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-
-
-/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -56,6 +50,10 @@ static int video_last_chapter = -1;
static int video_cadence = -1;
static UINT32 video_cadence_history = 0;
static int video_prev_whitefield = -1;
+static int video_min_overall = 255;
+static int video_max_overall = 0;
+static int video_low_frames = 0;
+static int video_high_frames = 0;
static int audio_min_lsample = 32767;
static int audio_min_rsample = 32767;
@@ -306,6 +304,8 @@ static void verify_video(int frame, bitmap_t *bitmap)
for (fieldnum = 0; fieldnum < fields_per_frame; fieldnum++)
{
int field = frame * fields_per_frame + fieldnum;
+ int x, y, pixels, remaining, minval, maxval;
+ UINT32 pixelhisto[256] = { 0 };
vbi_metadata metadata;
/* output status */
@@ -454,6 +454,43 @@ static void verify_video(int frame, bitmap_t *bitmap)
}
}
}
+
+ /* now examine the active video signal */
+ pixels = 0;
+ for (y = 22*2 + fieldnum; y < bitmap->height; y += 2)
+ {
+ for (x = 16; x < 720 - 16; x++)
+ pixelhisto[*BITMAP_ADDR16(bitmap, y, x) >> 8]++;
+ pixels += 720 - 16 - 16;
+ }
+
+ /* remove the top/bottom 0.1% */
+ remaining = pixels / 1000;
+ for (minval = 0; remaining >= 0; minval++)
+ remaining -= pixelhisto[minval];
+ remaining = pixels / 1000;
+ for (maxval = 255; remaining >= 0; maxval--)
+ remaining -= pixelhisto[maxval];
+
+ /* update the overall min/max */
+ video_min_overall = MIN(minval, video_min_overall);
+ video_max_overall = MAX(maxval, video_max_overall);
+ if (minval < 16)
+ {
+ video_low_frames++;
+ if (video_low_frames < 10)
+ printf("%6d.%d: active video signal level low (%02X) (WARNING)\n", frame, fieldnum, minval);
+ else if (video_low_frames == 10)
+ printf("%6d.%d: active video signal level low (%02X) - suppressing future warnings (WARNING)\n", frame, fieldnum, minval);
+ }
+ if (maxval > 236)
+ {
+ video_high_frames++;
+ if (video_high_frames < 10)
+ printf("%6d.%d: active video signal level high (%02X) (WARNING)\n", frame, fieldnum, minval);
+ else if (video_high_frames == 10)
+ printf("%6d.%d: active video signal level high (%02X) - suppressing future warnings (WARNING)\n", frame, fieldnum, minval);
+ }
}
}
@@ -474,6 +511,14 @@ static void verify_video_final(int frame, bitmap_t *bitmap)
/* did we ever see any lead-out? */
if (!video_saw_leadout)
printf("Track %6d.%d: never saw any lead-out (WARNING)\n", field / fields_per_frame, 0);
+
+ /* summary info */
+ printf("\nVideo summary:\n");
+ printf(" Overall video range: %d-%d (%02X-%02X)\n", video_min_overall, video_max_overall, video_min_overall, video_max_overall);
+ if (video_low_frames)
+ printf(" Total frames with low signal: %d\n", video_low_frames);
+ if (video_high_frames)
+ printf(" Total frames with high signal: %d\n", video_high_frames);
}
@@ -536,11 +581,9 @@ static void verify_audio(const INT16 *lsound, const INT16 *rsound, int samples)
static void verify_audio_final(void)
{
- printf("Audio summary:\n");
- printf(" Channel 0 minimum: %6d (with %9d/%9d samples at minimum)\n", audio_min_lsample, audio_min_lsample_count, audio_sample_count);
- printf(" Channel 0 maximum: %6d (with %9d/%9d samples at maximum)\n", audio_max_lsample, audio_max_lsample_count, audio_sample_count);
- printf(" Channel 1 minimum: %6d (with %9d/%9d samples at minimum)\n", audio_min_rsample, audio_min_rsample_count, audio_sample_count);
- printf(" Channel 1 maximum: %6d (with %9d/%9d samples at maximum)\n", audio_max_rsample, audio_max_rsample_count, audio_sample_count);
+ printf("\nAudio summary:\n");
+ printf(" Overall channel 0 range: %d-%d (%04X-%04X)\n", audio_min_lsample, audio_max_lsample, (UINT16)audio_min_lsample, (UINT16)audio_max_lsample);
+ printf(" Overall channel 1 range: %d-%d (%04X-%04X)\n", audio_min_rsample, audio_max_rsample, (UINT16)audio_min_rsample, (UINT16)audio_max_rsample);
}