mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00

almost certainly some regressions lurking. Let me know if something seems busted. Bitmaps are now strongly typed based on format. bitmap_t still exists as an abstract base class, but it is almost never used. Instead, format-specific bitmap classes are provided: bitmap_ind8 == 8bpp indexed bitmap_ind16 == 16bpp indexed bitmap_ind32 == 32bpp indexed bitmap_ind64 == 64bpp indexed bitmap_rgb32 == 32bpp RGB bitmap_argb32 == 32bpp ARGB bitmap_yuy16 == 16bpp YUY For each format, a generic pix() method is provided which references pixels of the correct type. The old pix8/pix16/pix32/ pix64 methods still exist in the short term, but the only one available is the one that matches the bitmap's pixel size. Note also that the old RGB15 format bitmaps are no longer supported at all. Converted model1, megadriv, and stv drivers away from the RGB15 format bitmaps. New auto_bitmap_<type>_alloc() macros are provided for allocating the appropriate type of bitmap. Screen update functions now must specify the correct bitmap type as their input parameters. For static update functions the SCREEN_UPDATE macro is now replaced with SCREEN_UPDATE_RGB32 and SCREEN_UPDATE_IND16 macros. All existing drivers have been updated to use the correct macros. Screen update functions are now required for all screens; there is no longer any default behavior of copying a "default" bitmap to the screen (in fact the default bitmap has been deprecated). Use one of the following to specify your screen_update callback: MCFG_SCREEN_UPDATE_STATIC(name) - static functions MCFG_SCREEN_UPDATE_DRIVER(class, func) - driver members MCFG_SCREEN_UPDATE_DEVICE(tag, class, func) - device members Because the target bitmap format can now be deduced from the screen update function itself, the MCFG_SCREEN_FORMAT macro is no longer necessary, and has been removed. If you specify a screen update callback that takes a bitmap_ind16, then the screen will be configured to use a 16bpp indexed bitmap, and if you specify a callback that takes a bitmap_rgb32, then a 32bpp RGB bitmap will be provided. Extended the bitmap classes to support wrapping a subregion of another bitmap, and cleaner allocation/resetting. The preferred use of bitmaps now is to define them directly in drivers/devices and use allocate() or wrap() to set them up, rather than allocating them via auto_bitmap_*_alloc(). Several common devices needed overhauls or changes as a result of the above changes: * Reorganized the laserdisc base driver and all the laserdisc drivers as modern C++ devices, cleaning the code up considerably. Merged ldsound device into the laserdsc device since modern devices are flexible enough to handle it. * Reorganized the v9938 device as a modern C++ device. Removed v9938mod.c in favor of template functions in v9938.c directly. * Added independent ind16 and rgb32 callbacks for TMS340x0 devices. * All video devices are now hard-coded to either ind16 or rgb32 bitmaps. The most notable is the mc6845 which is rgb32, and required changes to a number of consumers. * Added screen_update methods to most video devices so they can be directly called via MCFG_SCREEN_UPDATE_DEVICE instead of creating tons of stub functions.
141 lines
4.7 KiB
C
141 lines
4.7 KiB
C
/***************************************************************************
|
|
|
|
avcomp.h
|
|
|
|
Audio/video compression and decompression helpers.
|
|
|
|
****************************************************************************
|
|
|
|
Copyright Aaron Giles
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are
|
|
met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
notice, this list of conditions and the following disclaimer in
|
|
the documentation and/or other materials provided with the
|
|
distribution.
|
|
* Neither the name 'MAME' nor the names of its contributors may be
|
|
used to endorse or promote products derived from this software
|
|
without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
|
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
***************************************************************************/
|
|
|
|
#ifndef __AVCOMP_H__
|
|
#define __AVCOMP_H__
|
|
|
|
#include "osdcore.h"
|
|
#include "bitmap.h"
|
|
|
|
|
|
/***************************************************************************
|
|
CONSTANTS
|
|
***************************************************************************/
|
|
|
|
/* errors */
|
|
enum _avcomp_error
|
|
{
|
|
AVCERR_NONE = 0,
|
|
AVCERR_INVALID_DATA,
|
|
AVCERR_VIDEO_TOO_LARGE,
|
|
AVCERR_AUDIO_TOO_LARGE,
|
|
AVCERR_METADATA_TOO_LARGE,
|
|
AVCERR_OUT_OF_MEMORY,
|
|
AVCERR_COMPRESSION_ERROR,
|
|
AVCERR_TOO_MANY_CHANNELS,
|
|
AVCERR_INVALID_CONFIGURATION
|
|
};
|
|
typedef enum _avcomp_error avcomp_error;
|
|
|
|
/* default decompression parameters */
|
|
#define AVCOMP_ENABLE_META (1 << 0)
|
|
#define AVCOMP_ENABLE_VIDEO (1 << 1)
|
|
#define AVCOMP_ENABLE_AUDIO(x) (1 << (2 + (x)))
|
|
#define AVCOMP_ENABLE_DEFAULT (~0)
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
TYPE DEFINITIONS
|
|
***************************************************************************/
|
|
|
|
/* compression configuration */
|
|
struct av_codec_compress_config
|
|
{
|
|
av_codec_compress_config()
|
|
: channels(0),
|
|
samples(0),
|
|
metalength(0),
|
|
metadata(NULL)
|
|
{
|
|
memset(audio, 0, sizeof(audio));
|
|
}
|
|
|
|
bitmap_yuy16 video; /* pointer to video bitmap */
|
|
UINT32 channels; /* number of channels */
|
|
UINT32 samples; /* number of samples per channel */
|
|
INT16 * audio[16]; /* pointer to individual audio channels */
|
|
UINT32 metalength; /* length of metadata */
|
|
UINT8 * metadata; /* pointer to metadata buffer */
|
|
};
|
|
|
|
|
|
/* decompression configuration */
|
|
struct av_codec_decompress_config
|
|
{
|
|
av_codec_decompress_config()
|
|
: maxsamples(0),
|
|
actsamples(0),
|
|
maxmetalength(0),
|
|
actmetalength(0),
|
|
metadata(NULL)
|
|
{
|
|
memset(audio, 0, sizeof(audio));
|
|
}
|
|
|
|
bitmap_yuy16 video; /* pointer to video bitmap */
|
|
UINT32 maxsamples; /* maximum number of samples per channel */
|
|
UINT32 * actsamples; /* actual number of samples per channel */
|
|
INT16 * audio[16]; /* pointer to individual audio channels */
|
|
UINT32 maxmetalength; /* maximum length of metadata */
|
|
UINT32 * actmetalength; /* actual length of metadata */
|
|
UINT8 * metadata; /* pointer to metadata buffer */
|
|
};
|
|
|
|
|
|
/* opaque state */
|
|
struct avcomp_state;
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
PROTOTYPES
|
|
***************************************************************************/
|
|
|
|
avcomp_state *avcomp_init(UINT32 maxwidth, UINT32 maxheight, UINT32 maxchannels);
|
|
void avcomp_free(avcomp_state *state);
|
|
|
|
void avcomp_config_compress(avcomp_state *state, av_codec_compress_config *config);
|
|
void avcomp_config_decompress(avcomp_state *state, av_codec_decompress_config *config);
|
|
|
|
avcomp_error avcomp_encode_data(avcomp_state *state, const UINT8 *source, UINT8 *dest, UINT32 *complength);
|
|
avcomp_error avcomp_decode_data(avcomp_state *state, const UINT8 *source, UINT32 complength, UINT8 *dest);
|
|
|
|
#endif
|