diff options
author | 2008-08-18 04:31:08 +0000 | |
---|---|---|
committer | 2008-08-18 04:31:08 +0000 | |
commit | 284b5a0d95c4740b25fd1d06aecd2cc74eae12f3 (patch) | |
tree | ed984f6362decda13c57c168d5d2d18d6e30d06c /src/tools/ldverify.c | |
parent | d0eb89399fc684c90330466674470775079ae113 (diff) |
Added new generic laserdisc VIDEO_UPDATE handler to the laserdisc code.
This handler works for both disc-only games and those with overlays.
For disc-only games, the base macro is sufficient. For games with
overlays, an additional set of configuration macros are provided:
MDRV_LASERDISC_OVERLAY - specifies update function, width, height,
and bitmap format of the overlay
MDRV_LASERDISC_OVERLAY_CLIP - specifies the visible area of the
overlay bitmap
MDRV_LASERDISC_OVERLAY_POSITION - specifies default x,y position
MDRV_LASERDISC_OVERLAY_SCALE - specifies default x,y scale factors
The update function provided to MDRV_LASERDISC_OVERLAY is identical to
a normal VIDEO_UPDATE callback, so a standard one can be used. All
existing laserdisc drivers have been updated to support this new
rendering mechanism, removing much duplicated code.
Added the ability to configure the overlay position and scale
parameters at runtime. Added OSD menus to control them. Added logic
to save/restore the data in the game's configuration file.
Added new macros MDRV_LASERDISC_SCREEN_ADD_NTSC and _PAL, which
defines a standard screen with the correct video timing characteristics
and update function for laserdiscs. Updated all drivers to use these
macros instead of defining their own screens.
Added DISK_REGIONS to all laserdisc drivers.
Added DISK_IMAGE_READONLY_OPTIONAL to support games (like Cube Quest)
where the disk is non-essential to the game's operation.
Fixed bug in identifying the custom sound driver for the laserdisc.
Updated ldverify to identify blank regions of the disc for post-
processing.
Fixed rendering 16bpp with alpha using bilinear filters (fixes
screenshots of laserdisc games with overlays).
Included support for parsing .gdi files in chdman. [ElSemi]
Added new driver for Cube Quest. This includes CPU cores for the three
bitslice processors, as well as laserdisc support for the hacked
laserdisc that was used to drive the games.
[Philip Bennett, Joe Magiera, Warren Ondras]
Note that the SHA1/MD5 for the laserdisc will likely undergo at least
one more change before being finalized.
Diffstat (limited to 'src/tools/ldverify.c')
-rw-r--r-- | src/tools/ldverify.c | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/src/tools/ldverify.c b/src/tools/ldverify.c index 8aea954576f..41b10630950 100644 --- a/src/tools/ldverify.c +++ b/src/tools/ldverify.c @@ -19,6 +19,14 @@ /*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define REPORT_BLANKS_THRESHOLD 8 + + + +/*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -52,6 +60,9 @@ 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_first_blank_frame = -1; +static int video_first_blank_field = -1; +static int video_num_blank_fields = -1; static int video_first_low_frame = -1; static int video_first_low_field = -1; static int video_num_low_fields = -1; @@ -307,9 +318,12 @@ static void verify_video(int frame, bitmap_t *bitmap) /* loop over fields */ for (fieldnum = 0; fieldnum < fields_per_frame; fieldnum++) { + int yminval, ymaxval, cbminval, cbmaxval, crminval, crmaxval; int field = frame * fields_per_frame + fieldnum; - int x, y, pixels, remaining, minval, maxval; - UINT32 pixelhisto[256] = { 0 }; + int x, y, pixels, remaining; + UINT32 yhisto[256] = { 0 }; + UINT32 crhisto[256] = { 0 }; + UINT32 cbhisto[256] = { 0 }; vbi_metadata metadata; /* output status */ @@ -464,24 +478,63 @@ static void verify_video(int frame, bitmap_t *bitmap) for (y = 22*2 + fieldnum; y < bitmap->height; y += 2) { for (x = 16; x < 720 - 16; x++) - pixelhisto[*BITMAP_ADDR16(bitmap, y, x) >> 8]++; + { + yhisto[*BITMAP_ADDR16(bitmap, y, x) >> 8]++; + if (x % 2 == 0) + cbhisto[*BITMAP_ADDR16(bitmap, y, x) & 0xff]++; + else + crhisto[*BITMAP_ADDR16(bitmap, y, x) & 0xff]++; + } pixels += 720 - 16 - 16; } - /* remove the top/bottom 0.1% */ + /* remove the top/bottom 0.1% of Y */ remaining = pixels / 1000; - for (minval = 0; remaining >= 0; minval++) - remaining -= pixelhisto[minval]; + for (yminval = 0; remaining >= 0; yminval++) + remaining -= yhisto[yminval]; remaining = pixels / 1000; - for (maxval = 255; remaining >= 0; maxval--) - remaining -= pixelhisto[maxval]; + for (ymaxval = 255; remaining >= 0; ymaxval--) + remaining -= yhisto[ymaxval]; + + /* remove the top/bottom 0.1% of Cb */ + remaining = pixels / 500; + for (cbminval = 0; remaining >= 0; cbminval++) + remaining -= cbhisto[cbminval]; + remaining = pixels / 500; + for (cbmaxval = 255; remaining >= 0; cbmaxval--) + remaining -= cbhisto[cbmaxval]; + + /* remove the top/bottom 0.1% of Cr */ + remaining = pixels / 500; + for (crminval = 0; remaining >= 0; crminval++) + remaining -= crhisto[crminval]; + remaining = pixels / 500; + for (crmaxval = 255; remaining >= 0; crmaxval--) + remaining -= crhisto[crmaxval]; + + /* track blank frames */ + if (ymaxval - yminval < 10 && cbmaxval - cbminval < 10 && crmaxval - cbmaxval < 10) + { + if (video_first_blank_frame == -1) + { + video_first_blank_frame = frame; + video_first_blank_field = fieldnum; + video_num_blank_fields = 0; + } + video_num_blank_fields++; + } + else if (video_num_blank_fields >= REPORT_BLANKS_THRESHOLD) + { + printf("%6d.%d-%6d.%d: blank frames for %d fields (INFO)\n", video_first_blank_frame, video_first_blank_field, frame, fieldnum, video_num_blank_fields); + video_first_blank_frame = video_first_blank_field = video_num_blank_fields = -1; + } /* update the overall min/max */ - video_min_overall = MIN(minval, video_min_overall); - video_max_overall = MAX(maxval, video_max_overall); + video_min_overall = MIN(yminval, video_min_overall); + video_max_overall = MAX(ymaxval, video_max_overall); /* track low fields */ - if (minval < 16) + if (yminval < 16) { if (video_first_low_frame == -1) { @@ -498,7 +551,7 @@ static void verify_video(int frame, bitmap_t *bitmap) } /* track high fields */ - if (maxval > 236) + if (ymaxval > 236) { if (video_first_high_frame == -1) { @@ -535,6 +588,8 @@ static void verify_video_final(int frame, bitmap_t *bitmap) printf("Track %6d.%d: never saw any lead-out (WARNING)\n", field / fields_per_frame, 0); /* any remaining high/low reports? */ + if (video_num_blank_fields >= REPORT_BLANKS_THRESHOLD) + printf("%6d.%d-%6d.%d: blank frames for %d fields (INFO)\n", video_first_blank_frame, video_first_blank_field, frame, 0, video_num_blank_fields); if (video_num_low_fields > 0) printf("%6d.%d-%6d.%d: active video signal level low for %d fields (WARNING)\n", video_first_low_frame, video_first_low_field, frame, 0, video_num_low_fields); if (video_num_high_fields > 0) |