FastLED 3.9.15
Loading...
Searching...
No Matches
fl::third_party Namespace Reference

Namespaces

namespace  fl
 
namespace  hexwave
 
namespace  truetype
 
namespace  vorbis
 

Classes

struct  _BitStreamInfo
 
struct  _BlockCount
 
struct  _DequantInfo
 
struct  _FrameHeader
 
struct  _HuffmanInfo
 
struct  _HuffTabLookup
 
struct  _IMDCTInfo
 
struct  _ScaleFactorInfo
 
struct  _ScaleFactorInfoSub
 
struct  _ScaleFactorJS
 
struct  _SFBandTable
 
struct  _SideInfo
 
struct  _SideInfoSub
 
struct  _SubbandInfo
 
struct  CriticalBandInfo
 
class  ezWS2812
 ezWS2812 SPI driver for WS2812 LEDs More...
 
class  ezWS2812gpio
 ezWS2812 GPIO driver for WS2812 LEDs More...
 
struct  GifBitmap
 
struct  JDEC
 
struct  JDEC_Progressive
 
struct  JRECT
 
struct  lzw_ctx
 LZW decompression context. More...
 
struct  lzw_read_ctx
 Context for reading LZW data. More...
 
struct  lzw_table_entry
 LZW table entry. More...
 
struct  Mp3Frame
 
class  Mp3HelixDecoder
 
class  Mp3StreamDecoderImpl
 
struct  Mpeg1Config
 
struct  nsgif
 GIF animation data. More...
 
struct  nsgif_bitmap_cb_vt
 Bitmap callbacks function table. More...
 
struct  nsgif_colour_layout
 Pixel format: colour component order. More...
 
struct  nsgif_frame
 GIF frame data. More...
 
struct  nsgif_frame_info
 Information about a GIF frame. More...
 
struct  nsgif_info
 Information about a GIF. More...
 
struct  nsgif_rect
 LibNSGIF rectangle structure. More...
 
struct  plm_audio_t
 
struct  plm_buffer_t
 
struct  plm_demux_t
 
struct  plm_frame_t
 
struct  plm_packet_t
 
struct  plm_plane_t
 
struct  plm_quantizer_spec_t
 
struct  plm_samples_t
 
struct  plm_t
 
struct  plm_video_motion_t
 
struct  plm_video_t
 
struct  plm_vlc_t
 
struct  plm_vlc_uint_t
 
class  SoftwareGifDecoder
 Software GIF decoder implementation using libnsgif. More...
 
class  SoftwareMpeg1Decoder
 
class  TJpg_Decoder
 
class  TJpgInstanceDecoder
 
struct  TJpgProgressiveConfig
 

Typedefs

typedef u16 accum124
 no direct ANSI counterpart. 12 bits int, 4 bits fraction
 
typedef u32 accum1616
 ANSI: signed _Accum. 16 bits int, 16 bits fraction.
 
typedef u16 accum88
 ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.
 
typedef int ARRAY3[3]
 
typedef struct fl::third_party::_BitStreamInfo BitStreamInfo
 
typedef struct fl::third_party::_BlockCount BlockCount
 
typedef struct fl::third_party::_DequantInfo DequantInfo
 
typedef u16 fract16
 ANSI: unsigned _Fract.
 
typedef u32 fract32
 ANSI: unsigned long _Fract. 32 bits int, 32 bits fraction.
 
typedef u8 fract8
 Fixed-Point Fractional Types.
 
typedef struct fl::third_party::_FrameHeader FrameHeader
 
typedef struct fl::third_party::_HuffmanInfo HuffmanInfo
 
typedef struct fl::third_party::_HuffTabLookup HuffTabLookup
 
typedef enum fl::third_party::_HuffTabType HuffTabType
 
typedef fl::i64 i64
 
typedef struct fl::third_party::_IMDCTInfo IMDCTInfo
 
typedef fl::i16 int16_t
 
typedef fl::i32 int32_t
 
typedef signed char int8_t
 
typedef fl::iptr intptr_t
 
typedef uint8_t jd_yuv_t
 
typedef struct JDEC JDEC
 
typedef enum fl::third_party::lzw_result lzw_result
 LZW decoding response codes.
 
typedef fl::u32(* lzw_writer_fn) (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_pos, fl::u16 code, fl::u16 left)
 
typedef struct fl::third_party::nsgif_bitmap_cb_vt nsgif_bitmap_cb_vt
 Bitmap callbacks function table.
 
typedef enum fl::third_party::nsgif_bitmap_fmt nsgif_bitmap_fmt_t
 NSGIF nsgif_bitmap_t pixel format.
 
typedef void nsgif_bitmap_t
 Client bitmap type.
 
typedef struct fl::third_party::nsgif_frame nsgif_frame
 GIF frame data.
 
typedef struct fl::third_party::nsgif_frame_info nsgif_frame_info_t
 Information about a GIF frame.
 
typedef struct fl::third_party::nsgif_info nsgif_info_t
 Information about a GIF.
 
typedef struct fl::third_party::nsgif_rect nsgif_rect_t
 LibNSGIF rectangle structure.
 
typedef struct nsgif nsgif_t
 Opaque type used by LibNSGIF to represent a GIF object in memory.
 
typedef void(* plm_audio_decode_callback) (plm_t *self, plm_samples_t *samples, void *user)
 
typedef struct plm_audio_t plm_audio_t
 
typedef void(* plm_buffer_load_callback) (plm_buffer_t *self, void *user)
 
typedef void(* plm_buffer_seek_callback) (plm_buffer_t *self, size_t offset, void *user)
 
typedef struct plm_buffer_t plm_buffer_t
 
typedef size_t(* plm_buffer_tell_callback) (plm_buffer_t *self, void *user)
 
typedef struct plm_demux_t plm_demux_t
 
typedef struct fl::third_party::plm_quantizer_spec_t plm_quantizer_spec_t
 
typedef struct plm_t plm_t
 
typedef void(* plm_video_decode_callback) (plm_t *self, plm_frame_t *frame, void *user)
 
typedef struct plm_video_t plm_video_t
 
typedef fl::ptrdiff ptrdiff_t
 
typedef i32 saccum114
 no direct ANSI counterpart. 1 bit int, 14 bits fraction
 
typedef i32 saccum1516
 ANSI: signed _Accum. 15 bits int, 16 bits fraction.
 
typedef i16 saccum78
 ANSI: signed short _Accum. 7 bits int, 8 bits fraction.
 
typedef struct fl::third_party::_ScaleFactorInfo ScaleFactorInfo
 
typedef struct fl::third_party::_ScaleFactorInfoSub ScaleFactorInfoSub
 
typedef struct fl::third_party::_ScaleFactorJS ScaleFactorJS
 
typedef struct fl::third_party::_SFBandTable SFBandTable
 
typedef i16 sfract15
 ANSI: signed _Fract.
 
typedef i32 sfract31
 ANSI: signed long _Fract. 31 bits int, 1 bit fraction.
 
typedef i8 sfract7
 ANSI: signed short _Fract.
 
typedef struct fl::third_party::_SideInfo SideInfo
 
typedef struct fl::third_party::_SideInfoSub SideInfoSub
 
typedef fl::size size_t
 
typedef bool(* SketchCallback) (int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t *data)
 
typedef struct fl::third_party::_SubbandInfo SubbandInfo
 
using TJpgInstanceDecoderPtr = fl::shared_ptr<TJpgInstanceDecoder>
 
typedef fl::u64 u64
 
typedef fl::u16 uint16_t
 
typedef fl::u32 uint32_t
 
typedef unsigned char uint8_t
 
typedef fl::uptr uintptr_t
 
typedef long long Word64
 

Enumerations

enum  { JDR_SUSPEND = 9 }
 
enum  { TJPG_ARRAY = 0 }
 
enum  _HuffTabType {
  noBits , oneShot , loopNoLinbits , loopLinbits ,
  quadA , quadB , invalidTab
}
 
enum  JRESULT {
  JDR_OK = 0 , JDR_INTR , JDR_INP , JDR_MEM1 ,
  JDR_MEM2 , JDR_PAR , JDR_FMT1 , JDR_FMT2 ,
  JDR_FMT3
}
 
enum  lzw_result {
  LZW_OK , LZW_OK_EOD , LZW_NO_MEM , LZW_NO_DATA ,
  LZW_EOI_CODE , LZW_NO_COLOUR , LZW_BAD_ICODE , LZW_BAD_PARAM ,
  LZW_BAD_CODE
}
 LZW decoding response codes. More...
 
enum  nsgif_bitmap_fmt {
  NSGIF_BITMAP_FMT_R8G8B8A8 , NSGIF_BITMAP_FMT_B8G8R8A8 , NSGIF_BITMAP_FMT_A8R8G8B8 , NSGIF_BITMAP_FMT_A8B8G8R8 ,
  NSGIF_BITMAP_FMT_RGBA8888 , NSGIF_BITMAP_FMT_BGRA8888 , NSGIF_BITMAP_FMT_ARGB8888 , NSGIF_BITMAP_FMT_ABGR8888
}
 NSGIF nsgif_bitmap_t pixel format. More...
 
enum  nsgif_disposal {
  NSGIF_DISPOSAL_UNSPECIFIED , NSGIF_DISPOSAL_NONE , NSGIF_DISPOSAL_RESTORE_BG , NSGIF_DISPOSAL_RESTORE_PREV ,
  NSGIF_DISPOSAL_RESTORE_QUIRK
}
 Frame disposal method. More...
 
enum  nsgif_error {
  NSGIF_OK , NSGIF_ERR_OOM , NSGIF_ERR_DATA , NSGIF_ERR_BAD_FRAME ,
  NSGIF_ERR_DATA_FRAME , NSGIF_ERR_END_OF_DATA , NSGIF_ERR_DATA_COMPLETE , NSGIF_ERR_FRAME_DISPLAY ,
  NSGIF_ERR_ANIMATION_END
}
 LibNSGIF return codes. More...
 
enum  plm_buffer_mode { PLM_BUFFER_MODE_FILE , PLM_BUFFER_MODE_FIXED_MEM , PLM_BUFFER_MODE_RING , PLM_BUFFER_MODE_APPEND }
 

Functions

static void * alloc_pool (JDEC *jd, size_t ndata) FL_NOEXCEPT
 
MP3DecInfoAllocateBuffers (void) FL_NOEXCEPT
 
static void AntiAlias (int32_t *x, int32_t nBfly) FL_NOEXCEPT
 
static int bitext (JDEC *jd, unsigned int nbit) FL_NOEXCEPT
 
static void block_idct (int32_t *src, jd_yuv_t *dst) FL_NOEXCEPT
 
static uint8_t BYTECLIP (int val) FL_NOEXCEPT
 
int32_t CalcBitsUsed (BitStreamInfo *bsi, const unsigned char *startBuf, int32_t startOffset) FL_NOEXCEPT
 
int CheckPadBit (MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
 
static void ClearBuffer (void *buf, int nBytes) FL_NOEXCEPT
 
static __inline short ClipToShort (int x, int fracBits) FL_NOEXCEPT
 
__inline int32_t CLZ (int32_t x) FL_NOEXCEPT
 Leading zeros.
 
static JRESULT create_huffman_tbl (JDEC *jd, const uint8_t *data, size_t ndata) FL_NOEXCEPT
 
static JRESULT create_qt_tbl (JDEC *jd, const uint8_t *data, size_t ndata) FL_NOEXCEPT
 
TJpgInstanceDecoderPtr createTJpgInstanceDecoder () FL_NOEXCEPT
 
int DecodeHuffman (MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) FL_NOEXCEPT
 
static int DecodeHuffmanPairs (int32_t *xy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) FL_NOEXCEPT
 
static int DecodeHuffmanQuads (int32_t *vwxy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) FL_NOEXCEPT
 
static int DequantBlock (int32_t *inbuf, int32_t *outbuf, int num, int scale) FL_NOEXCEPT
 
int32_t DequantChannel (int32_t *sampleBuf, int32_t *workBuf, int32_t *nonZeroBound, FrameHeader *fh, SideInfoSub *sis, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi) FL_NOEXCEPT
 
int Dequantize (MP3DecInfo *mp3DecInfo, int gr) FL_NOEXCEPT
 
__inline int32_t FASTABS (int32_t x) FL_NOEXCEPT
 Absolute value of x.
 
void FDCT32 (int32_t *x, int32_t *d, int32_t offset, int32_t oddBlock, int32_t gb) FL_NOEXCEPT
 
void FreeBuffers (MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
 
static int32_t FreqInvertRescale (int32_t *y, int32_t *xPrev, int32_t blockIdx, int32_t es) FL_NOEXCEPT
 
uint32_t GetBits (BitStreamInfo *bsi, int32_t nBits) FL_NOEXCEPT
 
static fl::u32 gif__clip (fl::u32 frame_off, fl::u32 frame_dim, fl::u32 image_ext) FL_NOEXCEPT
 Get any frame clip adjustment for the image extent.
 
static void gif__jump_data (fl::u32 *skip, fl::u32 *available, const fl::u8 **pos) FL_NOEXCEPT
 Perform any jump over decoded data, to accommodate clipped portion of frame.
 
static int huffext (JDEC *jd, unsigned int id, unsigned int cls) FL_NOEXCEPT
 
static int32_t HybridTransform (int32_t *xCurr, int32_t *xPrev, int32_t y[BLOCK_SIZE][NBANDS], SideInfoSub *sis, BlockCount *bc) FL_NOEXCEPT
 
static __inline void idct9 (int32_t *x) FL_NOEXCEPT
 
int IMDCT (MP3DecInfo *mp3DecInfo, int gr, int ch) FL_NOEXCEPT
 
int32_t IMDCT (MP3DecInfo *mp3DecInfo, int32_t gr, int32_t ch) FL_NOEXCEPT
 
static __inline void imdct12 (int32_t *x, int32_t *out) FL_NOEXCEPT
 
static int32_t IMDCT12x3 (int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
 
static int32_t IMDCT36 (int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btCurr, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
 
void IntensityProcMPEG1 (int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi, int32_t midSideFlag, int32_t mixFlag, int32_t mOut[2]) FL_NOEXCEPT
 
void IntensityProcMPEG2 (int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi, ScaleFactorJS *sfjs, int32_t midSideFlag, int32_t mixFlag, int32_t mOut[2]) FL_NOEXCEPT
 
JRESULT jd_decomp (JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale) FL_NOEXCEPT
 
JRESULT jd_decomp_progressive (JDEC_Progressive *jpd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale, uint16_t max_mcus_per_call, uint8_t *more_data_needed, uint8_t *processing_complete) FL_NOEXCEPT
 
JRESULT jd_prepare (JDEC *jd, size_t(*infunc)(JDEC *, uint8_t *, size_t), void *pool, size_t sz_pool, void *dev) FL_NOEXCEPT
 
static lzw_result lzw__block_advance (struct lzw_read_ctx *ctx) FL_NOEXCEPT
 Advance the context to the next sub-block in the input data.
 
static lzw_result lzw__decode (struct lzw_ctx *ctx, lzw_writer_fn write_fn, void *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
 Get the next LZW code and write its value(s) to output buffer.
 
static lzw_result lzw__handle_clear (struct lzw_ctx *ctx, fl::u16 *code_out) FL_NOEXCEPT
 Handle clear code.
 
static fl::u32 lzw__map_write_fn (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
 Write colour mapped values for this code to the output.
 
static lzw_result lzw__read_code (struct lzw_read_ctx *ctx, fl::u16 code_size, fl::u16 *code_out) FL_NOEXCEPT
 Get the next LZW code of given size from the raw input data.
 
static void lzw__table_add_entry (struct lzw_ctx *ctx, fl::u16 code) FL_NOEXCEPT
 Create new table entry.
 
static fl::u32 lzw__write_fn (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
 Write values for this code to the output stack.
 
lzw_result lzw_context_create (struct lzw_ctx **ctx) FL_NOEXCEPT
 Create an LZW decompression context.
 
void lzw_context_destroy (struct lzw_ctx *ctx) FL_NOEXCEPT
 Destroy an LZW decompression context.
 
lzw_result lzw_decode (struct lzw_ctx *ctx, const fl::u8 **const output_data, fl::u32 *output_written) FL_NOEXCEPT
 Read input codes until end of LZW context owned output buffer.
 
lzw_result lzw_decode_init (struct lzw_ctx *ctx, fl::u8 minimum_code_size, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
 Initialise an LZW decompression context for decoding.
 
lzw_result lzw_decode_init_map (struct lzw_ctx *ctx, fl::u8 minimum_code_size, fl::u32 transparency_idx, const fl::u32 *colour_table, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
 Initialise an LZW decompression context for decoding to colour map values.
 
lzw_result lzw_decode_map (struct lzw_ctx *ctx, fl::u32 *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
 Read LZW codes into client buffer, mapping output to colours.
 
__inline Word64 MADD64 (Word64 sum64, int x, int y) FL_NOEXCEPT
 Increase sum by x * y.
 
static JRESULT mcu_load (JDEC *jd) FL_NOEXCEPT
 
static JRESULT mcu_output (JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), unsigned int x, unsigned int y) FL_NOEXCEPT
 
void MidSideProc (int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, int32_t mOut[2]) FL_NOEXCEPT
 
static void MP3ClearBadFrame (MP3DecInfo *mp3DecInfo, short *outbuf) FL_NOEXCEPT
 
int MP3Decode (HMP3Decoder hMP3Decoder, const unsigned char **inbuf, size_t *bytesLeft, short *outbuf, int useSize) FL_NOEXCEPT
 
static int MP3FindFreeSync (const unsigned char *buf, const unsigned char firstFH[4], int nBytes) FL_NOEXCEPT
 
int MP3FindSyncWord (const unsigned char *buf, int nBytes) FL_NOEXCEPT
 
void MP3FreeDecoder (HMP3Decoder hMP3Decoder) FL_NOEXCEPT
 
void MP3GetLastFrameInfo (HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo) FL_NOEXCEPT
 
int MP3GetNextFrameInfo (HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, unsigned char *buf) FL_NOEXCEPT
 
HMP3Decoder MP3InitDecoder (void) FL_NOEXCEPT
 
__inline int32_t MULSHIFT32 (int32_t x, int32_t y) FL_NOEXCEPT
 Multiply together two 32-bit numbers and return the top 32-bits of the result.
 
static bool nsgif__animation_complete (int count, int max) FL_NOEXCEPT
 
static bool nsgif__app_ext_is_loop_count (const fl::u8 *data, fl::size len) FL_NOEXCEPT
 Check an app ext identifier and authentication code for loop count extension.
 
static struct nsgif_colour_layout nsgif__bitmap_fmt_to_colour_layout (nsgif_bitmap_fmt_t bitmap_fmt) FL_NOEXCEPT
 
static fl::u32 * nsgif__bitmap_get (struct nsgif *gif) FL_NOEXCEPT
 Helper to get the rendering bitmap for a gif.
 
static bool nsgif__bitmap_get_opaque (const struct nsgif *gif) FL_NOEXCEPT
 Helper to get the client to determine if the bitmap is opaque.
 
static void nsgif__bitmap_modified (const struct nsgif *gif) FL_NOEXCEPT
 Helper to tell the client that their bitmap was modified.
 
static void nsgif__bitmap_set_opaque (const struct nsgif *gif, const struct nsgif_frame *frame) FL_NOEXCEPT
 Helper to tell the client that whether the bitmap is opaque.
 
static void nsgif__colour_table_decode (fl::u32 colour_table[NSGIF_MAX_COLOURS], const struct nsgif_colour_layout *layout, fl::size colour_table_entries, const fl::u8 *data) FL_NOEXCEPT
 Extract a GIF colour table into a LibNSGIF colour table buffer.
 
static nsgif_error nsgif__colour_table_extract (fl::u32 colour_table[NSGIF_MAX_COLOURS], const struct nsgif_colour_layout *layout, fl::size colour_table_entries, const fl::u8 *data, fl::size data_len, fl::size *used, bool decode) FL_NOEXCEPT
 Extract a GIF colour table into a LibNSGIF colour table buffer.
 
static nsgif_error nsgif__decode (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 *data, fl::u32 *frame_data) FL_NOEXCEPT
 
static nsgif_error nsgif__decode_complex (struct nsgif *gif, fl::u32 width, fl::u32 height, fl::u32 offset_x, fl::u32 offset_y, fl::u32 interlace, const fl::u8 *data, fl::u32 transparency_index, fl::u32 *frame_data, fl::u32 *colour_table) FL_NOEXCEPT
 
static nsgif_error nsgif__decode_simple (struct nsgif *gif, fl::u32 height, fl::u32 offset_y, const fl::u8 *data, fl::u32 transparency_index, fl::u32 *frame_data, fl::u32 *colour_table) FL_NOEXCEPT
 
static bool nsgif__deinterlace (fl::u32 height, fl::u32 *y, fl::u8 *step) FL_NOEXCEPT
 Get the next line for GIF decode.
 
static nsgif_error nsgif__error_from_lzw (lzw_result l_res) FL_NOEXCEPT
 Convert an LZW result code to equivalent GIF result code.
 
static fl::u32 nsgif__frame_next (const nsgif_t *gif, bool partial, fl::u32 frame) FL_NOEXCEPT
 
static struct nsgif_framensgif__get_frame (struct nsgif *gif, fl::u32 frame_idx) FL_NOEXCEPT
 
static bool nsgif__host_is_little_endian (void) FL_NOEXCEPT
 Check whether the host is little endian.
 
static nsgif_error nsgif__initialise_sprite (struct nsgif *gif, fl::u32 width, fl::u32 height) FL_NOEXCEPT
 Updates the sprite memory size.
 
static nsgif_error nsgif__next_displayable_frame (const nsgif_t *gif, fl::u32 *frame, fl::u32 *delay) FL_NOEXCEPT
 
static bool nsgif__next_row (fl::u32 interlace, fl::u32 height, fl::u32 *y, fl::u8 *step) FL_NOEXCEPT
 Get the next line for GIF decode.
 
static nsgif_error nsgif__parse_colour_table (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
 Get a frame's colour table.
 
static nsgif_error nsgif__parse_extension_application (struct nsgif *gif, const fl::u8 *data, fl::size len) FL_NOEXCEPT
 Parse the application extension.
 
static nsgif_error nsgif__parse_extension_graphic_control (struct nsgif_frame *frame, const fl::u8 *data, fl::size len) FL_NOEXCEPT
 Parse the graphic control extension.
 
static nsgif_error nsgif__parse_frame_extensions (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
 Parse the frame's extensions.
 
static nsgif_error nsgif__parse_header (struct nsgif *gif, const fl::u8 **pos, bool strict) FL_NOEXCEPT
 Read GIF header.
 
static nsgif_error nsgif__parse_image_data (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
 Parse the image data for a gif frame.
 
static nsgif_error nsgif__parse_image_descriptor (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
 Parse a GIF Image Descriptor.
 
static nsgif_error nsgif__parse_logical_screen_descriptor (struct nsgif *gif, const fl::u8 **pos) FL_NOEXCEPT
 Read Logical Screen Descriptor.
 
static nsgif_error nsgif__process_frame (struct nsgif *gif, fl::u32 frame_idx, bool decode) FL_NOEXCEPT
 Attempts to initialise the next frame.
 
static void nsgif__record_frame (struct nsgif *gif, const fl::u32 *bitmap) FL_NOEXCEPT
 
static nsgif_error nsgif__recover_frame (const struct nsgif *gif, fl::u32 *bitmap) FL_NOEXCEPT
 
static void nsgif__redraw_rect_extend (const nsgif_rect_t *frame, nsgif_rect_t *redraw) FL_NOEXCEPT
 
static void nsgif__restore_bg (struct nsgif *gif, struct nsgif_frame *frame, fl::u32 *bitmap) FL_NOEXCEPT
 Restore a GIF to the background colour.
 
static nsgif_error nsgif__update_bitmap (struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 *data, fl::u32 frame_idx) FL_NOEXCEPT
 
nsgif_error nsgif_create (const nsgif_bitmap_cb_vt *bitmap_vt, nsgif_bitmap_fmt_t bitmap_fmt, nsgif_t **gif_out) FL_NOEXCEPT
 Create the NSGIF object.
 
void nsgif_data_complete (nsgif_t *gif) FL_NOEXCEPT
 Tell libnsgif that all the gif data has been provided.
 
nsgif_error nsgif_data_scan (nsgif_t *gif, fl::size size, const fl::u8 *data) FL_NOEXCEPT
 Scan the source image data.
 
void nsgif_destroy (nsgif_t *gif) FL_NOEXCEPT
 Free a NSGIF object.
 
nsgif_error nsgif_frame_decode (nsgif_t *gif, fl::u32 frame, nsgif_bitmap_t **bitmap) FL_NOEXCEPT
 Decodes a GIF frame.
 
nsgif_error nsgif_frame_prepare (nsgif_t *gif, nsgif_rect_t *area, fl::u32 *delay_cs, fl::u32 *frame_new) FL_NOEXCEPT
 Prepare to show a frame.
 
const nsgif_frame_info_tnsgif_get_frame_info (const nsgif_t *gif, fl::u32 frame) FL_NOEXCEPT
 Get information about a GIF from an nsgif_t object.
 
const nsgif_info_tnsgif_get_info (const nsgif_t *gif) FL_NOEXCEPT
 Get information about a GIF from an nsgif_t object.
 
void nsgif_global_palette (const nsgif_t *gif, fl::u32 table[NSGIF_MAX_COLOURS], fl::size *entries) FL_NOEXCEPT
 Get the global colour palette.
 
bool nsgif_local_palette (const nsgif_t *gif, fl::u32 frame, fl::u32 table[NSGIF_MAX_COLOURS], fl::size *entries) FL_NOEXCEPT
 Get the local colour palette for a frame.
 
nsgif_error nsgif_reset (nsgif_t *gif) FL_NOEXCEPT
 Reset a GIF animation.
 
void nsgif_set_frame_delay_behaviour (nsgif_t *gif, fl::u16 delay_min, fl::u16 delay_default) FL_NOEXCEPT
 Configure handling of small frame delays.
 
const char * nsgif_str_disposal (enum nsgif_disposal disposal) FL_NOEXCEPT
 Convert a disposal method to a string.
 
const char * nsgif_strerror (nsgif_error err) FL_NOEXCEPT
 Convert an error code to a string.
 
plm_audio_tplm_audio_create_with_buffer (plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
 
plm_samples_tplm_audio_decode (plm_audio_t *self) FL_NOEXCEPT
 
void plm_audio_decode_frame (plm_audio_t *self) FL_NOEXCEPT
 
int plm_audio_decode_header (plm_audio_t *self) FL_NOEXCEPT
 
void plm_audio_destroy (plm_audio_t *self) FL_NOEXCEPT
 
int plm_audio_find_frame_sync (plm_audio_t *self) FL_NOEXCEPT
 
int plm_audio_get_samplerate (plm_audio_t *self) FL_NOEXCEPT
 
double plm_audio_get_time (plm_audio_t *self) FL_NOEXCEPT
 
int plm_audio_has_ended (plm_audio_t *self) FL_NOEXCEPT
 
int plm_audio_has_header (plm_audio_t *self) FL_NOEXCEPT
 
void plm_audio_idct36 (int s[32][3], int ss, float *d, int dp) FL_NOEXCEPT
 
const plm_quantizer_spec_tplm_audio_read_allocation (plm_audio_t *self, int sb, int tab3) FL_NOEXCEPT
 
void plm_audio_read_samples (plm_audio_t *self, int ch, int sb, int part) FL_NOEXCEPT
 
void plm_audio_rewind (plm_audio_t *self) FL_NOEXCEPT
 
void plm_audio_set_time (plm_audio_t *self, double time) FL_NOEXCEPT
 
void plm_buffer_align (plm_buffer_t *self) FL_NOEXCEPT
 
plm_buffer_tplm_buffer_create_for_appending (size_t initial_capacity) FL_NOEXCEPT
 
plm_buffer_tplm_buffer_create_with_callbacks (plm_buffer_load_callback load_callback, plm_buffer_seek_callback seek_callback, plm_buffer_tell_callback tell_callback, size_t length, void *user) FL_NOEXCEPT
 
plm_buffer_tplm_buffer_create_with_capacity (size_t capacity) FL_NOEXCEPT
 
plm_buffer_tplm_buffer_create_with_memory (uint8_t *bytes, size_t length, int free_when_done) FL_NOEXCEPT
 
void plm_buffer_destroy (plm_buffer_t *self) FL_NOEXCEPT
 
void plm_buffer_discard_read_bytes (plm_buffer_t *self) FL_NOEXCEPT
 
int plm_buffer_find_start_code (plm_buffer_t *self, int code) FL_NOEXCEPT
 
size_t plm_buffer_get_remaining (plm_buffer_t *self) FL_NOEXCEPT
 
size_t plm_buffer_get_size (plm_buffer_t *self) FL_NOEXCEPT
 
int plm_buffer_has (plm_buffer_t *self, size_t count) FL_NOEXCEPT
 
int plm_buffer_has_ended (plm_buffer_t *self) FL_NOEXCEPT
 
int plm_buffer_has_start_code (plm_buffer_t *self, int code) FL_NOEXCEPT
 
int plm_buffer_next_start_code (plm_buffer_t *self) FL_NOEXCEPT
 
int plm_buffer_no_start_code (plm_buffer_t *self) FL_NOEXCEPT
 
int plm_buffer_peek_non_zero (plm_buffer_t *self, int bit_count) FL_NOEXCEPT
 
int plm_buffer_read (plm_buffer_t *self, int count) FL_NOEXCEPT
 
int16_t plm_buffer_read_vlc (plm_buffer_t *self, const plm_vlc_t *table) FL_NOEXCEPT
 
uint16_t plm_buffer_read_vlc_uint (plm_buffer_t *self, const plm_vlc_uint_t *table) FL_NOEXCEPT
 
void plm_buffer_rewind (plm_buffer_t *self) FL_NOEXCEPT
 
void plm_buffer_seek (plm_buffer_t *self, size_t pos) FL_NOEXCEPT
 
void plm_buffer_set_load_callback (plm_buffer_t *self, plm_buffer_load_callback fp, void *user) FL_NOEXCEPT
 
void plm_buffer_signal_end (plm_buffer_t *self) FL_NOEXCEPT
 
void plm_buffer_skip (plm_buffer_t *self, size_t count) FL_NOEXCEPT
 
int plm_buffer_skip_bytes (plm_buffer_t *self, uint8_t v) FL_NOEXCEPT
 
size_t plm_buffer_tell (plm_buffer_t *self) FL_NOEXCEPT
 
size_t plm_buffer_write (plm_buffer_t *self, uint8_t *bytes, size_t length) FL_NOEXCEPT
 
static uint8_t plm_clamp (int n) FL_NOEXCEPT
 
plm_tplm_create_with_buffer (plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
 
plm_tplm_create_with_memory (uint8_t *bytes, size_t length, int free_when_done) FL_NOEXCEPT
 
void plm_decode (plm_t *self, double seconds) FL_NOEXCEPT
 
plm_samples_tplm_decode_audio (plm_t *self) FL_NOEXCEPT
 
plm_frame_tplm_decode_video (plm_t *self) FL_NOEXCEPT
 
 PLM_DEFINE_FRAME_CONVERT_FUNCTION (plm_frame_to_argb, 4, 1, 2, 3) PLM_DEFINE_FRAME_CONVERT_FUNCTION(plm_frame_to_abgr
 
 PLM_DEFINE_FRAME_CONVERT_FUNCTION (plm_frame_to_rgb, 3, 0, 1, 2) PLM_DEFINE_FRAME_CONVERT_FUNCTION(plm_frame_to_bgr
 
 PLM_DEFINE_FRAME_CONVERT_FUNCTION (plm_frame_to_rgba, 4, 0, 1, 2) PLM_DEFINE_FRAME_CONVERT_FUNCTION(plm_frame_to_bgra
 
void plm_demux_buffer_seek (plm_demux_t *self, size_t pos) FL_NOEXCEPT
 
plm_demux_tplm_demux_create (plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
 
plm_packet_tplm_demux_decode (plm_demux_t *self) FL_NOEXCEPT
 
plm_packet_tplm_demux_decode_packet (plm_demux_t *self, int type) FL_NOEXCEPT
 
double plm_demux_decode_time (plm_demux_t *self) FL_NOEXCEPT
 
void plm_demux_destroy (plm_demux_t *self) FL_NOEXCEPT
 
double plm_demux_get_duration (plm_demux_t *self, int type) FL_NOEXCEPT
 
int plm_demux_get_num_audio_streams (plm_demux_t *self) FL_NOEXCEPT
 
int plm_demux_get_num_video_streams (plm_demux_t *self) FL_NOEXCEPT
 
plm_packet_tplm_demux_get_packet (plm_demux_t *self) FL_NOEXCEPT
 
double plm_demux_get_start_time (plm_demux_t *self, int type) FL_NOEXCEPT
 
int plm_demux_has_ended (plm_demux_t *self) FL_NOEXCEPT
 
int plm_demux_has_headers (plm_demux_t *self) FL_NOEXCEPT
 
int plm_demux_probe (plm_demux_t *self, size_t probesize) FL_NOEXCEPT
 
void plm_demux_rewind (plm_demux_t *self) FL_NOEXCEPT
 
plm_packet_tplm_demux_seek (plm_demux_t *self, double time, int type, int force_intra) FL_NOEXCEPT
 
void plm_destroy (plm_t *self) FL_NOEXCEPT
 
void plm_frame_to_abgr (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
void plm_frame_to_argb (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
void plm_frame_to_bgr (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
void plm_frame_to_bgra (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
void plm_frame_to_rgb (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
void plm_frame_to_rgba (plm_frame_t *frame, uint8_t *dest, int stride) FL_NOEXCEPT
 
int plm_get_audio_enabled (plm_t *self) FL_NOEXCEPT
 
double plm_get_audio_lead_time (plm_t *self) FL_NOEXCEPT
 
double plm_get_duration (plm_t *self) FL_NOEXCEPT
 
double plm_get_framerate (plm_t *self) FL_NOEXCEPT
 
int plm_get_height (plm_t *self) FL_NOEXCEPT
 
int plm_get_loop (plm_t *self) FL_NOEXCEPT
 
int plm_get_num_audio_streams (plm_t *self) FL_NOEXCEPT
 
int plm_get_num_video_streams (plm_t *self) FL_NOEXCEPT
 
double plm_get_pixel_aspect_ratio (plm_t *self) FL_NOEXCEPT
 
int plm_get_samplerate (plm_t *self) FL_NOEXCEPT
 
double plm_get_time (plm_t *self) FL_NOEXCEPT
 
int plm_get_video_enabled (plm_t *self) FL_NOEXCEPT
 
int plm_get_width (plm_t *self) FL_NOEXCEPT
 
void plm_handle_end (plm_t *self) FL_NOEXCEPT
 
int plm_has_ended (plm_t *self) FL_NOEXCEPT
 
int plm_has_headers (plm_t *self) FL_NOEXCEPT
 
int plm_init_decoders (plm_t *self) FL_NOEXCEPT
 
int plm_probe (plm_t *self, size_t probesize) FL_NOEXCEPT
 
void plm_read_audio_packet (plm_buffer_t *buffer, void *user) FL_NOEXCEPT
 
void plm_read_packets (plm_t *self, int requested_type) FL_NOEXCEPT
 
void plm_read_video_packet (plm_buffer_t *buffer, void *user) FL_NOEXCEPT
 
void plm_rewind (plm_t *self) FL_NOEXCEPT
 
int plm_seek (plm_t *self, double time, int seek_exact) FL_NOEXCEPT
 
plm_frame_tplm_seek_frame (plm_t *self, double time, int seek_exact) FL_NOEXCEPT
 
void plm_set_audio_decode_callback (plm_t *self, plm_audio_decode_callback fp, void *user) FL_NOEXCEPT
 
void plm_set_audio_enabled (plm_t *self, int enabled) FL_NOEXCEPT
 
void plm_set_audio_lead_time (plm_t *self, double lead_time) FL_NOEXCEPT
 
void plm_set_audio_stream (plm_t *self, int stream_index) FL_NOEXCEPT
 
void plm_set_loop (plm_t *self, int loop) FL_NOEXCEPT
 
void plm_set_video_decode_callback (plm_t *self, plm_video_decode_callback fp, void *user) FL_NOEXCEPT
 
void plm_set_video_enabled (plm_t *self, int enabled) FL_NOEXCEPT
 
void plm_video_copy_macroblock (plm_video_t *self, plm_frame_t *s, int motion_h, int motion_v) FL_NOEXCEPT
 
plm_video_tplm_video_create_with_buffer (plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
 
plm_frame_tplm_video_decode (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_decode_block (plm_video_t *self, int block) FL_NOEXCEPT
 
void plm_video_decode_macroblock (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_decode_motion_vector (plm_video_t *self, int r_size, int motion) FL_NOEXCEPT
 
void plm_video_decode_motion_vectors (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_decode_picture (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_decode_sequence_header (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_decode_slice (plm_video_t *self, int slice) FL_NOEXCEPT
 
void plm_video_destroy (plm_video_t *self) FL_NOEXCEPT
 
double plm_video_get_framerate (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_get_height (plm_video_t *self) FL_NOEXCEPT
 
double plm_video_get_pixel_aspect_ratio (plm_video_t *self) FL_NOEXCEPT
 
double plm_video_get_time (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_get_width (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_has_ended (plm_video_t *self) FL_NOEXCEPT
 
int plm_video_has_header (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_idct (int *block) FL_NOEXCEPT
 
void plm_video_init_frame (plm_video_t *self, plm_frame_t *frame, uint8_t *base) FL_NOEXCEPT
 
void plm_video_interpolate_macroblock (plm_video_t *self, plm_frame_t *s, int motion_h, int motion_v) FL_NOEXCEPT
 
void plm_video_predict_macroblock (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_process_macroblock (plm_video_t *self, uint8_t *s, uint8_t *d, int mh, int mb, int bs, int interp) FL_NOEXCEPT
 
void plm_video_rewind (plm_video_t *self) FL_NOEXCEPT
 
void plm_video_set_no_delay (plm_video_t *self, int no_delay) FL_NOEXCEPT
 
void plm_video_set_time (plm_video_t *self, double time) FL_NOEXCEPT
 
void PolyphaseMono (short *pcm, int32_t *vbuf, const int32_t *coefBase)
 
void PolyphaseStereo (short *pcm, int32_t *vbuf, const int32_t *coefBase)
 
static __inline void RefillBitstreamCache (BitStreamInfo *bsi) FL_NOEXCEPT
 
static JRESULT restart (JDEC *jd, uint16_t rstn) FL_NOEXCEPT
 
__inline Word64 SAR64 (Word64 x, int n) FL_NOEXCEPT
 Shift right.
 
void SetBitstreamPointer (BitStreamInfo *bsi, int32_t nBytes, const unsigned char *buf) FL_NOEXCEPT
 
__inline Word64 SHL64 (Word64 x, int n) FL_NOEXCEPT
 Shift left.
 
int Subband (MP3DecInfo *mp3DecInfo, short *pcmBuf) FL_NOEXCEPT
 
int UnpackFrameHeader (MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
 
int UnpackScaleFactors (MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) FL_NOEXCEPT
 
static void UnpackSFMPEG1 (BitStreamInfo *bsi, SideInfoSub *sis, ScaleFactorInfoSub *sfis, int32_t *scfsi, int gr, ScaleFactorInfoSub *sfisGr0) FL_NOEXCEPT
 
static void UnpackSFMPEG2 (BitStreamInfo *bsi, SideInfoSub *sis, ScaleFactorInfoSub *sfis, int gr, int ch, int modeExt, ScaleFactorJS *sfjs) FL_NOEXCEPT
 
int UnpackSideInfo (MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
 
static void WinPrevious (int32_t *xPrev, int32_t *xPrevWin, int32_t btPrev) FL_NOEXCEPT
 
static void yuv_to_rgb (const fl::third_party::plm_frame_t *frame, fl::u8 *rgb_buffer) FL_NOEXCEPT
 

Variables

const short bitrateTab [3][3][15]
 
const short bitsPerSlotTab [3] = {32, 8, 8}
 
static const int32_t c18 [9]
 
static int32_t c3_0 = static_cast<int32_t>(0x6ed9eba1U)
 
static int32_t c6 [3] = { static_cast<int32_t>(0x7ba3751dU), static_cast<int32_t>(0x5a82799aU), 0x2120fb83 }
 
static const int32_t c9_0 = static_cast<int32_t>(0x6ed9eba1U)
 
static const int32_t c9_1 = static_cast<int32_t>(0x620dbe8bU)
 
static const int32_t c9_2 = 0x163a1a7e
 
static const int32_t c9_3 = static_cast<int32_t>(0x5246dd49U)
 
static const int32_t c9_4 = static_cast<int32_t>(0x7e0e2e32U)
 
const int32_t coef32 [31]
 
const int32_t csa [8][2]
 
static const int32_t dcttab [48]
 
int32_t fastWin36 [18]
 
const unsigned short huffTable []
 
const HuffTabLookup huffTabLookup [HUFF_PAIRTABS]
 
const int32_t huffTabOffset [HUFF_PAIRTABS]
 
const int32_t imdctWin [4][36]
 
static const uint16_t Ipsf [64]
 
const int32_t ISFIIP [2][2]
 
const int32_t ISFMpeg1 [2][7]
 
const int32_t ISFMpeg2 [2][2][16]
 
constexpr fl::size MAX_PCM_SAMPLES = 2304
 
static const char NRTab [6][3][4]
 
static const short PLM_AUDIO_BIT_RATE []
 
static const int PLM_AUDIO_FRAME_SYNC = 0x7ff
 
static const int PLM_AUDIO_LAYER_I = 0x3
 
static const int PLM_AUDIO_LAYER_II = 0x2
 
static const int PLM_AUDIO_LAYER_III = 0x1
 
static const int PLM_AUDIO_MODE_DUAL_CHANNEL = 0x2
 
static const int PLM_AUDIO_MODE_JOINT_STEREO = 0x1
 
static const int PLM_AUDIO_MODE_MONO = 0x3
 
static const int PLM_AUDIO_MODE_STEREO = 0x0
 
static const int PLM_AUDIO_MPEG_1 = 0x3
 
static const int PLM_AUDIO_MPEG_2 = 0x2
 
static const int PLM_AUDIO_MPEG_2_5 = 0x0
 
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_1 [2][16]
 
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_3 [3][32]
 
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_4 [6][16]
 
static const plm_quantizer_spec_t PLM_AUDIO_QUANT_TAB []
 
static const unsigned short PLM_AUDIO_SAMPLE_RATE []
 
static const int32_t PLM_AUDIO_SCALEFACTOR_BASE []
 
static const float PLM_AUDIO_SYNTHESIS_WINDOW []
 
static const int PLM_DEMUX_PACKET_AUDIO_1 = 0xC0
 
static const int PLM_DEMUX_PACKET_AUDIO_2 = 0xC1
 
static const int PLM_DEMUX_PACKET_AUDIO_3 = 0xC2
 
static const int PLM_DEMUX_PACKET_AUDIO_4 = 0xC3
 
static const int PLM_DEMUX_PACKET_PRIVATE = 0xBD
 
static const int PLM_DEMUX_PACKET_VIDEO_1 = 0xE0
 
static const int PLM_START_END = 0xB9
 
static const int PLM_START_EXTENSION = 0xB5
 
static const int PLM_START_PACK = 0xBA
 
static const int PLM_START_PICTURE = 0x00
 
static const int PLM_START_SEQUENCE = 0xB3
 
static const int PLM_START_SLICE_FIRST = 0x01
 
static const int PLM_START_SLICE_LAST = 0xAF
 
static const int PLM_START_SYSTEM = 0xBB
 
static const int PLM_START_USER_DATA = 0xB2
 
static const plm_vlc_t PLM_VIDEO_CODE_BLOCK_PATTERN []
 
static const plm_vlc_uint_t PLM_VIDEO_DCT_COEFF []
 
static const plm_vlc_tPLM_VIDEO_DCT_SIZE []
 
static const plm_vlc_t PLM_VIDEO_DCT_SIZE_CHROMINANCE []
 
static const plm_vlc_t PLM_VIDEO_DCT_SIZE_LUMINANCE []
 
static const uint8_t PLM_VIDEO_INTRA_QUANT_MATRIX []
 
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_ADDRESS_INCREMENT []
 
static const plm_vlc_tPLM_VIDEO_MACROBLOCK_TYPE []
 
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_B []
 
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_INTRA []
 
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_PREDICTIVE []
 
static const plm_vlc_t PLM_VIDEO_MOTION []
 
static const uint8_t PLM_VIDEO_NON_INTRA_QUANT_MATRIX []
 
static const double PLM_VIDEO_PICTURE_RATE []
 
static const int PLM_VIDEO_PICTURE_TYPE_B = 3
 
static const int PLM_VIDEO_PICTURE_TYPE_INTRA = 1
 
static const int PLM_VIDEO_PICTURE_TYPE_PREDICTIVE = 2
 
static const float PLM_VIDEO_PIXEL_ASPECT_RATIO []
 
static const uint8_t PLM_VIDEO_PREMULTIPLIER_MATRIX []
 
static const uint8_t PLM_VIDEO_ZIG_ZAG []
 
int32_t poly43hi [5] = { (int32_t)0x10852163, (int32_t)0xd333f6a4, (int32_t)0x46e9408b, (int32_t)0x27c2cef0, (int32_t)0xfef577b4 }
 
int32_t poly43lo [5] = { (int32_t)0x29a0bda9, (int32_t)0xb02e4828, (int32_t)0x5957aa1b, (int32_t)0x236c498d, (int32_t)0xff581859 }
 
const int32_t polyCoef [264]
 
int32_t pow14 [4]
 
int pow2exp [8] = { 14, 13, 11, 10, 9, 7, 6, 5 }
 
int32_t pow2frac [8]
 
int32_t pow43 []
 
int32_t pow43_14 [4][16]
 
static const char preTab [22] = { 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0 }
 
const unsigned char quadTable [64+16]
 
const int32_t quadTabMaxBits [2] = {6, 4}
 
const int32_t quadTabOffset [2] = {0, 64}
 
static const uint8_t QUANT_LUT_STEP_2 [3][3]
 
const int32_t samplerateTab [3][3]
 
const short samplesPerFrameTab [3][3]
 
const SFBandTable sfBandTable [3][3]
 
static const char SFLenTab [16][2]
 
const short sideBytesTab [3][2]
 
const short slotTab [3][3][15]
 
const unsigned char uniqueIDTab [8] = {0x5f, 0x4b, 0x43, 0x5f, 0x5f, 0x4a, 0x52, 0x5f}
 
static const uint8_t Zig [64]
 

Generated during decode.

u16 table_size Next position in table to fill. u8 transparency_idx Index representing transparency.

◆ fl::third_party::lzw_read_ctx

struct fl::third_party::lzw_read_ctx
Class Members
const u8 * data Pointer to start of input data.
size data_len Input data length.
size data_sb_next Offset to sub-block size.
size sb_bit Current bit offset in sub-block.
u32 sb_bit_count Bit count in sub-block.
const u8 * sb_data Pointer to current sub-block in data.

◆ fl::third_party::lzw_table_entry

struct fl::third_party::lzw_table_entry
Class Members
u16 count Count of values in this entry's record.
u16 extends Offset in table to previous entry.
u8 first First value in entry's entire record.
u8 value Last value for record ending at entry.

◆ fl::third_party::Mp3Frame

struct fl::third_party::Mp3Frame
Class Members
int bitrate
int channels
int layer
const i16 * pcm
int sample_rate
int samples
int version

◆ fl::third_party::nsgif

struct fl::third_party::nsgif
+ Collaboration diagram for fl::third_party::nsgif:
Class Members
u32 aspect_ratio image aspect ratio (ignored)
u32 bg_index background index
nsgif_bitmap_cb_vt bitmap callbacks for bitmap functions
const u8 * buf pointer to GIF data
size buf_len total number of bytes of GIF data available
size buf_pos current index into GIF data
struct nsgif_colour_layout colour_layout Client's colour component order.
u32 * colour_table current colour table
u32 colour_table_size size of global colour table (in entries)
bool data_complete Whether all the GIF data has been supplied, or if there may be more to come.
u32 decoded_frame current frame decoded to bitmap
u16 delay_default Frame delay to apply when delay is less than delay_min.
u16 delay_min Minimum allowable frame delay.
u32 frame current frame
u32 frame_count_partial number of frames partially decoded
u32 frame_holders current number of frame holders
nsgif_bitmap_t * frame_image currently decoded image; stored as bitmap from bitmap_create callback
nsgif_frame * frames decoded frames
u32 global_colour_table[NSGIF_MAX_COLOURS] global colour table
struct nsgif_info info
u32 local_colour_table[NSGIF_MAX_COLOURS] local colour table
int loop_count number of animation loops so far
void * lzw_ctx LZW decode context.
void * prev_frame previous frame for NSGIF_FRAME_RESTORE
u32 prev_index previous frame index
u32 rowspan Row span of frame_image in pixels.

◆ fl::third_party::nsgif_bitmap_cb_vt

struct fl::third_party::nsgif_bitmap_cb_vt
Class Members
nsgif_bitmap_t *(*)(int width, int height) create Callback to create a bitmap with the given dimensions.
Parameters
[in]widthRequired bitmap width in pixels.
[in]heightRequired bitmap height in pixels.
Returns
pointer to client's bitmap structure or NULL on error.
void(*)(nsgif_bitmap_t *bitmap) destroy Callback to free a bitmap.
Parameters
[in]bitmapThe bitmap to destroy.
fl::u8 *(*)(nsgif_bitmap_t *bitmap) get_buffer Get pointer to pixel buffer in a bitmap.

The pixel buffer must be (width + N) * height * sizeof(fl::u32). Where N is any number greater than or equal to 0. Note that the returned pointer to fl::u8 must be 4-byte aligned.

Parameters
[in]bitmapThe bitmap.
Returns
pointer to bitmap's pixel buffer.
fl::u32(*)(nsgif_bitmap_t *bitmap) get_rowspan Get row span in pixels.

If this callback is not provided, LibNSGIF will use the width.

If row span is greater than width, this callback must be provided.

Parameters
[in]bitmapThe bitmap.
void(*)(nsgif_bitmap_t *bitmap) modified Bitmap modified notification.
Parameters
[in]bitmapThe bitmap.
void(*)(nsgif_bitmap_t *bitmap, bool opaque) set_opaque Set whether a bitmap can be plotted opaque.
Parameters
[in]bitmapThe bitmap.
[in]opaqueWhether the current frame is opaque.
bool(*)(nsgif_bitmap_t *bitmap) test_opaque Tests whether a bitmap has an opaque alpha channel.
Parameters
[in]bitmapThe bitmap.
Returns
true if the bitmap is opaque, false otherwise.

◆ fl::third_party::nsgif_colour_layout

struct fl::third_party::nsgif_colour_layout
Class Members
u8 a Byte offset within pixel to alpha component.
u8 b Byte offset within pixel to blue component.
u8 g Byte offset within pixel to green component.
u8 r Byte offset within pixel to red component.

◆ fl::third_party::nsgif_frame

struct fl::third_party::nsgif_frame
+ Collaboration diagram for fl::third_party::nsgif_frame:
Class Members
u32 colour_table_offset offset to frame colour table
bool decoded whether the frame has previously been decoded.
u32 flags
size frame_offset offset (in bytes) to the GIF frame data
struct nsgif_frame_info info
u32 lzw_data_length Amount of LZW data found in scan.
bool opaque whether the frame is totally opaque
bool redraw_required whether a full image redraw is required
u32 transparency_index the index designating a transparent pixel

◆ fl::third_party::nsgif_frame_info

struct fl::third_party::nsgif_frame_info
+ Collaboration diagram for fl::third_party::nsgif_frame_info:
Class Members
u32 delay delay (in cs) before animating the frame
bool display whether the frame should be displayed/animated
u8 disposal Disposal method for previous frame; affects plotting.
bool interlaced whether the frame is interlaced
bool local_palette whether the frame has a local colour table
nsgif_rect_t rect Frame's redraw rectangle.
bool transparency whether the frame may have transparency

◆ fl::third_party::nsgif_info

struct fl::third_party::nsgif_info
Class Members
u32 background background colour in same pixel format as nsgif_bitmap_t.
u32 frame_count number of frames decoded
bool global_palette whether the GIF has a global colour table
u32 height height of GIF (may increase during decoding)
int loop_max number of times to play animation (zero means loop forever)
u32 width width of GIF (may increase during decoding)

◆ fl::third_party::nsgif_rect

struct fl::third_party::nsgif_rect
Class Members
u32 x0 x co-ordinate of redraw rectangle, left
u32 x1 x co-ordinate of redraw rectangle, right
u32 y0 y co-ordinate of redraw rectangle, top
u32 y1 y co-ordinate of redraw rectangle, bottom

◆ fl::third_party::plm_audio_t

struct fl::third_party::plm_audio_t
+ Collaboration diagram for fl::third_party::plm_audio_t:
Class Members
const plm_quantizer_spec_t * allocation[2][32]
int bitrate_index
int bound
plm_buffer_t * buffer
float D[1024]
int destroy_buffer_when_done
int has_header
int layer
int mode
int next_frame_data_size
int sample[2][32][3]
int samplerate_index
plm_samples_t samples
int samples_decoded
int scale_factor[2][32][3]
uint8_t scale_factor_info[2][32]
double time
float U[32]
float V[2][1024]
int v_pos
int version

◆ fl::third_party::plm_buffer_t

struct fl::third_party::plm_buffer_t
+ Collaboration diagram for fl::third_party::plm_buffer_t:
Class Members
size_t bit_index
uint8_t * bytes
size_t capacity
int discard_read_bytes
int free_when_done
int has_ended
size_t length
plm_buffer_load_callback load_callback
void * load_callback_user_data
enum plm_buffer_mode mode
plm_buffer_seek_callback seek_callback
plm_buffer_tell_callback tell_callback
size_t total_size

◆ fl::third_party::plm_demux_t

struct fl::third_party::plm_demux_t
+ Collaboration diagram for fl::third_party::plm_demux_t:
Class Members
plm_buffer_t * buffer
plm_packet_t current_packet
int destroy_buffer_when_done
double duration
int has_headers
int has_pack_header
int has_system_header
double last_decoded_pts
size_t last_file_size
plm_packet_t next_packet
int num_audio_streams
int num_video_streams
int start_code
double start_time
double system_clock_ref

◆ fl::third_party::plm_frame_t

struct fl::third_party::plm_frame_t
+ Collaboration diagram for fl::third_party::plm_frame_t:
Class Members
plm_plane_t cb
plm_plane_t cr
unsigned int height
double time
unsigned int width
plm_plane_t y

◆ fl::third_party::plm_packet_t

struct fl::third_party::plm_packet_t
Class Members
uint8_t * data
size_t length
double pts
int type

◆ fl::third_party::plm_plane_t

struct fl::third_party::plm_plane_t
Class Members
uint8_t * data
unsigned int height
unsigned int width

◆ fl::third_party::plm_quantizer_spec_t

struct fl::third_party::plm_quantizer_spec_t
Class Members
unsigned char bits
unsigned char group
unsigned short levels

◆ fl::third_party::plm_samples_t

struct fl::third_party::plm_samples_t
Class Members
unsigned int count
float interleaved[PLM_AUDIO_SAMPLES_PER_FRAME *2]
double time

◆ fl::third_party::plm_t

struct fl::third_party::plm_t
+ Collaboration diagram for fl::third_party::plm_t:
Class Members
plm_buffer_t * audio_buffer
plm_audio_decode_callback audio_decode_callback
void * audio_decode_callback_user_data
plm_audio_t * audio_decoder
int audio_enabled
double audio_lead_time
int audio_packet_type
int audio_stream_index
plm_demux_t * demux
int has_decoders
int has_ended
int loop
double time
plm_buffer_t * video_buffer
plm_video_decode_callback video_decode_callback
void * video_decode_callback_user_data
plm_video_t * video_decoder
int video_enabled
int video_packet_type

◆ fl::third_party::plm_video_motion_t

struct fl::third_party::plm_video_motion_t
Class Members
int full_px
int h
int is_set
int r_size
int v

◆ fl::third_party::plm_video_t

struct fl::third_party::plm_video_t
+ Collaboration diagram for fl::third_party::plm_video_t:
Class Members
int assume_no_b_frames
int block_data[64]
plm_buffer_t * buffer
int chroma_height
int chroma_width
int dc_predictor[3]
int destroy_buffer_when_done
plm_frame_t frame_backward
plm_frame_t frame_current
plm_frame_t frame_forward
double framerate
uint8_t * frames_data
int frames_decoded
int has_reference_frame
int has_sequence_header
int height
uint8_t intra_quant_matrix[64]
int luma_height
int luma_width
int macroblock_address
int macroblock_intra
int macroblock_type
int mb_col
int mb_height
int mb_row
int mb_size
int mb_width
plm_video_motion_t motion_backward
plm_video_motion_t motion_forward
uint8_t non_intra_quant_matrix[64]
int picture_type
double pixel_aspect_ratio
int quantizer_scale
int slice_begin
int start_code
double time
int width

◆ fl::third_party::plm_vlc_t

struct fl::third_party::plm_vlc_t
Class Members
int16_t index
int16_t value

◆ fl::third_party::plm_vlc_uint_t

struct fl::third_party::plm_vlc_uint_t
Class Members
int16_t index
uint16_t value

◆ fl::third_party::TJpgProgressiveConfig

struct fl::third_party::TJpgProgressiveConfig
Class Members
u16 max_mcus_per_tick = 16
u32 max_time_per_tick_ms = 4

Typedef Documentation

◆ accum124

typedef u16 fl::third_party::fl::accum124

no direct ANSI counterpart. 12 bits int, 4 bits fraction

Definition at line 186 of file coder.h.

◆ accum1616

typedef u32 fl::third_party::fl::accum1616

ANSI: signed _Accum. 16 bits int, 16 bits fraction.

Definition at line 184 of file coder.h.

◆ accum88

typedef u16 fl::third_party::fl::accum88

ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.

Definition at line 182 of file coder.h.

◆ ARRAY3

typedef int fl::third_party::ARRAY3[3]

Definition at line 55 of file dqchan.hpp.

◆ BitStreamInfo

typedef struct fl::third_party::_BitStreamInfo fl::third_party::BitStreamInfo

◆ BlockCount

typedef struct fl::third_party::_BlockCount fl::third_party::BlockCount

◆ DequantInfo

typedef struct fl::third_party::_DequantInfo fl::third_party::DequantInfo

◆ fract16

typedef u16 fl::third_party::fl::fract16

ANSI: unsigned _Fract.

Range is 0 to 0.99998474121 in steps of 0.00001525878. Should be interpreted as unsigned 65536ths.

Definition at line 171 of file coder.h.

◆ fract32

typedef u32 fl::third_party::fl::fract32

ANSI: unsigned long _Fract. 32 bits int, 32 bits fraction.

Definition at line 175 of file coder.h.

◆ fract8

typedef u8 fl::third_party::fl::fract8

Fixed-Point Fractional Types.

Types for storing fractional data.

Example: if a fract8 has the value "64", that should be interpreted as 64/256ths, or one-quarter.

accumXY types should be interpreted as X bits of integer, and Y bits of fraction. E.g., accum88 has 8 bits of int, 8 bits of fraction ANSI: unsigned short _Fract. Range is 0 to 0.99609375 in steps of 0.00390625. Should be interpreted as unsigned 256ths.

Definition at line 161 of file coder.h.

◆ FrameHeader

typedef struct fl::third_party::_FrameHeader fl::third_party::FrameHeader

◆ HuffmanInfo

typedef struct fl::third_party::_HuffmanInfo fl::third_party::HuffmanInfo

◆ HuffTabLookup

typedef struct fl::third_party::_HuffTabLookup fl::third_party::HuffTabLookup

◆ HuffTabType

typedef enum fl::third_party::_HuffTabType fl::third_party::HuffTabType

◆ i64

typedef fl::i64 fl::third_party::i64

Definition at line 222 of file coder.h.

◆ IMDCTInfo

typedef struct fl::third_party::_IMDCTInfo fl::third_party::IMDCTInfo

◆ int16_t

typedef fl::i16 fl::third_party::int16_t

Definition at line 215 of file coder.h.

◆ int32_t

typedef fl::i32 fl::third_party::int32_t

Definition at line 220 of file coder.h.

◆ int8_t

typedef signed char fl::third_party::int8_t

Definition at line 210 of file coder.h.

◆ intptr_t

typedef fl::iptr fl::third_party::intptr_t

Definition at line 225 of file coder.h.

◆ jd_yuv_t

typedef uint8_t fl::third_party::jd_yuv_t

Definition at line 19 of file tjpgd.h.

◆ JDEC

typedef struct JDEC fl::third_party::JDEC

Definition at line 49 of file tjpgd.h.

◆ lzw_result

typedef enum fl::third_party::lzw_result fl::third_party::lzw_result

LZW decoding response codes.

◆ lzw_writer_fn

typedef fl::u32(* fl::third_party::lzw_writer_fn) (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_pos, fl::u16 code, fl::u16 left)

Definition at line 371 of file lzw.cpp.hpp.

◆ nsgif_bitmap_cb_vt

typedef struct fl::third_party::nsgif_bitmap_cb_vt fl::third_party::nsgif_bitmap_cb_vt

Bitmap callbacks function table.

◆ nsgif_bitmap_fmt_t

typedef enum fl::third_party::nsgif_bitmap_fmt fl::third_party::nsgif_bitmap_fmt_t

NSGIF nsgif_bitmap_t pixel format.

All pixel formats are 32 bits per pixel (bpp). The different formats allow control over the ordering of the colour channels. All colour channels are 8 bits wide.

Note that the GIF file format only supports an on/off mask, so the alpha (A) component (opacity) will always have a value of 0 (fully transparent) or 255 (fully opaque).

◆ nsgif_bitmap_t

typedef void fl::third_party::nsgif_bitmap_t

Client bitmap type.

These are client-created and destroyed, via the nsgif_bitmap_cb_vt callbacks, but they are owned by a nsgif_t.

See nsgif_bitmap_fmt for pixel format information.

The bitmap may have a row_span greater than the bitmap width, but the difference between row span and width must be a whole number of pixels (a multiple of four bytes).

Definition at line 175 of file nsgif.hpp.

◆ nsgif_frame

typedef struct fl::third_party::nsgif_frame fl::third_party::nsgif_frame

GIF frame data.

◆ nsgif_frame_info_t

typedef struct fl::third_party::nsgif_frame_info fl::third_party::nsgif_frame_info_t

Information about a GIF frame.

◆ nsgif_info_t

typedef struct fl::third_party::nsgif_info fl::third_party::nsgif_info_t

Information about a GIF.

◆ nsgif_rect_t

typedef struct fl::third_party::nsgif_rect fl::third_party::nsgif_rect_t

LibNSGIF rectangle structure.

◆ nsgif_t

typedef struct nsgif fl::third_party::nsgif_t

Opaque type used by LibNSGIF to represent a GIF object in memory.

Definition at line 34 of file nsgif.hpp.

◆ plm_audio_decode_callback

typedef void(* fl::third_party::plm_audio_decode_callback) (plm_t *self, plm_samples_t *samples, void *user)

Definition at line 240 of file pl_mpeg.h.

◆ plm_audio_t

typedef struct plm_audio_t fl::third_party::plm_audio_t

Definition at line 163 of file pl_mpeg.h.

◆ plm_buffer_load_callback

typedef void(* fl::third_party::plm_buffer_load_callback) (plm_buffer_t *self, void *user)

Definition at line 246 of file pl_mpeg.h.

◆ plm_buffer_seek_callback

typedef void(* fl::third_party::plm_buffer_seek_callback) (plm_buffer_t *self, size_t offset, void *user)

Definition at line 251 of file pl_mpeg.h.

◆ plm_buffer_t

typedef struct plm_buffer_t fl::third_party::plm_buffer_t

Definition at line 160 of file pl_mpeg.h.

◆ plm_buffer_tell_callback

typedef size_t(* fl::third_party::plm_buffer_tell_callback) (plm_buffer_t *self, void *user)

Definition at line 256 of file pl_mpeg.h.

◆ plm_demux_t

typedef struct plm_demux_t fl::third_party::plm_demux_t

Definition at line 161 of file pl_mpeg.h.

◆ plm_quantizer_spec_t

typedef struct fl::third_party::plm_quantizer_spec_t fl::third_party::plm_quantizer_spec_t

◆ plm_t

typedef struct plm_t fl::third_party::plm_t

Definition at line 159 of file pl_mpeg.h.

◆ plm_video_decode_callback

typedef void(* fl::third_party::plm_video_decode_callback) (plm_t *self, plm_frame_t *frame, void *user)

Definition at line 213 of file pl_mpeg.h.

◆ plm_video_t

typedef struct plm_video_t fl::third_party::plm_video_t

Definition at line 162 of file pl_mpeg.h.

◆ ptrdiff_t

typedef fl::ptrdiff fl::third_party::ptrdiff_t

Definition at line 226 of file coder.h.

◆ saccum114

typedef i32 fl::third_party::fl::saccum114

no direct ANSI counterpart. 1 bit int, 14 bits fraction

Definition at line 187 of file coder.h.

◆ saccum1516

typedef i32 fl::third_party::fl::saccum1516

ANSI: signed _Accum. 15 bits int, 16 bits fraction.

Definition at line 185 of file coder.h.

◆ saccum78

typedef i16 fl::third_party::fl::saccum78

ANSI: signed short _Accum. 7 bits int, 8 bits fraction.

Definition at line 183 of file coder.h.

◆ ScaleFactorInfo

typedef struct fl::third_party::_ScaleFactorInfo fl::third_party::ScaleFactorInfo

◆ ScaleFactorInfoSub

typedef struct fl::third_party::_ScaleFactorInfoSub fl::third_party::ScaleFactorInfoSub

◆ ScaleFactorJS

typedef struct fl::third_party::_ScaleFactorJS fl::third_party::ScaleFactorJS

◆ SFBandTable

typedef struct fl::third_party::_SFBandTable fl::third_party::SFBandTable

◆ sfract15

typedef i16 fl::third_party::fl::sfract15

ANSI: signed _Fract.

Range is -0.99996948242 to 0.99996948242 in steps of 0.00003051757. Should be interpreted as signed 32768ths.

Definition at line 180 of file coder.h.

◆ sfract31

typedef i32 fl::third_party::fl::sfract31

ANSI: signed long _Fract. 31 bits int, 1 bit fraction.

Definition at line 173 of file coder.h.

◆ sfract7

typedef i8 fl::third_party::fl::sfract7

ANSI: signed short _Fract.

Range is -0.9921875 to 0.9921875 in steps of 0.0078125. Should be interpreted as signed 128ths.

Definition at line 166 of file coder.h.

◆ SideInfo

typedef struct fl::third_party::_SideInfo fl::third_party::SideInfo

◆ SideInfoSub

typedef struct fl::third_party::_SideInfoSub fl::third_party::SideInfoSub

◆ size_t

typedef fl::size fl::third_party::size_t

Definition at line 223 of file coder.h.

◆ SketchCallback

typedef bool(* fl::third_party::SketchCallback) (int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t *data)

Definition at line 31 of file TJpg_Decoder.h.

◆ SubbandInfo

typedef struct fl::third_party::_SubbandInfo fl::third_party::SubbandInfo

◆ TJpgInstanceDecoderPtr

using fl::third_party::TJpgInstanceDecoderPtr = fl::shared_ptr<TJpgInstanceDecoder>

Definition at line 23 of file driver.h.

◆ u64

typedef fl::u64 fl::third_party::u64

Definition at line 221 of file coder.h.

◆ uint16_t

typedef fl::u16 fl::third_party::uint16_t

Definition at line 214 of file coder.h.

◆ uint32_t

typedef fl::u32 fl::third_party::uint32_t

Definition at line 219 of file coder.h.

◆ uint8_t

typedef unsigned char fl::third_party::uint8_t

Definition at line 209 of file coder.h.

◆ uintptr_t

typedef fl::uptr fl::third_party::uintptr_t

Definition at line 224 of file coder.h.

◆ Word64

typedef long long fl::third_party::Word64

Definition at line 498 of file assembly.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
JDR_SUSPEND 

Definition at line 115 of file tjpgd.h.

115{ JDR_SUSPEND = 9 }; /* Suspended for progressive processing */

◆ anonymous enum

anonymous enum
Enumerator
TJPG_ARRAY 

Definition at line 25 of file TJpg_Decoder.h.

25 {
26 TJPG_ARRAY = 0
27};

◆ _HuffTabType

enum fl::third_party::_HuffTabType
Enumerator
noBits 
oneShot 
loopNoLinbits 
loopLinbits 
quadA 
quadB 
invalidTab 

Definition at line 221 of file coder.h.

221 {
222 noBits,
223 oneShot,
226 quadA,
227 quadB,
enum fl::third_party::_HuffTabType HuffTabType

◆ JRESULT

enum fl::third_party::JRESULT
Enumerator
JDR_OK 
JDR_INTR 
JDR_INP 
JDR_MEM1 
JDR_MEM2 
JDR_PAR 
JDR_FMT1 
JDR_FMT2 
JDR_FMT3 

Definition at line 24 of file tjpgd.h.

24 {
25 JDR_OK = 0, /* 0: Succeeded */
26 JDR_INTR, /* 1: Interrupted by output function */
27 JDR_INP, /* 2: Device error or wrong termination of input stream */
28 JDR_MEM1, /* 3: Insufficient memory pool for the image */
29 JDR_MEM2, /* 4: Insufficient stream input buffer */
30 JDR_PAR, /* 5: Parameter error */
31 JDR_FMT1, /* 6: Data format error (may be broken data) */
32 JDR_FMT2, /* 7: Right format but not supported */
33 JDR_FMT3 /* 8: Not supported JPEG standard */
34} JRESULT;

◆ lzw_result

enum fl::third_party::lzw_result

LZW decoding response codes.

Enumerator
LZW_OK 

Success.

LZW_OK_EOD 

Success; reached zero-length sub-block.

LZW_NO_MEM 

Error: Out of memory.

LZW_NO_DATA 

Error: Out of data.

LZW_EOI_CODE 

Error: End of Information code.

LZW_NO_COLOUR 

Error: No colour map provided.

LZW_BAD_ICODE 

Error: Bad initial LZW code.

LZW_BAD_PARAM 

Error: Bad function parameter.

LZW_BAD_CODE 

Error: Bad LZW code.

Definition at line 33 of file lzw.h.

33 {
34 LZW_OK,
lzw_result
LZW decoding response codes.
Definition lzw.h:33
@ LZW_NO_DATA
Error: Out of data.
Definition lzw.h:37
@ LZW_EOI_CODE
Error: End of Information code.
Definition lzw.h:38
@ LZW_OK
Success.
Definition lzw.h:34
@ LZW_NO_COLOUR
Error: No colour map provided.
Definition lzw.h:39
@ LZW_BAD_CODE
Error: Bad LZW code.
Definition lzw.h:42
@ LZW_NO_MEM
Error: Out of memory.
Definition lzw.h:36
@ LZW_BAD_PARAM
Error: Bad function parameter.
Definition lzw.h:41
@ LZW_OK_EOD
Success; reached zero-length sub-block.
Definition lzw.h:35
@ LZW_BAD_ICODE
Error: Bad initial LZW code.
Definition lzw.h:40

◆ nsgif_bitmap_fmt

enum fl::third_party::nsgif_bitmap_fmt

NSGIF nsgif_bitmap_t pixel format.

All pixel formats are 32 bits per pixel (bpp). The different formats allow control over the ordering of the colour channels. All colour channels are 8 bits wide.

Note that the GIF file format only supports an on/off mask, so the alpha (A) component (opacity) will always have a value of 0 (fully transparent) or 255 (fully opaque).

Enumerator
NSGIF_BITMAP_FMT_R8G8B8A8 

Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA.

NSGIF_BITMAP_FMT_B8G8R8A8 

Bite-wise BGRA: Byte order: 0xBB, 0xGG, 0xRR, 0xAA.

NSGIF_BITMAP_FMT_A8R8G8B8 

Bite-wise ARGB: Byte order: 0xAA, 0xRR, 0xGG, 0xBB.

NSGIF_BITMAP_FMT_A8B8G8R8 

Bite-wise ABGR: Byte order: 0xAA, 0xBB, 0xGG, 0xRR.

NSGIF_BITMAP_FMT_RGBA8888 

32-bit RGBA (0xRRGGBBAA).

NSGIF_BITMAP_FMT_BGRA8888 

32-bit BGRA (0xBBGGRRAA).

NSGIF_BITMAP_FMT_ARGB8888 

32-bit ARGB (0xAARRGGBB).

NSGIF_BITMAP_FMT_ABGR8888 

32-bit BGRA (0xAABBGGRR).

Definition at line 117 of file nsgif.hpp.

117 {
120
123
126
129
137
145
153
@ NSGIF_BITMAP_FMT_A8B8G8R8
Bite-wise ABGR: Byte order: 0xAA, 0xBB, 0xGG, 0xRR.
Definition nsgif.hpp:128
@ NSGIF_BITMAP_FMT_R8G8B8A8
Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA.
Definition nsgif.hpp:119
@ NSGIF_BITMAP_FMT_ARGB8888
32-bit ARGB (0xAARRGGBB).
Definition nsgif.hpp:152
@ NSGIF_BITMAP_FMT_RGBA8888
32-bit RGBA (0xRRGGBBAA).
Definition nsgif.hpp:136
@ NSGIF_BITMAP_FMT_B8G8R8A8
Bite-wise BGRA: Byte order: 0xBB, 0xGG, 0xRR, 0xAA.
Definition nsgif.hpp:122
@ NSGIF_BITMAP_FMT_ABGR8888
32-bit BGRA (0xAABBGGRR).
Definition nsgif.hpp:160
@ NSGIF_BITMAP_FMT_BGRA8888
32-bit BGRA (0xBBGGRRAA).
Definition nsgif.hpp:144
@ NSGIF_BITMAP_FMT_A8R8G8B8
Bite-wise ARGB: Byte order: 0xAA, 0xRR, 0xGG, 0xBB.
Definition nsgif.hpp:125
enum fl::third_party::nsgif_bitmap_fmt nsgif_bitmap_fmt_t
NSGIF nsgif_bitmap_t pixel format.

◆ nsgif_disposal

enum fl::third_party::nsgif_disposal

Frame disposal method.

Clients do not need to know about this, it is provided purely for dumping raw information about GIF frames.

Enumerator
NSGIF_DISPOSAL_UNSPECIFIED 

No disposal method specified.

NSGIF_DISPOSAL_NONE 

Frame remains.

NSGIF_DISPOSAL_RESTORE_BG 

Clear frame to background colour.

NSGIF_DISPOSAL_RESTORE_PREV 

Restore previous frame.

NSGIF_DISPOSAL_RESTORE_QUIRK 

Alias for NSGIF_DISPOSAL_RESTORE_PREV.

Definition at line 403 of file nsgif.hpp.

403 {
409};
@ NSGIF_DISPOSAL_UNSPECIFIED
No disposal method specified.
Definition nsgif.hpp:404
@ NSGIF_DISPOSAL_NONE
Frame remains.
Definition nsgif.hpp:405
@ NSGIF_DISPOSAL_RESTORE_BG
Clear frame to background colour.
Definition nsgif.hpp:406
@ NSGIF_DISPOSAL_RESTORE_PREV
Restore previous frame.
Definition nsgif.hpp:407
@ NSGIF_DISPOSAL_RESTORE_QUIRK
Alias for NSGIF_DISPOSAL_RESTORE_PREV.
Definition nsgif.hpp:408

◆ nsgif_error

enum fl::third_party::nsgif_error

LibNSGIF return codes.

Enumerator
NSGIF_OK 

Success.

NSGIF_ERR_OOM 

Out of memory error.

NSGIF_ERR_DATA 

GIF source data is invalid, and no frames are recoverable.

NSGIF_ERR_BAD_FRAME 

Frame number is not valid.

NSGIF_ERR_DATA_FRAME 

GIF source data contained an error in a frame.

NSGIF_ERR_END_OF_DATA 

Unexpected end of GIF source data.

NSGIF_ERR_DATA_COMPLETE 

Can't supply more data after calling nsgif_data_complete.

NSGIF_ERR_FRAME_DISPLAY 

The current frame cannot be displayed.

NSGIF_ERR_ANIMATION_END 

Indicates an animation is complete, and nsgif_reset must be called to restart the animation from the beginning.

Definition at line 58 of file nsgif.hpp.

58 {
63
68
73
78
83
88
93
98
nsgif_error
LibNSGIF return codes.
Definition nsgif.hpp:58
@ NSGIF_ERR_DATA_COMPLETE
Can't supply more data after calling nsgif_data_complete.
Definition nsgif.hpp:92
@ NSGIF_ERR_OOM
Out of memory error.
Definition nsgif.hpp:67
@ NSGIF_ERR_BAD_FRAME
Frame number is not valid.
Definition nsgif.hpp:77
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
Definition nsgif.hpp:87
@ NSGIF_ERR_ANIMATION_END
Indicates an animation is complete, and nsgif_reset must be called to restart the animation from the ...
Definition nsgif.hpp:103
@ NSGIF_ERR_DATA_FRAME
GIF source data contained an error in a frame.
Definition nsgif.hpp:82
@ NSGIF_ERR_DATA
GIF source data is invalid, and no frames are recoverable.
Definition nsgif.hpp:72
@ NSGIF_ERR_FRAME_DISPLAY
The current frame cannot be displayed.
Definition nsgif.hpp:97
@ NSGIF_OK
Success.
Definition nsgif.hpp:62

◆ plm_buffer_mode

enum fl::third_party::plm_buffer_mode
Enumerator
PLM_BUFFER_MODE_FILE 
PLM_BUFFER_MODE_FIXED_MEM 
PLM_BUFFER_MODE_RING 
PLM_BUFFER_MODE_APPEND 

Definition at line 719 of file pl_mpeg.hpp.

Function Documentation

◆ alloc_pool()

static void * fl::third_party::alloc_pool ( JDEC * jd,
size_t ndata )
static

Definition at line 141 of file tjpgd.cpp.hpp.

145{
146 char *rp = 0;
147
148
149 ndata = (ndata + 3) & ~3; /* Align block size to the word boundary */
150
151 if (jd->sz_pool >= ndata) {
152 jd->sz_pool -= ndata;
153 rp = (char*)jd->pool; /* Get start of available memory pool */
154 jd->pool = (void*)(rp + ndata); /* Allocate requierd bytes */
155 }
156
157 return (void*)rp; /* Return allocated memory block (NULL:no memory to allocate) */
158}

References FL_NOEXCEPT.

Referenced by create_huffman_tbl(), create_qt_tbl(), and jd_prepare().

+ Here is the caller graph for this function:

◆ AllocateBuffers()

MP3DecInfo * fl::third_party::AllocateBuffers ( void )

Definition at line 99 of file buffers.hpp.

100{
101 MP3DecInfo *mp3DecInfo;
102 FrameHeader *fh;
103 SideInfo *si;
104 ScaleFactorInfo *sfi;
105 HuffmanInfo *hi;
106 DequantInfo *di;
107 IMDCTInfo *mi;
108 SubbandInfo *sbi;
109
110 mp3DecInfo = (MP3DecInfo *)malloc(sizeof(MP3DecInfo));
111 if (!mp3DecInfo)
112 return 0;
113 ClearBuffer(mp3DecInfo, sizeof(MP3DecInfo));
114
115 fh = (FrameHeader *) malloc(sizeof(FrameHeader));
116 si = (SideInfo *) malloc(sizeof(SideInfo));
117 sfi = (ScaleFactorInfo *) malloc(sizeof(ScaleFactorInfo));
118 hi = (HuffmanInfo *) malloc(sizeof(HuffmanInfo));
119 di = (DequantInfo *) malloc(sizeof(DequantInfo));
120 mi = (IMDCTInfo *) malloc(sizeof(IMDCTInfo));
121 sbi = (SubbandInfo *) malloc(sizeof(SubbandInfo));
122
123 mp3DecInfo->FrameHeaderPS = (void *)fh;
124 mp3DecInfo->SideInfoPS = (void *)si;
125 mp3DecInfo->ScaleFactorInfoPS = (void *)sfi;
126 mp3DecInfo->HuffmanInfoPS = (void *)hi;
127 mp3DecInfo->DequantInfoPS = (void *)di;
128 mp3DecInfo->IMDCTInfoPS = (void *)mi;
129 mp3DecInfo->SubbandInfoPS = (void *)sbi;
130
131 if (!fh || !si || !sfi || !hi || !di || !mi || !sbi) {
132 FreeBuffers(mp3DecInfo); /* safe to call - only frees memory that was successfully allocated */
133 return 0;
134 }
135
136 /* important to do this - DSP primitives assume a bunch of state variables are 0 on first use */
137 ClearBuffer(fh, sizeof(FrameHeader));
138 ClearBuffer(si, sizeof(SideInfo));
139 ClearBuffer(sfi, sizeof(ScaleFactorInfo));
140 ClearBuffer(hi, sizeof(HuffmanInfo));
141 ClearBuffer(di, sizeof(DequantInfo));
142 ClearBuffer(mi, sizeof(IMDCTInfo));
143 ClearBuffer(sbi, sizeof(SubbandInfo));
144
145 return mp3DecInfo;
146}
struct _MP3DecInfo MP3DecInfo
void * IMDCTInfoPS
Definition mp3common.h:73
void * FrameHeaderPS
Definition mp3common.h:68
void * DequantInfoPS
Definition mp3common.h:72
void * ScaleFactorInfoPS
Definition mp3common.h:70
void * SideInfoPS
Definition mp3common.h:69
void * HuffmanInfoPS
Definition mp3common.h:71
void * SubbandInfoPS
Definition mp3common.h:74
struct fl::third_party::_IMDCTInfo IMDCTInfo
struct fl::third_party::_DequantInfo DequantInfo
struct fl::third_party::_HuffmanInfo HuffmanInfo
struct fl::third_party::_SubbandInfo SubbandInfo
struct fl::third_party::_FrameHeader FrameHeader
struct fl::third_party::_SideInfo SideInfo
void FreeBuffers(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
Definition buffers.hpp:163
struct fl::third_party::_ScaleFactorInfo ScaleFactorInfo
static void ClearBuffer(void *buf, int nBytes) FL_NOEXCEPT
Definition buffers.hpp:72
void * malloc(size_t size)
Definition malloc.cpp.hpp:9

References ClearBuffer(), _MP3DecInfo::DequantInfoPS, FL_NOEXCEPT, _MP3DecInfo::FrameHeaderPS, FreeBuffers(), _MP3DecInfo::HuffmanInfoPS, _MP3DecInfo::IMDCTInfoPS, fl::malloc(), _MP3DecInfo::ScaleFactorInfoPS, _MP3DecInfo::SideInfoPS, and _MP3DecInfo::SubbandInfoPS.

Referenced by MP3InitDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AntiAlias()

static void fl::third_party::AntiAlias ( int32_t * x,
int32_t nBfly )
static

Definition at line 80 of file imdct.hpp.

81{
82 int32_t k;
83 int32_t a0, b0, c0, c1;
84 const int32_t *c;
85
86 /* csa = Q31 */
87 for (k = nBfly; k > 0; k--) {
88 c = csa[0];
89 x += 18;
90
91 a0 = x[-1]; c0 = *c; c++; b0 = x[0]; c1 = *c; c++;
92 x[-1] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
93 x[0] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
94
95 a0 = x[-2]; c0 = *c; c++; b0 = x[1]; c1 = *c; c++;
96 x[-2] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
97 x[1] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
98
99 a0 = x[-3]; c0 = *c; c++; b0 = x[2]; c1 = *c; c++;
100 x[-3] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
101 x[2] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
102
103 a0 = x[-4]; c0 = *c; c++; b0 = x[3]; c1 = *c; c++;
104 x[-4] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
105 x[3] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
106
107 a0 = x[-5]; c0 = *c; c++; b0 = x[4]; c1 = *c; c++;
108 x[-5] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
109 x[4] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
110
111 a0 = x[-6]; c0 = *c; c++; b0 = x[5]; c1 = *c; c++;
112 x[-6] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
113 x[5] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
114
115 a0 = x[-7]; c0 = *c; c++; b0 = x[6]; c1 = *c; c++;
116 x[-7] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
117 x[6] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
118
119 a0 = x[-8]; c0 = *c; c++; b0 = x[7]; c1 = *c; c++;
120 x[-8] = (MULSHIFT32(c0, a0) - MULSHIFT32(c1, b0)) * 2L;
121 x[7] = (MULSHIFT32(c0, b0) + MULSHIFT32(c1, a0)) * 2L;
122 }
123}
__inline int32_t MULSHIFT32(int32_t x, int32_t y) FL_NOEXCEPT
Multiply together two 32-bit numbers and return the top 32-bits of the result.
Definition assembly.h:503
const int32_t csa[8][2]
Definition trigtabs.hpp:229
fl::i32 int32_t
Definition coder.h:220

References csa, FL_NOEXCEPT, MULSHIFT32(), and fl::x.

Referenced by IMDCT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bitext()

static int fl::third_party::bitext ( JDEC * jd,
unsigned int nbit )
static

Definition at line 432 of file tjpgd.cpp.hpp.

436{
437 size_t dc = jd->dctr;
438 uint8_t *dp = jd->dptr;
439 unsigned int d, flg = 0;
440
441#if JD_FASTDECODE == 0
442 uint8_t mbit = jd->dbit;
443
444 d = 0;
445 do {
446 if (!mbit) { /* Next byte? */
447 if (!dc) { /* No input data is available, re-fill input buffer */
448 dp = jd->inbuf; /* Top of input buffer */
449 dc = jd->infunc(jd, dp, JD_SZBUF);
450 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */
451 } else {
452 dp++; /* Next data ptr */
453 }
454 dc--; /* Decrement number of available bytes */
455 if (flg) { /* In flag sequence? */
456 flg = 0; /* Exit flag sequence */
457 if (*dp != 0) return 0 - (int)JDR_FMT1; /* Err: unexpected flag is detected (may be collapted data) */
458 *dp = 0xFF; /* The flag is a data 0xFF */
459 } else {
460 if (*dp == 0xFF) { /* Is start of flag sequence? */
461 flg = 1; continue; /* Enter flag sequence */
462 }
463 }
464 mbit = 0x80; /* Read from MSB */
465 }
466 d <<= 1; /* Get a bit */
467 if (*dp & mbit) d |= 1;
468 mbit >>= 1;
469 nbit--;
470 } while (nbit);
471
472 jd->dbit = mbit; jd->dctr = dc; jd->dptr = dp;
473 return (int)d;
474
475#else
476 unsigned int wbit = jd->dbit % 32;
477 uint32_t w = jd->wreg & ((1UL << wbit) - 1);
478
479
480 while (wbit < nbit) { /* Prepare nbit bits into the working register */
481 if (jd->marker) {
482 d = 0xFF; /* Input stream stalled, generate stuff bits */
483 } else {
484 if (!dc) { /* Buffer empty, re-fill input buffer */
485 dp = jd->inbuf; /* Top of input buffer */
486 dc = jd->infunc(jd, dp, JD_SZBUF);
487 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */
488 }
489 d = *dp++; dc--;
490 if (flg) { /* In flag sequence? */
491 flg = 0; /* Exit flag sequence */
492 if (d != 0) jd->marker = d; /* Not an escape of 0xFF but a marker */
493 d = 0xFF;
494 } else {
495 if (d == 0xFF) { /* Is start of flag sequence? */
496 flg = 1; continue; /* Enter flag sequence, get trailing byte */
497 }
498 }
499 }
500 w = w << 8 | d; /* Get 8 bits into the working register */
501 wbit += 8;
502 }
503 jd->wreg = w; jd->dbit = wbit - nbit;
504 jd->dctr = dc; jd->dptr = dp;
505
506 return (int)(w >> ((wbit - nbit) % 32));
507#endif
508}
fl::u32 uint32_t
Definition coder.h:219
unsigned char uint8_t
Definition coder.h:209
uint8_t * dptr
Definition tjpgd.h:52
size_t(* infunc)(JDEC *, uint8_t *, size_t)
Definition tjpgd.h:79
uint8_t * inbuf
Definition tjpgd.h:53
#define JD_SZBUF
Definition tjpgdcnf.h:5

References FL_NOEXCEPT, JD_SZBUF, JDR_FMT1, and JDR_INP.

Referenced by mcu_load().

+ Here is the caller graph for this function:

◆ block_idct()

static void fl::third_party::block_idct ( int32_t * src,
jd_yuv_t * dst )
static

Definition at line 588 of file tjpgd.cpp.hpp.

592{
593 const int32_t M13 = (int32_t)(1.41421*4096), M2 = (int32_t)(1.08239*4096), M4 = (int32_t)(2.61313*4096), M5 = (int32_t)(1.84776*4096);
594 int32_t v0, v1, v2, v3, v4, v5, v6, v7;
595 int32_t t10, t11, t12, t13;
596 int i;
597
598 /* Process columns */
599 for (i = 0; i < 8; i++) {
600 v0 = src[8 * 0]; /* Get even elements */
601 v1 = src[8 * 2];
602 v2 = src[8 * 4];
603 v3 = src[8 * 6];
604
605 t10 = v0 + v2; /* Process the even elements */
606 t12 = v0 - v2;
607 t11 = (v1 - v3) * M13 >> 12;
608 v3 += v1;
609 t11 -= v3;
610 v0 = t10 + v3;
611 v3 = t10 - v3;
612 v1 = t11 + t12;
613 v2 = t12 - t11;
614
615 v4 = src[8 * 7]; /* Get odd elements */
616 v5 = src[8 * 1];
617 v6 = src[8 * 5];
618 v7 = src[8 * 3];
619
620 t10 = v5 - v4; /* Process the odd elements */
621 t11 = v5 + v4;
622 t12 = v6 - v7;
623 v7 += v6;
624 v5 = (t11 - v7) * M13 >> 12;
625 v7 += t11;
626 t13 = (t10 + t12) * M5 >> 12;
627 v4 = t13 - (t10 * M2 >> 12);
628 v6 = t13 - (t12 * M4 >> 12) - v7;
629 v5 -= v6;
630 v4 -= v5;
631
632 src[8 * 0] = v0 + v7; /* Write-back transformed values */
633 src[8 * 7] = v0 - v7;
634 src[8 * 1] = v1 + v6;
635 src[8 * 6] = v1 - v6;
636 src[8 * 2] = v2 + v5;
637 src[8 * 5] = v2 - v5;
638 src[8 * 3] = v3 + v4;
639 src[8 * 4] = v3 - v4;
640
641 src++; /* Next column */
642 }
643
644 /* Process rows */
645 src -= 8;
646 for (i = 0; i < 8; i++) {
647 v0 = src[0] + (128L << 8); /* Get even elements (remove DC offset (-128) here) */
648 v1 = src[2];
649 v2 = src[4];
650 v3 = src[6];
651
652 t10 = v0 + v2; /* Process the even elements */
653 t12 = v0 - v2;
654 t11 = (v1 - v3) * M13 >> 12;
655 v3 += v1;
656 t11 -= v3;
657 v0 = t10 + v3;
658 v3 = t10 - v3;
659 v1 = t11 + t12;
660 v2 = t12 - t11;
661
662 v4 = src[7]; /* Get odd elements */
663 v5 = src[1];
664 v6 = src[5];
665 v7 = src[3];
666
667 t10 = v5 - v4; /* Process the odd elements */
668 t11 = v5 + v4;
669 t12 = v6 - v7;
670 v7 += v6;
671 v5 = (t11 - v7) * M13 >> 12;
672 v7 += t11;
673 t13 = (t10 + t12) * M5 >> 12;
674 v4 = t13 - (t10 * M2 >> 12);
675 v6 = t13 - (t12 * M4 >> 12) - v7;
676 v5 -= v6;
677 v4 -= v5;
678
679 /* Descale the transformed values 8 bits and output a row */
680#if JD_FASTDECODE >= 1
681 dst[0] = (int16_t)((v0 + v7) >> 8);
682 dst[7] = (int16_t)((v0 - v7) >> 8);
683 dst[1] = (int16_t)((v1 + v6) >> 8);
684 dst[6] = (int16_t)((v1 - v6) >> 8);
685 dst[2] = (int16_t)((v2 + v5) >> 8);
686 dst[5] = (int16_t)((v2 - v5) >> 8);
687 dst[3] = (int16_t)((v3 + v4) >> 8);
688 dst[4] = (int16_t)((v3 - v4) >> 8);
689#else
690 dst[0] = BYTECLIP((v0 + v7) >> 8);
691 dst[7] = BYTECLIP((v0 - v7) >> 8);
692 dst[1] = BYTECLIP((v1 + v6) >> 8);
693 dst[6] = BYTECLIP((v1 - v6) >> 8);
694 dst[2] = BYTECLIP((v2 + v5) >> 8);
695 dst[5] = BYTECLIP((v2 - v5) >> 8);
696 dst[3] = BYTECLIP((v3 + v4) >> 8);
697 dst[4] = BYTECLIP((v3 - v4) >> 8);
698#endif
699
700 dst += 8; src += 8; /* Next row */
701 }
702}
static uint8_t BYTECLIP(int val) FL_NOEXCEPT
fl::i16 int16_t
Definition s16x16x4.h:215

References BYTECLIP(), and FL_NOEXCEPT.

Referenced by mcu_load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BYTECLIP()

static uint8_t fl::third_party::BYTECLIP ( int val)
static

Definition at line 126 of file tjpgd.cpp.hpp.

127{
128 if (val < 0) return 0;
129 else if (val > 255) return 255;
130 return (uint8_t)val;
131}

References FL_NOEXCEPT.

Referenced by block_idct(), and mcu_output().

+ Here is the caller graph for this function:

◆ CalcBitsUsed()

int32_t fl::third_party::CalcBitsUsed ( BitStreamInfo * bsi,
const unsigned char * startBuf,
int32_t startOffset )

Definition at line 170 of file bitstream.hpp.

171{
172 int32_t bitsUsed;
173
174 bitsUsed = (bsi->bytePtr - startBuf) * 8;
175 bitsUsed -= bsi->cachedBits;
176 bitsUsed -= startOffset;
177
178 return bitsUsed;
179}
const unsigned char * bytePtr
Definition coder.h:154

References FL_NOEXCEPT.

Referenced by UnpackScaleFactors(), and UnpackSideInfo().

+ Here is the caller graph for this function:

◆ CheckPadBit()

int fl::third_party::CheckPadBit ( MP3DecInfo * mp3DecInfo)

Definition at line 193 of file bitstream.hpp.

194{
195 FrameHeader *fh;
196
197 /* validate pointers */
198 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS)
199 return -1;
200
201 fh = ((FrameHeader *)(mp3DecInfo->FrameHeaderPS));
202
203 return (fh->paddingBit ? 1 : 0);
204}

References FL_NOEXCEPT, and fl::third_party::_FrameHeader::paddingBit.

Referenced by MP3Decode().

+ Here is the caller graph for this function:

◆ ClearBuffer()

static void fl::third_party::ClearBuffer ( void * buf,
int nBytes )
static

Definition at line 72 of file buffers.hpp.

73{
74 int i;
75 unsigned char *cbuf = (unsigned char *)buf;
76
77 for (i = 0; i < nBytes; i++)
78 cbuf[i] = 0;
79
80 return;
81}

References FL_NOEXCEPT.

Referenced by AllocateBuffers().

+ Here is the caller graph for this function:

◆ ClipToShort()

static __inline short fl::third_party::ClipToShort ( int x,
int fracBits )
static

Definition at line 74 of file polyphase.hpp.

75{
76 int32_t x32 = (int32_t)x;
78
79 /* assumes you've already rounded (x += (1 << (fracBits-1))) */
80 x32 >>= fracBits;
81
82 /* Ken's trick: clips to [-32768, 32767] */
83 sign = x32 >> 31;
84 if (sign != (x32 >> 15))
85 x32 = sign ^ ((1L << 15) - 1);
86
87 return (short)x32;
88}
constexpr enable_if< is_fixed_point< T >::value, int >::type sign(T x) FL_NOEXCEPT

References FL_NOEXCEPT, fl::sign(), and fl::x.

Referenced by PolyphaseMono(), and PolyphaseStereo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CLZ()

__inline int32_t fl::third_party::CLZ ( int32_t x)

Leading zeros.

Definition at line 527 of file assembly.h.

528{
529 int32_t numZeros;
530
531 if (!x)
532 return (sizeof(int32_t) * 8);
533
534 numZeros = 0;
535 while (!(x & 0x80000000)) {
536 numZeros++;
537 x <<= 1;
538 }
539
540 return numZeros;
541}

References FL_NOEXCEPT, and fl::x.

Referenced by DequantChannel(), Dequantize(), and HybridTransform().

+ Here is the caller graph for this function:

◆ create_huffman_tbl()

static JRESULT fl::third_party::create_huffman_tbl ( JDEC * jd,
const uint8_t * data,
size_t ndata )
static

Definition at line 203 of file tjpgd.cpp.hpp.

208{
209 unsigned int i, j, b, cls, num;
210 size_t np;
211 uint8_t d, *pb, *pd;
212 uint16_t hc, *ph;
213
214
215 while (ndata) { /* Process all tables in the segment */
216 if (ndata < 17) return JDR_FMT1; /* Err: wrong data size */
217 ndata -= 17;
218 d = *data++; /* Get table number and class */
219 if (d & 0xEE) return JDR_FMT1; /* Err: invalid class/number */
220 cls = d >> 4; num = d & 0x0F; /* class = dc(0)/ac(1), table number = 0/1 */
221 pb = (uint8_t*)alloc_pool(jd, 16); /* Allocate a memory block for the bit distribution table */
222 if (!pb) return JDR_MEM1; /* Err: not enough memory */
223 jd->huffbits[num][cls] = pb;
224 for (np = i = 0; i < 16; i++) { /* Load number of patterns for 1 to 16-bit code */
225 np += (pb[i] = *data++); /* Get sum of code words for each code */
226 }
227 ph = (uint16_t*)alloc_pool(jd, np * sizeof (uint16_t));/* Allocate a memory block for the code word table */
228 if (!ph) return JDR_MEM1; /* Err: not enough memory */
229 jd->huffcode[num][cls] = ph;
230 hc = 0;
231 for (j = i = 0; i < 16; i++) { /* Re-build huffman code word table */
232 b = pb[i];
233 while (b--) ph[j++] = hc++;
234 hc <<= 1;
235 }
236
237 if (ndata < np) return JDR_FMT1; /* Err: wrong data size */
238 ndata -= np;
239 pd = (uint8_t*)alloc_pool(jd, np); /* Allocate a memory block for the decoded data */
240 if (!pd) return JDR_MEM1; /* Err: not enough memory */
241 jd->huffdata[num][cls] = pd;
242 for (i = 0; i < np; i++) { /* Load decoded data corresponds to each code word */
243 d = *data++;
244 if (!cls && d > 11) return JDR_FMT1;
245 pd[i] = d;
246 }
247#if JD_FASTDECODE == 2
248 { /* Create fast huffman decode table */
249 unsigned int span, td, ti;
250 uint16_t *tbl_ac = 0;
251 uint8_t *tbl_dc = 0;
252
253 if (cls) {
254 tbl_ac = (uint16_t*)alloc_pool(jd, HUFF_LEN * sizeof (uint16_t)); /* LUT for AC elements */
255 if (!tbl_ac) return JDR_MEM1; /* Err: not enough memory */
256 jd->hufflut_ac[num] = tbl_ac;
257 fl::memset(tbl_ac, 0xFF, HUFF_LEN * sizeof (uint16_t)); /* Default value (0xFFFF: may be long code) */
258 } else {
259 tbl_dc = (uint8_t*)alloc_pool(jd, HUFF_LEN * sizeof (uint8_t)); /* LUT for AC elements */
260 if (!tbl_dc) return JDR_MEM1; /* Err: not enough memory */
261 jd->hufflut_dc[num] = tbl_dc;
262 fl::memset(tbl_dc, 0xFF, HUFF_LEN * sizeof (uint8_t)); /* Default value (0xFF: may be long code) */
263 }
264 for (i = b = 0; b < HUFF_BIT; b++) { /* Create LUT */
265 for (j = pb[b]; j; j--) {
266 ti = ph[i] << (HUFF_BIT - 1 - b) & HUFF_MASK; /* Index of input pattern for the code */
267 if (cls) {
268 td = pd[i++] | ((b + 1) << 8); /* b15..b8: code length, b7..b0: zero run and data length */
269 for (span = 1 << (HUFF_BIT - 1 - b); span; span--, tbl_ac[ti++] = (uint16_t)td) ;
270 } else {
271 td = pd[i++] | ((b + 1) << 4); /* b7..b4: code length, b3..b0: data length */
272 for (span = 1 << (HUFF_BIT - 1 - b); span; span--, tbl_dc[ti++] = (uint8_t)td) ;
273 }
274 }
275 }
276 jd->longofs[num][cls] = i; /* Code table offset for long code */
277 }
278#endif
279 }
280
281 return JDR_OK;
282}
fl::u16 uint16_t
Definition coder.h:214
static void * alloc_pool(JDEC *jd, size_t ndata) FL_NOEXCEPT
uint16_t * huffcode[2][2]
Definition tjpgd.h:63
uint8_t * huffbits[2][2]
Definition tjpgd.h:62
uint8_t * huffdata[2][2]
Definition tjpgd.h:64
fl::u16 uint16_t
Definition s16x16x4.h:214
void * memset(void *s, int c, size_t n) FL_NOEXCEPT

References alloc_pool(), FL_NOEXCEPT, JDR_FMT1, JDR_MEM1, JDR_OK, and fl::memset().

Referenced by jd_prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_qt_tbl()

static JRESULT fl::third_party::create_qt_tbl ( JDEC * jd,
const uint8_t * data,
size_t ndata )
static

Definition at line 167 of file tjpgd.cpp.hpp.

172{
173 unsigned int i, zi;
174 uint8_t d;
175 int32_t *pb;
176
177
178 while (ndata) { /* Process all tables in the segment */
179 if (ndata < 65) return JDR_FMT1; /* Err: table size is unaligned */
180 ndata -= 65;
181 d = *data++; /* Get table property */
182 if (d & 0xF0) return JDR_FMT1; /* Err: not 8-bit resolution */
183 i = d & 3; /* Get table ID */
184 pb = (int32_t*)alloc_pool(jd, 64 * sizeof (int32_t));/* Allocate a memory block for the table */
185 if (!pb) return JDR_MEM1; /* Err: not enough memory */
186 jd->qttbl[i] = pb; /* Register the table */
187 for (i = 0; i < 64; i++) { /* Load the table */
188 zi = Zig[i]; /* Zigzag-order to raster-order conversion */
189 pb[zi] = (int32_t)((uint32_t)*data++ * Ipsf[zi]); /* Apply scale factor of Arai algorithm to the de-quantizers */
190 }
191 }
192
193 return JDR_OK;
194}
static const uint8_t Zig[64]
Definition tjpgd.cpp.hpp:50
static const uint16_t Ipsf[64]
Definition tjpgd.cpp.hpp:64
int32_t * qttbl[4]
Definition tjpgd.h:65

References alloc_pool(), FL_NOEXCEPT, Ipsf, JDR_FMT1, JDR_MEM1, JDR_OK, and Zig.

Referenced by jd_prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createTJpgInstanceDecoder()

TJpgInstanceDecoderPtr fl::third_party::createTJpgInstanceDecoder ( )

Definition at line 387 of file driver.cpp.hpp.

387 {
389}
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414

References FL_NOEXCEPT, and fl::make_shared().

Referenced by fl::JpegDecoder::Impl::Impl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DecodeHuffman()

int fl::third_party::DecodeHuffman ( MP3DecInfo * mp3DecInfo,
const unsigned char * buf,
int * bitOffset,
int huffBlockBits,
int gr,
int ch )

Definition at line 385 of file huffman.hpp.

386{
387 int r1Start, r2Start, rEnd[4]; /* region boundaries */
388 int i, w, bitsUsed, bitsLeft;
389 const unsigned char *startBuf = buf;
390
391 FrameHeader *fh;
392 SideInfo *si;
393 SideInfoSub *sis;
394 HuffmanInfo *hi;
395
396 /* validate pointers */
397 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || !mp3DecInfo->SideInfoPS || !mp3DecInfo->ScaleFactorInfoPS || !mp3DecInfo->HuffmanInfoPS)
398 return -1;
399
400 fh = ((FrameHeader *)(mp3DecInfo->FrameHeaderPS));
401 si = ((SideInfo *)(mp3DecInfo->SideInfoPS));
402 sis = &si->sis[gr][ch];
403 hi = (HuffmanInfo*)(mp3DecInfo->HuffmanInfoPS);
404
405 if (huffBlockBits < 0)
406 return -1;
407
408 /* figure out region boundaries (the first 2*bigVals coefficients divided into 3 regions) */
409 if (sis->winSwitchFlag && sis->blockType == 2) {
410 if (sis->mixedBlock == 0) {
411 r1Start = fh->sfBand->s[(sis->region0Count + 1)/3] * 3;
412 } else {
413 if (fh->ver == MPEG1) {
414 r1Start = fh->sfBand->l[sis->region0Count + 1];
415 } else {
416 /* see MPEG2 spec for explanation */
417 w = fh->sfBand->s[4] - fh->sfBand->s[3];
418 r1Start = fh->sfBand->l[6] + 2*w;
419 }
420 }
421 r2Start = MAX_NSAMP; /* short blocks don't have region 2 */
422 } else {
423 r1Start = fh->sfBand->l[sis->region0Count + 1];
424 r2Start = fh->sfBand->l[sis->region0Count + 1 + sis->region1Count + 1];
425 }
426
427 /* offset rEnd index by 1 so first region = rEnd[1] - rEnd[0], etc. */
428 rEnd[3] = MIN(MAX_NSAMP, 2 * sis->nBigvals);
429 rEnd[2] = MIN(r2Start, rEnd[3]);
430 rEnd[1] = MIN(r1Start, rEnd[3]);
431 rEnd[0] = 0;
432
433 /* rounds up to first all-zero pair (we don't check last pair for (x,y) == (non-zero, zero)) */
434 hi->nonZeroBound[ch] = rEnd[3];
435
436 /* decode Huffman pairs (rEnd[i] are always even numbers) */
437 bitsLeft = huffBlockBits;
438 for (i = 0; i < 3; i++) {
439 bitsUsed = DecodeHuffmanPairs(hi->huffDecBuf[ch] + rEnd[i], rEnd[i+1] - rEnd[i], sis->tableSelect[i], bitsLeft, buf, *bitOffset);
440 if (bitsUsed < 0 || bitsUsed > bitsLeft) /* error - overran end of bitstream */
441 return -1;
442
443 /* update bitstream position */
444 buf += (bitsUsed + *bitOffset) >> 3;
445 *bitOffset = (bitsUsed + *bitOffset) & 0x07;
446 bitsLeft -= bitsUsed;
447 }
448
449 /* decode Huffman quads (if any) */
450 hi->nonZeroBound[ch] += DecodeHuffmanQuads(hi->huffDecBuf[ch] + rEnd[3], MAX_NSAMP - rEnd[3], sis->count1TableSelect, bitsLeft, buf, *bitOffset);
451
452 ASSERT(hi->nonZeroBound[ch] <= MAX_NSAMP);
453 for (i = hi->nonZeroBound[ch]; i < MAX_NSAMP; i++)
454 hi->huffDecBuf[ch][i] = 0;
455
456 /* If bits used for 576 samples < huffBlockBits, then the extras are considered
457 * to be stuffing bits (throw away, but need to return correct bitstream position)
458 */
459 buf += (bitsLeft + *bitOffset) >> 3;
460 *bitOffset = (bitsLeft + *bitOffset) & 0x07;
461
462 return (buf - startBuf);
463}
#define MIN(a, b)
Definition coder.h:64
#define ASSERT(x)
Definition coder.h:56
@ MPEG1
Definition mp3dec.h:83
#define MAX_NSAMP
Definition mp3dec.h:79
static int DecodeHuffmanPairs(int32_t *xy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) FL_NOEXCEPT
Definition huffman.hpp:88
static int DecodeHuffmanQuads(int32_t *vwxy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) FL_NOEXCEPT
Definition huffman.hpp:292
struct fl::third_party::_SideInfoSub SideInfoSub
int32_t nonZeroBound[MAX_NCHAN]
Definition coder.h:217
int32_t huffDecBuf[MAX_NCHAN][MAX_NSAMP]
Definition coder.h:216
const SFBandTable * sfBand
Definition coder.h:175
SideInfoSub sis[MAX_NGRAN][MAX_NCHAN]
Definition coder.h:200

References ASSERT, fl::third_party::_SideInfoSub::blockType, fl::third_party::_SideInfoSub::count1TableSelect, DecodeHuffmanPairs(), DecodeHuffmanQuads(), FL_NOEXCEPT, fl::third_party::_HuffmanInfo::huffDecBuf, fl::third_party::_SFBandTable::l, MAX_NSAMP, MIN, fl::third_party::_SideInfoSub::mixedBlock, MPEG1, fl::third_party::_SideInfoSub::nBigvals, fl::third_party::_HuffmanInfo::nonZeroBound, fl::third_party::_SideInfoSub::region0Count, fl::third_party::_SideInfoSub::region1Count, fl::third_party::_SFBandTable::s, fl::third_party::_FrameHeader::sfBand, fl::third_party::_SideInfo::sis, fl::third_party::_SideInfoSub::tableSelect, fl::third_party::_FrameHeader::ver, and fl::third_party::_SideInfoSub::winSwitchFlag.

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DecodeHuffmanPairs()

static int fl::third_party::DecodeHuffmanPairs ( int32_t * xy,
int nVals,
int tabIdx,
int bitsLeft,
const unsigned char * buf,
int bitOffset )
static

Definition at line 88 of file huffman.hpp.

89{
90 int i, x, y;
91 int cachedBits, padBits, len, startBits, linBits, maxBits, minBits;
92 HuffTabType tabType;
93 unsigned short cw, *tBase, *tCurr;
94 unsigned int cache;
95
96 if(nVals <= 0)
97 return 0;
98
99 if (bitsLeft < 0)
100 return -1;
101 startBits = bitsLeft;
102
103 tBase = (unsigned short *)(huffTable + huffTabOffset[tabIdx]);
104 linBits = huffTabLookup[tabIdx].linBits;
105 tabType = huffTabLookup[tabIdx].tabType;
106
107 ASSERT(!(nVals & 0x01));
108 ASSERT(tabIdx < HUFF_PAIRTABS);
109 ASSERT(tabIdx >= 0);
110 ASSERT(tabType != invalidTab);
111
112 /* initially fill cache with any partial byte */
113 cache = 0;
114 cachedBits = (8 - bitOffset) & 0x07;
115 if (cachedBits)
116 cache = (unsigned int)(*buf++) << (32 - cachedBits);
117 bitsLeft -= cachedBits;
118
119 if (tabType == noBits) {
120 /* table 0, no data, x = y = 0 */
121 for (i = 0; i < nVals; i+=2) {
122 xy[i+0] = 0;
123 xy[i+1] = 0;
124 }
125 return 0;
126 } else if (tabType == oneShot) {
127 /* single lookup, no escapes */
128 maxBits = GetMaxbits(tBase[0]);
129 tBase++;
130 padBits = 0;
131 while (nVals > 0) {
132 /* refill cache - assumes cachedBits <= 16 */
133 if (bitsLeft >= 16) {
134 /* load 2 new bytes into left-justified cache */
135 cache |= (unsigned int)(*buf++) << (24 - cachedBits);
136 cache |= (unsigned int)(*buf++) << (16 - cachedBits);
137 cachedBits += 16;
138 bitsLeft -= 16;
139 } else {
140 /* last time through, pad cache with zeros and drain cache */
141 if (cachedBits + bitsLeft <= 0) return -1;
142 if (bitsLeft > 0) cache |= (unsigned int)(*buf++) << (24 - cachedBits);
143 if (bitsLeft > 8) cache |= (unsigned int)(*buf++) << (16 - cachedBits);
144 cachedBits += bitsLeft;
145 bitsLeft = 0;
146
147 cache &= (signed int)(int32_t)0x80000000 >> (cachedBits - 1);
148 padBits = 11;
149 cachedBits += padBits; /* okay if this is > 32 (0's automatically shifted in from right) */
150 }
151
152 /* largest maxBits = 9, plus 2 for sign bits, so make sure cache has at least 11 bits */
153 while (nVals > 0 && cachedBits >= 11 ) {
154 cw = tBase[cache >> (32 - maxBits)];
155 len = GetHLen(cw);
156 cachedBits -= len;
157 cache <<= len;
158
159 x = GetCWX(cw); if (x) {ApplySign(x, cache); cache <<= 1; cachedBits--;}
160 y = GetCWY(cw); if (y) {ApplySign(y, cache); cache <<= 1; cachedBits--;}
161
162 /* ran out of bits - should never have consumed padBits */
163 if (cachedBits < padBits)
164 return -1;
165
166 *xy++ = x;
167 *xy++ = y;
168 nVals -= 2;
169 }
170 }
171 bitsLeft += (cachedBits - padBits);
172 return (startBits - bitsLeft);
173 } else if (tabType == loopLinbits || tabType == loopNoLinbits) {
174 tCurr = tBase;
175 padBits = 0;
176 while (nVals > 0) {
177 /* refill cache - assumes cachedBits <= 16 */
178 if (bitsLeft >= 16) {
179 /* load 2 new bytes into left-justified cache */
180 cache |= (unsigned int)(*buf++) << (24 - cachedBits);
181 cache |= (unsigned int)(*buf++) << (16 - cachedBits);
182 cachedBits += 16;
183 bitsLeft -= 16;
184 } else {
185 /* last time through, pad cache with zeros and drain cache */
186 if (cachedBits + bitsLeft <= 0) return -1;
187 if (bitsLeft > 0) cache |= (unsigned int)(*buf++) << (24 - cachedBits);
188 if (bitsLeft > 8) cache |= (unsigned int)(*buf++) << (16 - cachedBits);
189 cachedBits += bitsLeft;
190 bitsLeft = 0;
191
192 cache &= (signed int)(int32_t)0x80000000 >> (cachedBits - 1);
193 padBits = 11;
194 cachedBits += padBits; /* okay if this is > 32 (0's automatically shifted in from right) */
195 }
196
197 /* largest maxBits = 9, plus 2 for sign bits, so make sure cache has at least 11 bits */
198 while (nVals > 0 && cachedBits >= 11 ) {
199 maxBits = GetMaxbits(tCurr[0]);
200 cw = tCurr[(cache >> (32 - maxBits)) + 1];
201 len = GetHLen(cw);
202 if (!len) {
203 cachedBits -= maxBits;
204 cache <<= maxBits;
205 tCurr += cw;
206 continue;
207 }
208 cachedBits -= len;
209 cache <<= len;
210
211 x = GetCWX(cw);
212 y = GetCWY(cw);
213
214 if (x == 15 && tabType == loopLinbits) {
215 minBits = linBits + 1 + (y ? 1 : 0);
216 if (cachedBits + bitsLeft < minBits)
217 return -1;
218 while (cachedBits < minBits) {
219 cache |= (unsigned int)(*buf++) << (24 - cachedBits);
220 cachedBits += 8;
221 bitsLeft -= 8;
222 }
223 if (bitsLeft < 0) {
224 cachedBits += bitsLeft;
225 bitsLeft = 0;
226 cache &= (signed int)(int32_t)0x80000000 >> (cachedBits - 1);
227 }
228 x += (int)(cache >> (32 - linBits));
229 cachedBits -= linBits;
230 cache <<= linBits;
231 }
232 if (x) {ApplySign(x, cache); cache <<= 1; cachedBits--;}
233
234 if (y == 15 && tabType == loopLinbits) {
235 minBits = linBits + 1;
236 if (cachedBits + bitsLeft < minBits)
237 return -1;
238 while (cachedBits < minBits) {
239 cache |= (unsigned int)(*buf++) << (24 - cachedBits);
240 cachedBits += 8;
241 bitsLeft -= 8;
242 }
243 if (bitsLeft < 0) {
244 cachedBits += bitsLeft;
245 bitsLeft = 0;
246 cache &= (signed int)(int32_t)0x80000000 >> (cachedBits - 1);
247 }
248 y += (int)(cache >> (32 - linBits));
249 cachedBits -= linBits;
250 cache <<= linBits;
251 }
252 if (y) {ApplySign(y, cache); cache <<= 1; cachedBits--;}
253
254 /* ran out of bits - should never have consumed padBits */
255 if (cachedBits < padBits)
256 return -1;
257
258 *xy++ = x;
259 *xy++ = y;
260 nVals -= 2;
261 tCurr = tBase;
262 }
263 }
264 bitsLeft += (cachedBits - padBits);
265 return (startBits - bitsLeft);
266 }
267
268 /* error in bitstream - trying to access unused Huffman table */
269 return -1;
270}
unsigned int xy(unsigned int x, unsigned int y)
#define HUFF_PAIRTABS
Definition coder.h:105
#define GetCWY(x)
Definition huffman.hpp:54
#define GetCWX(x)
Definition huffman.hpp:55
#define GetMaxbits(x)
Definition huffman.hpp:52
#define GetHLen(x)
Definition huffman.hpp:53
#define ApplySign(x, s)
Definition huffman.hpp:65
const int32_t huffTabOffset[HUFF_PAIRTABS]
Definition hufftabs.hpp:668
const HuffTabLookup huffTabLookup[HUFF_PAIRTABS]
Definition hufftabs.hpp:703
const unsigned short huffTable[]
Definition hufftabs.hpp:81

References ApplySign, ASSERT, FL_NOEXCEPT, GetCWX, GetCWY, GetHLen, GetMaxbits, HUFF_PAIRTABS, huffTable, huffTabLookup, huffTabOffset, invalidTab, loopLinbits, loopNoLinbits, noBits, oneShot, fl::x, xy(), and fl::y.

Referenced by DecodeHuffman().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DecodeHuffmanQuads()

static int fl::third_party::DecodeHuffmanQuads ( int32_t * vwxy,
int nVals,
int tabIdx,
int bitsLeft,
const unsigned char * buf,
int bitOffset )
static

Definition at line 292 of file huffman.hpp.

293{
294 int i, v, w, x, y;
295 int len, maxBits, cachedBits, padBits;
296 unsigned int cache;
297 unsigned char cw, *tBase;
298
299 if (bitsLeft <= 0)
300 return 0;
301
302 tBase = (unsigned char *)quadTable + quadTabOffset[tabIdx];
303 maxBits = quadTabMaxBits[tabIdx];
304
305 /* initially fill cache with any partial byte */
306 cache = 0;
307 cachedBits = (8 - bitOffset) & 0x07;
308 if (cachedBits)
309 cache = (unsigned int)(*buf++) << (32 - cachedBits);
310 bitsLeft -= cachedBits;
311
312 i = padBits = 0;
313 while (i < (nVals - 3)) {
314 /* refill cache - assumes cachedBits <= 16 */
315 if (bitsLeft >= 16) {
316 /* load 2 new bytes into left-justified cache */
317 cache |= (unsigned int)(*buf++) << (24 - cachedBits);
318 cache |= (unsigned int)(*buf++) << (16 - cachedBits);
319 cachedBits += 16;
320 bitsLeft -= 16;
321 } else {
322 /* last time through, pad cache with zeros and drain cache */
323 if (cachedBits + bitsLeft <= 0) return i;
324 if (bitsLeft > 0) cache |= (unsigned int)(*buf++) << (24 - cachedBits);
325 if (bitsLeft > 8) cache |= (unsigned int)(*buf++) << (16 - cachedBits);
326 cachedBits += bitsLeft;
327 bitsLeft = 0;
328
329 cache &= (signed int)(int32_t)0x80000000 >> (cachedBits - 1);
330 padBits = 10;
331 cachedBits += padBits; /* okay if this is > 32 (0's automatically shifted in from right) */
332 }
333
334 /* largest maxBits = 6, plus 4 for sign bits, so make sure cache has at least 10 bits */
335 while (i < (nVals - 3) && cachedBits >= 10 ) {
336 cw = tBase[cache >> (32 - maxBits)];
337 len = GetHLenQ(cw);
338 cachedBits -= len;
339 cache <<= len;
340
341 v = GetCWVQ(cw); if(v) {ApplySign(v, cache); cache <<= 1; cachedBits--;}
342 w = GetCWWQ(cw); if(w) {ApplySign(w, cache); cache <<= 1; cachedBits--;}
343 x = GetCWXQ(cw); if(x) {ApplySign(x, cache); cache <<= 1; cachedBits--;}
344 y = GetCWYQ(cw); if(y) {ApplySign(y, cache); cache <<= 1; cachedBits--;}
345
346 /* ran out of bits - okay (means we're done) */
347 if (cachedBits < padBits)
348 return i;
349
350 *vwxy++ = v;
351 *vwxy++ = w;
352 *vwxy++ = x;
353 *vwxy++ = y;
354 i += 4;
355 }
356 }
357
358 /* decoded max number of quad values */
359 return i;
360}
#define GetCWVQ(x)
Definition huffman.hpp:59
#define GetCWWQ(x)
Definition huffman.hpp:60
#define GetHLenQ(x)
Definition huffman.hpp:58
#define GetCWXQ(x)
Definition huffman.hpp:61
#define GetCWYQ(x)
Definition huffman.hpp:62
const int32_t quadTabOffset[2]
Definition hufftabs.hpp:758
const unsigned char quadTable[64+16]
Definition hufftabs.hpp:743
const int32_t quadTabMaxBits[2]
Definition hufftabs.hpp:759
fl::i32 int32_t
Definition s16x16x4.h:220

References ApplySign, FL_NOEXCEPT, GetCWVQ, GetCWWQ, GetCWXQ, GetCWYQ, GetHLenQ, quadTable, quadTabMaxBits, quadTabOffset, fl::x, and fl::y.

Referenced by DecodeHuffman().

+ Here is the caller graph for this function:

◆ DequantBlock()

static int fl::third_party::DequantBlock ( int32_t * inbuf,
int32_t * outbuf,
int num,
int scale )
static

Definition at line 140 of file dqchan.hpp.

141{
142 int tab4[4];
143 int32_t scalef, scalei, shift;
144 int32_t sx, x, y;
145 int32_t mask = 0;
146 const int32_t *tab16, *coef;
147
148 tab16 = pow43_14[scale & 0x3];
149 scalef = pow14[scale & 0x3];
150 scalei = MIN(scale >> 2, 31); /* smallest input scale = -47, so smallest scalei = -12 */
151
152 /* cache first 4 values */
153 shift = MIN(scalei + 3, 31);
154 shift = MAX(shift, 0);
155 tab4[0] = 0;
156 tab4[1] = tab16[1] >> shift;
157 tab4[2] = tab16[2] >> shift;
158 tab4[3] = tab16[3] >> shift;
159
160 do {
161
162 sx = *inbuf++;
163 x = sx & 0x7fffffff; /* sx = sign|mag */
164
165 if (x < 4) {
166
167 y = tab4[x];
168
169 } else if (x < 16) {
170
171 y = tab16[x];
172 y = (scalei < 0) ? y << -scalei : y >> scalei;
173
174 } else {
175
176 if (x < 64) {
177
178 y = pow43[x-16];
179
180 /* fractional scale */
181 y = MULSHIFT32(y, scalef);
182 shift = scalei - 3;
183
184 } else {
185
186 /* normalize to [0x40000000, 0x7fffffff] */
187 x <<= 17;
188 shift = 0;
189 if (x < 0x08000000)
190 x <<= 4, shift += 4;
191 if (x < 0x20000000)
192 x <<= 2, shift += 2;
193 if (x < 0x40000000)
194 x <<= 1, shift += 1;
195
196 coef = (x < SQRTHALF) ? poly43lo : poly43hi;
197
198 /* polynomial */
199 y = coef[0];
200 y = MULSHIFT32(y, x) + coef[1];
201 y = MULSHIFT32(y, x) + coef[2];
202 y = MULSHIFT32(y, x) + coef[3];
203 y = MULSHIFT32(y, x) + coef[4];
204 y = MULSHIFT32(y, pow2frac[shift]) << 3;
205
206 /* fractional scale */
207 y = MULSHIFT32(y, scalef);
208 shift = scalei - pow2exp[shift];
209 }
210
211 /* integer scale */
212 if (shift < 0) {
213 shift = -shift;
214 if (y > ((int32_t)0x7fffffff >> shift))
215 y = (int32_t)0x7fffffff; /* clip */
216 else
217 y <<= shift;
218 } else {
219 y >>= shift;
220 }
221 }
222
223 /* sign and store */
224 mask |= y;
225 *outbuf++ = (sx < 0) ? -y : y;
226
227 } while (--num);
228
229 return mask;
230}
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::UISlider scale("Scale", 4,.1, 4,.1)
#define MAX(a, b)
Definition coder.h:60
#define SQRTHALF
Definition dqchan.hpp:105
int32_t pow43_14[4][16]
Definition dqchan.hpp:66
int32_t poly43lo[5]
Definition dqchan.hpp:115
int32_t pow14[4]
Definition dqchan.hpp:61
int32_t poly43hi[5]
Definition dqchan.hpp:116
int32_t pow2frac[8]
Definition dqchan.hpp:121
int32_t pow43[]
Definition dqchan.hpp:89

References FL_NOEXCEPT, MAX, MIN, MULSHIFT32(), poly43hi, poly43lo, pow14, pow2exp, pow2frac, pow43, pow43_14, scale, SQRTHALF, fl::x, and fl::y.

Referenced by DequantChannel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DequantChannel()

int32_t fl::third_party::DequantChannel ( int32_t * sampleBuf,
int32_t * workBuf,
int32_t * nonZeroBound,
FrameHeader * fh,
SideInfoSub * sis,
ScaleFactorInfoSub * sfis,
CriticalBandInfo * cbi )

Definition at line 252 of file dqchan.hpp.

254{
255 int32_t i, j, w, cb;
256 int32_t cbEndL, cbStartS, cbEndS;
257 int32_t nSamps, nonZero, sfactMultiplier, gbMask;
258 int32_t globalGain, gainI;
259 int32_t cbMax[3];
260 ARRAY3 *buf; /* short block reorder */
261
262 /* set default start/end points for short/long blocks - will update with non-zero cb info */
263 if (sis->blockType == 2) {
264 if (sis->mixedBlock) {
265 cbEndL = (fh->ver == MPEG1 ? 8 : 6);
266 cbStartS = 3;
267 } else {
268 cbEndL = 0;
269 cbStartS = 0;
270 }
271 cbEndS = 13;
272 } else {
273 /* long block */
274 cbEndL = 22;
275 cbStartS = 13;
276 cbEndS = 13;
277 }
278 cbMax[2] = cbMax[1] = cbMax[0] = 0;
279 gbMask = 0;
280 i = 0;
281
282 /* sfactScale = 0 --> quantizer step size = 2
283 * sfactScale = 1 --> quantizer step size = sqrt(2)
284 * so sfactMultiplier = 2 or 4 (jump through globalGain by powers of 2 or sqrt(2))
285 */
286 sfactMultiplier = 2 * (sis->sfactScale + 1);
287
288 /* offset globalGain by -2 if midSide enabled, for 1/sqrt(2) used in MidSideProc()
289 * (DequantBlock() does 0.25 * gainI so knocking it down by two is the same as
290 * dividing every sample by sqrt(2) = multiplying by 2^-.5)
291 */
292 globalGain = sis->globalGain;
293 if (fh->modeExt >> 1)
294 globalGain -= 2;
295 globalGain += IMDCT_SCALE; /* scale everything by sqrt(2), for fast IMDCT36 */
296
297 /* long blocks */
298 for (cb = 0; cb < cbEndL; cb++) {
299
300 nonZero = 0;
301 nSamps = fh->sfBand->l[cb + 1] - fh->sfBand->l[cb];
302 gainI = 210 - globalGain + sfactMultiplier * (sfis->l[cb] + (sis->preFlag ? (int)preTab[cb] : 0));
303
304 nonZero |= DequantBlock(sampleBuf + i, sampleBuf + i, nSamps, gainI);
305 i += nSamps;
306
307 /* update highest non-zero critical band */
308 if (nonZero)
309 cbMax[0] = cb;
310 gbMask |= nonZero;
311
312 if (i >= *nonZeroBound)
313 break;
314 }
315
316 /* set cbi (Type, EndS[], EndSMax will be overwritten if we proceed to do short blocks) */
317 cbi->cbType = 0; /* long only */
318 cbi->cbEndL = cbMax[0];
319 cbi->cbEndS[0] = cbi->cbEndS[1] = cbi->cbEndS[2] = 0;
320 cbi->cbEndSMax = 0;
321
322 /* early exit if no short blocks */
323 if (cbStartS >= 12)
324 return CLZ(gbMask) - 1;
325
326 /* short blocks */
327 cbMax[2] = cbMax[1] = cbMax[0] = cbStartS;
328 for (cb = cbStartS; cb < cbEndS; cb++) {
329
330 nSamps = fh->sfBand->s[cb + 1] - fh->sfBand->s[cb];
331 for (w = 0; w < 3; w++) {
332 nonZero = 0;
333 gainI = 210 - globalGain + 8*sis->subBlockGain[w] + sfactMultiplier*(sfis->s[cb][w]);
334
335 nonZero |= DequantBlock(sampleBuf + i + nSamps*w, workBuf + nSamps*w, nSamps, gainI);
336
337 /* update highest non-zero critical band */
338 if (nonZero)
339 cbMax[w] = cb;
340 gbMask |= nonZero;
341 }
342
343 /* reorder blocks */
344 buf = (ARRAY3 *)(sampleBuf + i);
345 i += 3*nSamps;
346 for (j = 0; j < nSamps; j++) {
347 buf[j][0] = workBuf[0*nSamps + j];
348 buf[j][1] = workBuf[1*nSamps + j];
349 buf[j][2] = workBuf[2*nSamps + j];
350 }
351
352 ASSERT(3*nSamps <= MAX_REORDER_SAMPS);
353
354 if (i >= *nonZeroBound)
355 break;
356 }
357
358 /* i = last non-zero INPUT sample processed, which corresponds to highest possible non-zero
359 * OUTPUT sample (after reorder)
360 * however, the original nzb is no longer necessarily true
361 * for each cb, buf[][] is updated with 3*nSamps samples (i increases 3*nSamps each time)
362 * (buf[j + 1][0] = 3 (input) samples ahead of buf[j][0])
363 * so update nonZeroBound to i
364 */
365 *nonZeroBound = i;
366
367 ASSERT(*nonZeroBound <= MAX_NSAMP);
368
369 cbi->cbType = (sis->mixedBlock ? 2 : 1); /* 2 = mixed short/long, 1 = short only */
370
371 cbi->cbEndS[0] = cbMax[0];
372 cbi->cbEndS[1] = cbMax[1];
373 cbi->cbEndS[2] = cbMax[2];
374
375 cbi->cbEndSMax = cbMax[0];
376 cbi->cbEndSMax = MAX(cbi->cbEndSMax, cbMax[1]);
377 cbi->cbEndSMax = MAX(cbi->cbEndSMax, cbMax[2]);
378
379 return CLZ(gbMask) - 1;
380}
#define MAX_REORDER_SAMPS
Definition coder.h:108
#define IMDCT_SCALE
Definition coder.h:103
static int DequantBlock(int32_t *inbuf, int32_t *outbuf, int num, int scale) FL_NOEXCEPT
Definition dqchan.hpp:140
static const char preTab[22]
Definition dqchan.hpp:58
int ARRAY3[3]
Definition dqchan.hpp:55
__inline int32_t CLZ(int32_t x) FL_NOEXCEPT
Leading zeros.
Definition assembly.h:527

References ASSERT, CLZ(), DequantBlock(), FL_NOEXCEPT, IMDCT_SCALE, MAX, MAX_NSAMP, MAX_REORDER_SAMPS, MPEG1, and preTab.

Referenced by Dequantize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Dequantize()

int fl::third_party::Dequantize ( MP3DecInfo * mp3DecInfo,
int gr )

Definition at line 78 of file dequant.hpp.

79{
80 int i, ch, nSamps;
81 int32_t mOut[2];
82 FrameHeader *fh;
83 SideInfo *si;
84 ScaleFactorInfo *sfi;
85 HuffmanInfo *hi;
86 DequantInfo *di;
88
89 /* validate pointers */
90 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || !mp3DecInfo->SideInfoPS || !mp3DecInfo->ScaleFactorInfoPS ||
91 !mp3DecInfo->HuffmanInfoPS || !mp3DecInfo->DequantInfoPS)
92 return -1;
93
94 fh = (FrameHeader *)(mp3DecInfo->FrameHeaderPS);
95
96 /* si is an array of up to 4 structs, stored as gr0ch0, gr0ch1, gr1ch0, gr1ch1 */
97 si = (SideInfo *)(mp3DecInfo->SideInfoPS);
98 sfi = (ScaleFactorInfo *)(mp3DecInfo->ScaleFactorInfoPS);
99 hi = (HuffmanInfo *)mp3DecInfo->HuffmanInfoPS;
100 di = (DequantInfo *)mp3DecInfo->DequantInfoPS;
101 cbi = di->cbi;
102 mOut[0] = mOut[1] = 0;
103
104 /* dequantize all the samples in each channel */
105 for (ch = 0; ch < mp3DecInfo->nChans; ch++) {
106 hi->gb[ch] = DequantChannel(hi->huffDecBuf[ch], di->workBuf, &hi->nonZeroBound[ch], fh,
107 &si->sis[gr][ch], &sfi->sfis[gr][ch], &cbi[ch]);
108 }
109
110 /* joint stereo processing assumes one guard bit in input samples
111 * it's extremely rare not to have at least one gb, so if this is the case
112 * just make a pass over the data and clip to [-2^30+1, 2^30-1]
113 * in practice this may never happen
114 */
115 if (fh->modeExt && (hi->gb[0] < 1 || hi->gb[1] < 1)) {
116 /* Clip to range [-2^30+1, 2^30-1] */
117 const int32_t max_clip = (int32_t)0x3FFFFFFFL; /* 2^30 - 1 */
118 const int32_t min_clip = (int32_t)(-0x40000000L); /* -(2^30) */
119 for (i = 0; i < hi->nonZeroBound[0]; i++) {
120 if (hi->huffDecBuf[0][i] < min_clip) hi->huffDecBuf[0][i] = min_clip;
121 if (hi->huffDecBuf[0][i] > max_clip) hi->huffDecBuf[0][i] = max_clip;
122 }
123 for (i = 0; i < hi->nonZeroBound[1]; i++) {
124 if (hi->huffDecBuf[1][i] < min_clip) hi->huffDecBuf[1][i] = min_clip;
125 if (hi->huffDecBuf[1][i] > max_clip) hi->huffDecBuf[1][i] = max_clip;
126 }
127 }
128
129 /* do mid-side stereo processing, if enabled */
130 if (fh->modeExt >> 1) {
131 if (fh->modeExt & 0x01) {
132 /* intensity stereo enabled - run mid-side up to start of right zero region */
133 if (cbi[1].cbType == 0)
134 nSamps = fh->sfBand->l[cbi[1].cbEndL + 1];
135 else
136 nSamps = 3 * fh->sfBand->s[cbi[1].cbEndSMax + 1];
137 } else {
138 /* intensity stereo disabled - run mid-side on whole spectrum */
139 nSamps = MAX(hi->nonZeroBound[0], hi->nonZeroBound[1]);
140 }
141 MidSideProc(hi->huffDecBuf, nSamps, mOut);
142 }
143
144 /* do intensity stereo processing, if enabled */
145 if (fh->modeExt & 0x01) {
146 nSamps = hi->nonZeroBound[0];
147 if (fh->ver == MPEG1) {
148 IntensityProcMPEG1(hi->huffDecBuf, nSamps, fh, &sfi->sfis[gr][1], di->cbi,
149 fh->modeExt >> 1, si->sis[gr][1].mixedBlock, mOut);
150 } else {
151 IntensityProcMPEG2(hi->huffDecBuf, nSamps, fh, &sfi->sfis[gr][1], di->cbi, &sfi->sfjs,
152 fh->modeExt >> 1, si->sis[gr][1].mixedBlock, mOut);
153 }
154 }
155
156 /* adjust guard bit count and nonZeroBound if we did any stereo processing */
157 if (fh->modeExt) {
158 hi->gb[0] = CLZ(mOut[0]) - 1;
159 hi->gb[1] = CLZ(mOut[1]) - 1;
160 nSamps = MAX(hi->nonZeroBound[0], hi->nonZeroBound[1]);
161 hi->nonZeroBound[0] = nSamps;
162 hi->nonZeroBound[1] = nSamps;
163 }
164
165 /* output format Q(DQ_FRACBITS_OUT) */
166 return 0;
167}
void MidSideProc(int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, int32_t mOut[2]) FL_NOEXCEPT
Definition stproc.hpp:71
void IntensityProcMPEG1(int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi, int32_t midSideFlag, int32_t mixFlag, int32_t mOut[2]) FL_NOEXCEPT
Definition stproc.hpp:113
void IntensityProcMPEG2(int32_t x[MAX_NCHAN][MAX_NSAMP], int32_t nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi, ScaleFactorJS *sfjs, int32_t midSideFlag, int32_t mixFlag, int32_t mOut[2]) FL_NOEXCEPT
Definition stproc.hpp:220
int32_t DequantChannel(int32_t *sampleBuf, int32_t *workBuf, int32_t *nonZeroBound, FrameHeader *fh, SideInfoSub *sis, ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi) FL_NOEXCEPT
Definition dqchan.hpp:252
ScaleFactorInfoSub sfis[MAX_NGRAN][MAX_NCHAN]
Definition coder.h:270
CriticalBandInfo cbi[MAX_NCHAN]
Definition coder.h:212
int32_t workBuf[MAX_REORDER_SAMPS]
Definition coder.h:211
int32_t gb[MAX_NCHAN]
Definition coder.h:218

References fl::third_party::CriticalBandInfo::cbEndL, fl::third_party::CriticalBandInfo::cbEndSMax, fl::third_party::_DequantInfo::cbi, CLZ(), DequantChannel(), FL_NOEXCEPT, fl::third_party::_HuffmanInfo::gb, fl::third_party::_HuffmanInfo::huffDecBuf, IntensityProcMPEG1(), IntensityProcMPEG2(), fl::third_party::_SFBandTable::l, MAX, MidSideProc(), fl::third_party::_SideInfoSub::mixedBlock, fl::third_party::_FrameHeader::modeExt, MPEG1, fl::third_party::_HuffmanInfo::nonZeroBound, fl::third_party::_SFBandTable::s, fl::third_party::_FrameHeader::sfBand, fl::third_party::_ScaleFactorInfo::sfis, fl::third_party::_ScaleFactorInfo::sfjs, fl::third_party::_SideInfo::sis, fl::third_party::_FrameHeader::ver, and fl::third_party::_DequantInfo::workBuf.

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FASTABS()

__inline int32_t fl::third_party::FASTABS ( int32_t x)

Absolute value of x.

Definition at line 513 of file assembly.h.

514{
516
517 sign = x >> (sizeof(int32_t) * 8 - 1);
518 x ^= sign;
519 x -= sign;
520
521 return x;
522}

References FL_NOEXCEPT, fl::sign(), and fl::x.

Referenced by FreqInvertRescale(), HybridTransform(), IMDCT12x3(), IMDCT36(), IntensityProcMPEG1(), IntensityProcMPEG2(), and MidSideProc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FDCT32()

void fl::third_party::FDCT32 ( int32_t * x,
int32_t * d,
int32_t offset,
int32_t oddBlock,
int32_t gb )

Definition at line 151 of file dct32.hpp.

152{
153 int32_t i, s, tmp, es;
154 const int32_t *cptr = dcttab;
155 int32_t a0, a1, a2, a3, a4, a5, a6, a7;
156 int32_t b0, b1, b2, b3, b4, b5, b6, b7;
157 int32_t *d;
158
159 /* scaling - ensure at least 6 guard bits for DCT
160 * (in practice this is already true 99% of time, so this code is
161 * almost never triggered)
162 */
163 es = 0;
164 if (gb < 6) {
165 es = 6 - gb;
166 for (i = 0; i < 32; i++)
167 buf[i] >>= es;
168 }
169
170 /* first pass */
171 D32FP(0, 1, 5, 1);
172 D32FP(1, 1, 3, 1);
173 D32FP(2, 1, 3, 1);
174 D32FP(3, 1, 2, 1);
175 D32FP(4, 1, 2, 1);
176 D32FP(5, 1, 1, 2);
177 D32FP(6, 1, 1, 2);
178 D32FP(7, 1, 1, 4);
179
180 /* second pass */
181 for (i = 4; i > 0; i--) {
182 a0 = buf[0]; a7 = buf[7]; a3 = buf[3]; a4 = buf[4];
183 b0 = a0 + a7; b7 = MULSHIFT32(*cptr++, a0 - a7) * 2L;
184 b3 = a3 + a4; b4 = MULSHIFT32(*cptr++, a3 - a4) * 8L;
185 a0 = b0 + b3; a3 = MULSHIFT32(*cptr, b0 - b3) * 2L;
186 a4 = b4 + b7; a7 = MULSHIFT32(*cptr++, b7 - b4) * 2L;
187
188 a1 = buf[1]; a6 = buf[6]; a2 = buf[2]; a5 = buf[5];
189 b1 = a1 + a6; b6 = MULSHIFT32(*cptr++, a1 - a6) * 2L;
190 b2 = a2 + a5; b5 = MULSHIFT32(*cptr++, a2 - a5) * 2L;
191 a1 = b1 + b2; a2 = MULSHIFT32(*cptr, b1 - b2) * 4L;
192 a5 = b5 + b6; a6 = MULSHIFT32(*cptr++, b6 - b5) * 4L;
193
194 b0 = a0 + a1; b1 = MULSHIFT32(COS4_0, a0 - a1) * 2L;
195 b2 = a2 + a3; b3 = MULSHIFT32(COS4_0, a3 - a2) * 2L;
196 buf[0] = b0; buf[1] = b1;
197 buf[2] = b2 + b3; buf[3] = b3;
198
199 b4 = a4 + a5; b5 = MULSHIFT32(COS4_0, a4 - a5) * 2L;
200 b6 = a6 + a7; b7 = MULSHIFT32(COS4_0, a7 - a6) * 2L;
201 b6 += b7;
202 buf[4] = b4 + b6; buf[5] = b5 + b7;
203 buf[6] = b5 + b6; buf[7] = b7;
204
205 buf += 8;
206 }
207 buf -= 32; /* reset */
208
209 /* sample 0 - always delayed one block */
210 d = dest + 64*16 + ((offset - oddBlock) & 7) + (oddBlock ? 0 : VBUF_LENGTH);
211 s = buf[ 0]; d[0] = d[8] = s;
212
213 /* samples 16 to 31 */
214 d = dest + offset + (oddBlock ? VBUF_LENGTH : 0);
215
216 s = buf[ 1]; d[0] = d[8] = s; d += 64;
217
218 tmp = buf[25] + buf[29];
219 s = buf[17] + tmp; d[0] = d[8] = s; d += 64;
220 s = buf[ 9] + buf[13]; d[0] = d[8] = s; d += 64;
221 s = buf[21] + tmp; d[0] = d[8] = s; d += 64;
222
223 tmp = buf[29] + buf[27];
224 s = buf[ 5]; d[0] = d[8] = s; d += 64;
225 s = buf[21] + tmp; d[0] = d[8] = s; d += 64;
226 s = buf[13] + buf[11]; d[0] = d[8] = s; d += 64;
227 s = buf[19] + tmp; d[0] = d[8] = s; d += 64;
228
229 tmp = buf[27] + buf[31];
230 s = buf[ 3]; d[0] = d[8] = s; d += 64;
231 s = buf[19] + tmp; d[0] = d[8] = s; d += 64;
232 s = buf[11] + buf[15]; d[0] = d[8] = s; d += 64;
233 s = buf[23] + tmp; d[0] = d[8] = s; d += 64;
234
235 tmp = buf[31];
236 s = buf[ 7]; d[0] = d[8] = s; d += 64;
237 s = buf[23] + tmp; d[0] = d[8] = s; d += 64;
238 s = buf[15]; d[0] = d[8] = s; d += 64;
239 s = tmp; d[0] = d[8] = s;
240
241 /* samples 16 to 1 (sample 16 used again) */
242 d = dest + 16 + ((offset - oddBlock) & 7) + (oddBlock ? 0 : VBUF_LENGTH);
243
244 s = buf[ 1]; d[0] = d[8] = s; d += 64;
245
246 tmp = buf[30] + buf[25];
247 s = buf[17] + tmp; d[0] = d[8] = s; d += 64;
248 s = buf[14] + buf[ 9]; d[0] = d[8] = s; d += 64;
249 s = buf[22] + tmp; d[0] = d[8] = s; d += 64;
250 s = buf[ 6]; d[0] = d[8] = s; d += 64;
251
252 tmp = buf[26] + buf[30];
253 s = buf[22] + tmp; d[0] = d[8] = s; d += 64;
254 s = buf[10] + buf[14]; d[0] = d[8] = s; d += 64;
255 s = buf[18] + tmp; d[0] = d[8] = s; d += 64;
256 s = buf[ 2]; d[0] = d[8] = s; d += 64;
257
258 tmp = buf[28] + buf[26];
259 s = buf[18] + tmp; d[0] = d[8] = s; d += 64;
260 s = buf[12] + buf[10]; d[0] = d[8] = s; d += 64;
261 s = buf[20] + tmp; d[0] = d[8] = s; d += 64;
262 s = buf[ 4]; d[0] = d[8] = s; d += 64;
263
264 tmp = buf[24] + buf[28];
265 s = buf[20] + tmp; d[0] = d[8] = s; d += 64;
266 s = buf[ 8] + buf[12]; d[0] = d[8] = s; d += 64;
267 s = buf[16] + tmp; d[0] = d[8] = s;
268
269 /* this is so rarely invoked that it's not worth making two versions of the output
270 * shuffle code (one for no shift, one for clip + variable shift) like in IMDCT
271 * here we just load, clip, shift, and store on the rare instances that es != 0
272 */
273 if (es) {
274 d = dest + 64*16 + ((offset - oddBlock) & 7) + (oddBlock ? 0 : VBUF_LENGTH);
275 s = d[0]; CLIP_2N(s, 31 - es); d[0] = d[8] = (s << es);
276
277 d = dest + offset + (oddBlock ? VBUF_LENGTH : 0);
278 for (i = 16; i <= 31; i++) {
279 s = d[0]; CLIP_2N(s, 31 - es); d[0] = d[8] = (s << es); d += 64;
280 }
281
282 d = dest + 16 + ((offset - oddBlock) & 7) + (oddBlock ? 0 : VBUF_LENGTH);
283 for (i = 15; i >= 0; i--) {
284 s = d[0]; CLIP_2N(s, 31 - es); d[0] = d[8] = (s << es); d += 64;
285 }
286 }
287}
#define VBUF_LENGTH
Definition coder.h:109
#define CLIP_2N(y, n)
Definition coder.h:89
#define COS4_0
Definition dct32.hpp:89
#define D32FP(i, s0, s1, s2)
Definition dct32.hpp:113
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
static const int32_t dcttab[48]
Definition dct32.hpp:92

References CLIP_2N, COS4_0, D32FP, dcttab, FL_NOEXCEPT, MULSHIFT32(), offset(), and VBUF_LENGTH.

Referenced by Subband().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FreeBuffers()

void fl::third_party::FreeBuffers ( MP3DecInfo * mp3DecInfo)

Definition at line 163 of file buffers.hpp.

164{
165 if (!mp3DecInfo)
166 return;
167
168 SAFE_FREE(mp3DecInfo->FrameHeaderPS);
169 SAFE_FREE(mp3DecInfo->SideInfoPS);
170 SAFE_FREE(mp3DecInfo->ScaleFactorInfoPS);
171 SAFE_FREE(mp3DecInfo->HuffmanInfoPS);
172 SAFE_FREE(mp3DecInfo->DequantInfoPS);
173 SAFE_FREE(mp3DecInfo->IMDCTInfoPS);
174 SAFE_FREE(mp3DecInfo->SubbandInfoPS);
175
176 SAFE_FREE(mp3DecInfo);
177}
#define SAFE_FREE(x)
Definition buffers.hpp:148

References FL_NOEXCEPT, and SAFE_FREE.

Referenced by AllocateBuffers(), and MP3FreeDecoder().

+ Here is the caller graph for this function:

◆ FreqInvertRescale()

static int32_t fl::third_party::FreqInvertRescale ( int32_t * y,
int32_t * xPrev,
int32_t blockIdx,
int32_t es )
static

Definition at line 195 of file imdct.hpp.

196{
197 int32_t i;
198 int32_t d, mOut;
199 int32_t y0, y1, y2, y3, y4, y5, y6, y7, y8;
200
201 if (es == 0) {
202 /* fast case - frequency invert only (no rescaling) - can fuse into overlap-add for speed, if desired */
203 if (blockIdx & 0x01) {
204 y += NBANDS;
205 y0 = *y; y += 2*NBANDS;
206 y1 = *y; y += 2*NBANDS;
207 y2 = *y; y += 2*NBANDS;
208 y3 = *y; y += 2*NBANDS;
209 y4 = *y; y += 2*NBANDS;
210 y5 = *y; y += 2*NBANDS;
211 y6 = *y; y += 2*NBANDS;
212 y7 = *y; y += 2*NBANDS;
213 y8 = *y; y += 2*NBANDS;
214
215 y -= 18*NBANDS;
216 *y = -y0; y += 2*NBANDS;
217 *y = -y1; y += 2*NBANDS;
218 *y = -y2; y += 2*NBANDS;
219 *y = -y3; y += 2*NBANDS;
220 *y = -y4; y += 2*NBANDS;
221 *y = -y5; y += 2*NBANDS;
222 *y = -y6; y += 2*NBANDS;
223 *y = -y7; y += 2*NBANDS;
224 *y = -y8; y += 2*NBANDS;
225 }
226 return 0;
227 } else {
228 /* undo pre-IMDCT scaling, clipping if necessary */
229 mOut = 0;
230 if (blockIdx & 0x01) {
231 /* frequency invert */
232 for (i = 0; i < 18; i+=2) {
233 d = *y; CLIP_2N(d, 31 - es); *y = static_cast<int>(static_cast<unsigned int>(d) << es); mOut |= FASTABS(*y); y += NBANDS;
234 d = -*y; CLIP_2N(d, 31 - es); *y = static_cast<int>(static_cast<unsigned int>(d) << es); mOut |= FASTABS(*y); y += NBANDS;
235 d = *xPrev; CLIP_2N(d, 31 - es); *xPrev++ = static_cast<int>(static_cast<unsigned int>(d) << es);
236 }
237 } else {
238 for (i = 0; i < 18; i+=2) {
239 d = *y; CLIP_2N(d, 31 - es); *y = static_cast<int>(static_cast<unsigned int>(d) << es); mOut |= FASTABS(*y); y += NBANDS;
240 d = *y; CLIP_2N(d, 31 - es); *y = static_cast<int>(static_cast<unsigned int>(d) << es); mOut |= FASTABS(*y); y += NBANDS;
241 d = *xPrev; CLIP_2N(d, 31 - es); *xPrev++ = static_cast<int>(static_cast<unsigned int>(d) << es);
242 }
243 }
244 return mOut;
245 }
246}
#define NBANDS
Definition coder.h:107
__inline int32_t FASTABS(int32_t x) FL_NOEXCEPT
Absolute value of x.
Definition assembly.h:513

References CLIP_2N, FASTABS(), FL_NOEXCEPT, NBANDS, and fl::y.

Referenced by IMDCT12x3(), and IMDCT36().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBits()

uint32_t fl::third_party::GetBits ( BitStreamInfo * bsi,
int32_t nBits )

Definition at line 134 of file bitstream.hpp.

135{
136 uint32_t data, lowBits;
137
138 nBits &= 0x1f; /* nBits mod 32 to avoid unpredictable results like >> by negative amount */
139 data = bsi->iCache >> (31 - nBits); /* unsigned >> so zero-extend */
140 data >>= 1; /* do as >> 31, >> 1 so that nBits = 0 works okay (returns 0) */
141 bsi->iCache <<= nBits; /* left-justify cache */
142 bsi->cachedBits -= nBits; /* how many bits have we drawn from the cache so far */
143
144 /* if we cross an int boundary, refill the cache */
145 if (bsi->cachedBits < 0) {
146 lowBits = -bsi->cachedBits;
148 data |= bsi->iCache >> (32 - lowBits); /* get the low-order bits */
149
150 bsi->cachedBits -= lowBits; /* how many bits have we drawn from the cache so far */
151 bsi->iCache <<= lowBits; /* left-justify cache */
152 }
153
154 return data;
155}
static __inline void RefillBitstreamCache(BitStreamInfo *bsi) FL_NOEXCEPT
Definition bitstream.hpp:92

References FL_NOEXCEPT, and RefillBitstreamCache().

Referenced by UnpackScaleFactors(), UnpackSFMPEG1(), UnpackSFMPEG2(), and UnpackSideInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gif__clip()

static fl::u32 fl::third_party::gif__clip ( fl::u32 frame_off,
fl::u32 frame_dim,
fl::u32 image_ext )
inlinestatic

Get any frame clip adjustment for the image extent.

Parameters
[in]frame_offFrame's X or Y offset.
[in]frame_dimFrame width or height.
[in]image_extImage width or height constraint.
Returns
the amount the frame needs to be clipped to fit the image in given dimension.

Definition at line 413 of file gif.cpp.hpp.

417{
418 fl::u32 frame_ext = frame_off + frame_dim;
419
420 if (frame_ext <= image_ext) {
421 return 0;
422 }
423
424 return frame_ext - image_ext;
425}

References FL_NOEXCEPT.

Referenced by nsgif__decode_complex(), nsgif__decode_simple(), and nsgif__restore_bg().

+ Here is the caller graph for this function:

◆ gif__jump_data()

static void fl::third_party::gif__jump_data ( fl::u32 * skip,
fl::u32 * available,
const fl::u8 ** pos )
inlinestatic

Perform any jump over decoded data, to accommodate clipped portion of frame.

Parameters
[in,out]skipNumber of pixels of data to jump.
[in,out]availableNumber of pixels of data currently available.
[in,out]posPosition in decoded pixel value data.

Definition at line 434 of file gif.cpp.hpp.

438{
439 fl::u32 jump = (*skip < *available) ? *skip : *available;
440
441 *skip -= jump;
442 *available -= jump;
443 *pos += jump;
444}
uint8_t pos
Definition Blur.ino:11
int available()

References fl::available(), FL_NOEXCEPT, and pos.

Referenced by nsgif__decode_complex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ huffext()

static int fl::third_party::huffext ( JDEC * jd,
unsigned int id,
unsigned int cls )
static

Definition at line 291 of file tjpgd.cpp.hpp.

296{
297 size_t dc = jd->dctr;
298 uint8_t *dp = jd->dptr;
299 unsigned int d, flg = 0;
300
301#if JD_FASTDECODE == 0
302 uint8_t bm, nd, bl;
303 const uint8_t *hb = jd->huffbits[id][cls]; /* Bit distribution table */
304 const uint16_t *hc = jd->huffcode[id][cls]; /* Code word table */
305 const uint8_t *hd = jd->huffdata[id][cls]; /* Data table */
306
307
308 bm = jd->dbit; /* Bit mask to extract */
309 d = 0; bl = 16; /* Max code length */
310 do {
311 if (!bm) { /* Next byte? */
312 if (!dc) { /* No input data is available, re-fill input buffer */
313 dp = jd->inbuf; /* Top of input buffer */
314 dc = jd->infunc(jd, dp, JD_SZBUF);
315 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */
316 } else {
317 dp++; /* Next data ptr */
318 }
319 dc--; /* Decrement number of available bytes */
320 if (flg) { /* In flag sequence? */
321 flg = 0; /* Exit flag sequence */
322 if (*dp != 0) return 0 - (int)JDR_FMT1; /* Err: unexpected flag is detected (may be collapted data) */
323 *dp = 0xFF; /* The flag is a data 0xFF */
324 } else {
325 if (*dp == 0xFF) { /* Is start of flag sequence? */
326 flg = 1; continue; /* Enter flag sequence, get trailing byte */
327 }
328 }
329 bm = 0x80; /* Read from MSB */
330 }
331 d <<= 1; /* Get a bit */
332 if (*dp & bm) d++;
333 bm >>= 1;
334
335 for (nd = *hb++; nd; nd--) { /* Search the code word in this bit length */
336 if (d == *hc++) { /* Matched? */
337 jd->dbit = bm; jd->dctr = dc; jd->dptr = dp;
338 return *hd; /* Return the decoded data */
339 }
340 hd++;
341 }
342 bl--;
343 } while (bl);
344
345#else
346 const uint8_t *hb, *hd;
347 const uint16_t *hc;
348 unsigned int nc, bl, wbit = jd->dbit % 32;
349 uint32_t w = jd->wreg & ((1UL << wbit) - 1);
350
351
352 while (wbit < 16) { /* Prepare 16 bits into the working register */
353 if (jd->marker) {
354 d = 0xFF; /* Input stream has stalled for a marker. Generate stuff bits */
355 } else {
356 if (!dc) { /* Buffer empty, re-fill input buffer */
357 dp = jd->inbuf; /* Top of input buffer */
358 dc = jd->infunc(jd, dp, JD_SZBUF);
359 if (!dc) return 0 - (int)JDR_INP; /* Err: read error or wrong stream termination */
360 }
361 d = *dp++; dc--;
362 if (flg) { /* In flag sequence? */
363 flg = 0; /* Exit flag sequence */
364 if (d != 0) jd->marker = d; /* Not an escape of 0xFF but a marker */
365 d = 0xFF;
366 } else {
367 if (d == 0xFF) { /* Is start of flag sequence? */
368 flg = 1; continue; /* Enter flag sequence, get trailing byte */
369 }
370 }
371 }
372 w = w << 8 | d; /* Shift 8 bits in the working register */
373 wbit += 8;
374 }
375 jd->dctr = dc; jd->dptr = dp;
376 jd->wreg = w;
377
378#if JD_FASTDECODE == 2
379 /* Table serch for the short codes */
380 d = (unsigned int)(w >> (wbit - HUFF_BIT)); /* Short code as table index */
381 if (cls) { /* AC element */
382 d = jd->hufflut_ac[id][d]; /* Table decode */
383 if (d != 0xFFFF) { /* It is done if hit in short code */
384 jd->dbit = wbit - (d >> 8); /* Snip the code length */
385 return d & 0xFF; /* b7..0: zero run and following data bits */
386 }
387 } else { /* DC element */
388 d = jd->hufflut_dc[id][d]; /* Table decode */
389 if (d != 0xFF) { /* It is done if hit in short code */
390 jd->dbit = wbit - (d >> 4); /* Snip the code length */
391 return d & 0xF; /* b3..0: following data bits */
392 }
393 }
394
395 /* Incremental serch for the codes longer than HUFF_BIT */
396 hb = jd->huffbits[id][cls] + HUFF_BIT; /* Bit distribution table */
397 hc = jd->huffcode[id][cls] + jd->longofs[id][cls]; /* Code word table */
398 hd = jd->huffdata[id][cls] + jd->longofs[id][cls]; /* Data table */
399 bl = HUFF_BIT + 1;
400#else
401 /* Incremental serch for all codes */
402 hb = jd->huffbits[id][cls]; /* Bit distribution table */
403 hc = jd->huffcode[id][cls]; /* Code word table */
404 hd = jd->huffdata[id][cls]; /* Data table */
405 bl = 1;
406#endif
407 for ( ; bl <= 16; bl++) { /* Incremental search */
408 nc = *hb++;
409 if (nc) {
410 d = w >> (wbit - bl);
411 do { /* Search the code word in this bit length */
412 if (d == *hc++) { /* Matched? */
413 jd->dbit = wbit - bl; /* Snip the huffman code */
414 return *hd; /* Return the decoded data */
415 }
416 hd++;
417 } while (--nc);
418 }
419 }
420#endif
421
422 return 0 - (int)JDR_FMT1; /* Err: code not found (may be collapted data) */
423}

References FL_NOEXCEPT, JD_SZBUF, JDR_FMT1, and JDR_INP.

Referenced by mcu_load().

+ Here is the caller graph for this function:

◆ HybridTransform()

static int32_t fl::third_party::HybridTransform ( int32_t * xCurr,
int32_t * xPrev,
int32_t y[BLOCK_SIZE][NBANDS],
SideInfoSub * sis,
BlockCount * bc )
static

Definition at line 634 of file imdct.hpp.

635{
636 int32_t xPrevWin[18];
637 int32_t currWinIdx, prevWinIdx;
638 int32_t i, j, nBlocksOut, nonZero, mOut;
639 int32_t xp;
640
641 ASSERT(bc->nBlocksLong <= NBANDS);
642 ASSERT(bc->nBlocksTotal <= NBANDS);
643 ASSERT(bc->nBlocksPrev <= NBANDS);
644
645 mOut = 0;
646
647 /* do long blocks, if any */
648 for(i = 0; i < bc->nBlocksLong; i++) {
649 /* currWinIdx picks the right window for long blocks (if mixed, long blocks use window type 0) */
650 currWinIdx = sis->blockType;
651 if (sis->mixedBlock && i < bc->currWinSwitch)
652 currWinIdx = 0;
653
654 prevWinIdx = bc->prevType;
655 if (i < bc->prevWinSwitch)
656 prevWinIdx = 0;
657
658 /* do 36-point IMDCT, including windowing and overlap-add */
659 mOut |= IMDCT36(xCurr, xPrev, &(y[0][i]), currWinIdx, prevWinIdx, i, bc->gbIn);
660 xCurr += 18;
661 xPrev += 9;
662 }
663
664 /* do short blocks (if any) */
665 for ( ; i < bc->nBlocksTotal; i++) {
666 ASSERT(sis->blockType == 2);
667
668 prevWinIdx = bc->prevType;
669 if (i < bc->prevWinSwitch)
670 prevWinIdx = 0;
671
672 mOut |= IMDCT12x3(xCurr, xPrev, &(y[0][i]), prevWinIdx, i, bc->gbIn);
673 xCurr += 18;
674 xPrev += 9;
675 }
676 nBlocksOut = i;
677
678 /* window and overlap prev if prev longer that current */
679 for ( ; i < bc->nBlocksPrev; i++) {
680 prevWinIdx = bc->prevType;
681 if (i < bc->prevWinSwitch)
682 prevWinIdx = 0;
683 WinPrevious(xPrev, xPrevWin, prevWinIdx);
684
685 nonZero = 0;
686 /* sign_bit = -1 for odd i, 0 for even i */
687 int32_t sign_bit = ((i & 1) ? (int32_t)(-1) : 0);
688 for (j = 0; j < 9; j++) {
689 xp = xPrevWin[2*j+0] * 4L; /* * 4 temp for scaling */
690 nonZero |= xp;
691 y[2*j+0][i] = xp;
692 mOut |= FASTABS(xp);
693
694 /* frequency inversion on odd blocks/odd samples (flip sign if i odd, j odd) */
695 xp = xPrevWin[2*j+1] * 4L;
696 xp = (xp ^ sign_bit) + (i & 0x01);
697 nonZero |= xp;
698 y[2*j+1][i] = xp;
699 mOut |= FASTABS(xp);
700
701 xPrev[j] = 0;
702 }
703 xPrev += 9;
704 if (nonZero)
705 nBlocksOut = i;
706 }
707
708 /* clear rest of blocks */
709 for ( ; i < 32; i++) {
710 for (j = 0; j < 18; j++)
711 y[j][i] = 0;
712 }
713
714 bc->gbOut = CLZ(mOut) - 1;
715
716 return nBlocksOut;
717}
static void WinPrevious(int32_t *xPrev, int32_t *xPrevWin, int32_t btPrev) FL_NOEXCEPT
Definition imdct.hpp:141
static int32_t IMDCT12x3(int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
Definition imdct.hpp:551
static int32_t IMDCT36(int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btCurr, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
Definition imdct.hpp:381

References ASSERT, BLOCK_SIZE, CLZ(), FASTABS(), FL_NOEXCEPT, IMDCT12x3(), IMDCT36(), NBANDS, WinPrevious(), and fl::y.

Referenced by IMDCT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ idct9()

static __inline void fl::third_party::idct9 ( int32_t * x)
static

Definition at line 272 of file imdct.hpp.

273{
274 int32_t a1, a2, a3, a4, a5, a6, a7, a8, a9;
275 int32_t a10, a11, a12, a13, a14, a15, a16, a17, a18;
276 int32_t a19, a20, a21, a22, a23, a24, a25, a26, a27;
277 int32_t m1, m3, m5, m6, m7, m8, m9, m10, m11, m12;
278 int32_t x0, x1, x2, x3, x4, x5, x6, x7, x8;
279
280 x0 = x[0]; x1 = x[1]; x2 = x[2]; x3 = x[3]; x4 = x[4];
281 x5 = x[5]; x6 = x[6]; x7 = x[7]; x8 = x[8];
282
283 a1 = x0 - x6;
284 a2 = x1 - x5;
285 a3 = x1 + x5;
286 a4 = x2 - x4;
287 a5 = x2 + x4;
288 a6 = x2 + x8;
289 a7 = x1 + x7;
290
291 a8 = a6 - a5; /* ie x[8] - x[4] */
292 a9 = a3 - a7; /* ie x[5] - x[7] */
293 a10 = a2 - x7; /* ie x[1] - x[5] - x[7] */
294 a11 = a4 - x8; /* ie x[2] - x[4] - x[8] */
295
296 /* do the << 1 as constant shifts where mX is actually used (free, no stall or extra inst.) */
297 m1 = MULSHIFT32(c9_0, x3);
298 m3 = MULSHIFT32(c9_0, a10);
299 m5 = MULSHIFT32(c9_1, a5);
300 m6 = MULSHIFT32(c9_2, a6);
301 m7 = MULSHIFT32(c9_1, a8);
302 m8 = MULSHIFT32(c9_2, a5);
303 m9 = MULSHIFT32(c9_3, a9);
304 m10 = MULSHIFT32(c9_4, a7);
305 m11 = MULSHIFT32(c9_3, a3);
306 m12 = MULSHIFT32(c9_4, a9);
307
308 a12 = x[0] + (x[6] >> 1);
309 a13 = a12 + ( m1 * 2L);
310 a14 = a12 - ( m1 * 2L);
311 a15 = a1 + ( a11 >> 1);
312 a16 = ( m5 * 2L) + (m6 * 2L);
313 a17 = ( m7 * 2L) - (m8 * 2L);
314 a18 = a16 + a17;
315 a19 = ( m9 * 2L) + (m10 * 2L);
316 a20 = (m11 * 2L) - (m12 * 2L);
317
318 a21 = a20 - a19;
319 a22 = a13 + a16;
320 a23 = a14 + a16;
321 a24 = a14 + a17;
322 a25 = a13 + a17;
323 a26 = a14 - a18;
324 a27 = a13 - a18;
325
326 x0 = a22 + a19; x[0] = x0;
327 x1 = a15 + (m3 * 2L); x[1] = x1;
328 x2 = a24 + a20; x[2] = x2;
329 x3 = a26 - a21; x[3] = x3;
330 x4 = a1 - a11; x[4] = x4;
331 x5 = a27 + a21; x[5] = x5;
332 x6 = a25 - a20; x[6] = x6;
333 x7 = a15 - (m3 * 2L); x[7] = x7;
334 x8 = a23 - a19; x[8] = x8;
335}
static const int32_t c9_2
Definition imdct.hpp:260
static const int32_t c9_4
Definition imdct.hpp:262
static const int32_t c9_1
Definition imdct.hpp:259
static const int32_t c9_0
Definition imdct.hpp:258
static const int32_t c9_3
Definition imdct.hpp:261

References c9_0, c9_1, c9_2, c9_3, c9_4, FL_NOEXCEPT, MULSHIFT32(), and fl::x.

Referenced by IMDCT36().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMDCT() [1/2]

int fl::third_party::IMDCT ( MP3DecInfo * mp3DecInfo,
int gr,
int ch )

References bitrateTab, bitsPerSlotTab, FL_NOEXCEPT, samplerateTab, samplesPerFrameTab, sfBandTable, sideBytesTab, and slotTab.

Referenced by MP3Decode().

+ Here is the caller graph for this function:

◆ IMDCT() [2/2]

int32_t fl::third_party::IMDCT ( MP3DecInfo * mp3DecInfo,
int32_t gr,
int32_t ch )

Definition at line 736 of file imdct.hpp.

737{
738 int32_t nBfly, blockCutoff;
739 FrameHeader *fh;
740 SideInfo *si;
741 HuffmanInfo *hi;
742 IMDCTInfo *mi;
743 BlockCount bc;
744
745 /* validate pointers */
746 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || !mp3DecInfo->SideInfoPS ||
747 !mp3DecInfo->HuffmanInfoPS || !mp3DecInfo->IMDCTInfoPS)
748 return -1;
749
750 /* si is an array of up to 4 structs, stored as gr0ch0, gr0ch1, gr1ch0, gr1ch1 */
751 fh = (FrameHeader *)(mp3DecInfo->FrameHeaderPS);
752 si = (SideInfo *)(mp3DecInfo->SideInfoPS);
753 hi = (HuffmanInfo*)(mp3DecInfo->HuffmanInfoPS);
754 mi = (IMDCTInfo *)(mp3DecInfo->IMDCTInfoPS);
755
756 /* anti-aliasing done on whole long blocks only
757 * for mixed blocks, nBfly always 1, except 3 for 8 kHz MPEG 2.5 (see sfBandTab)
758 * nLongBlocks = number of blocks with (possibly) non-zero power
759 * nBfly = number of butterflies to do (nLongBlocks - 1, unless no long blocks)
760 */
761 blockCutoff = fh->sfBand->l[(fh->ver == MPEG1 ? 8 : 6)] / 18; /* same as 3* num short sfb's in spec */
762 if (si->sis[gr][ch].blockType != 2) {
763 /* all long transforms */
764 bc.nBlocksLong = MIN((hi->nonZeroBound[ch] + 7) / 18 + 1, 32);
765 nBfly = bc.nBlocksLong - 1;
766 } else if (si->sis[gr][ch].blockType == 2 && si->sis[gr][ch].mixedBlock) {
767 /* mixed block - long transforms until cutoff, then short transforms */
768 bc.nBlocksLong = blockCutoff;
769 nBfly = bc.nBlocksLong - 1;
770 } else {
771 /* all short transforms */
772 bc.nBlocksLong = 0;
773 nBfly = 0;
774 }
775
776 AntiAlias(hi->huffDecBuf[ch], nBfly);
777 hi->nonZeroBound[ch] = MAX(hi->nonZeroBound[ch], (nBfly * 18) + 8);
778
779 ASSERT(hi->nonZeroBound[ch] <= MAX_NSAMP);
780
781 /* for readability, use a struct instead of passing a million parameters to HybridTransform() */
782 bc.nBlocksTotal = (hi->nonZeroBound[ch] + 17) / 18;
783 bc.nBlocksPrev = mi->numPrevIMDCT[ch];
784 bc.prevType = mi->prevType[ch];
785 bc.prevWinSwitch = mi->prevWinSwitch[ch];
786 bc.currWinSwitch = (si->sis[gr][ch].mixedBlock ? blockCutoff : 0); /* where WINDOW switches (not nec. transform) */
787 bc.gbIn = hi->gb[ch];
788
789 mi->numPrevIMDCT[ch] = HybridTransform(hi->huffDecBuf[ch], mi->overBuf[ch], mi->outBuf[ch], &si->sis[gr][ch], &bc);
790 mi->prevType[ch] = si->sis[gr][ch].blockType;
791 mi->prevWinSwitch[ch] = bc.currWinSwitch; /* 0 means not a mixed block (either all short or all long) */
792 mi->gb[ch] = bc.gbOut;
793
794 ASSERT(mi->numPrevIMDCT[ch] <= NBANDS);
795
796 /* output has gained 2 int bits */
797 return 0;
798}
static int32_t HybridTransform(int32_t *xCurr, int32_t *xPrev, int32_t y[BLOCK_SIZE][NBANDS], SideInfoSub *sis, BlockCount *bc) FL_NOEXCEPT
Definition imdct.hpp:634
struct fl::third_party::_BlockCount BlockCount
static void AntiAlias(int32_t *x, int32_t nBfly) FL_NOEXCEPT
Definition imdct.hpp:80
int32_t overBuf[MAX_NCHAN][MAX_NSAMP/2]
Definition coder.h:238
int32_t outBuf[MAX_NCHAN][BLOCK_SIZE][NBANDS]
Definition coder.h:237
int32_t prevType[MAX_NCHAN]
Definition coder.h:240
int32_t prevWinSwitch[MAX_NCHAN]
Definition coder.h:241
int32_t numPrevIMDCT[MAX_NCHAN]
Definition coder.h:239
int32_t gb[MAX_NCHAN]
Definition coder.h:242

References AntiAlias(), ASSERT, fl::third_party::_SideInfoSub::blockType, fl::third_party::_BlockCount::currWinSwitch, FL_NOEXCEPT, fl::third_party::_HuffmanInfo::gb, fl::third_party::_IMDCTInfo::gb, fl::third_party::_BlockCount::gbIn, fl::third_party::_BlockCount::gbOut, fl::third_party::_HuffmanInfo::huffDecBuf, HybridTransform(), fl::third_party::_SFBandTable::l, MAX, MAX_NSAMP, MIN, fl::third_party::_SideInfoSub::mixedBlock, MPEG1, NBANDS, fl::third_party::_BlockCount::nBlocksLong, fl::third_party::_BlockCount::nBlocksPrev, fl::third_party::_BlockCount::nBlocksTotal, fl::third_party::_HuffmanInfo::nonZeroBound, fl::third_party::_IMDCTInfo::numPrevIMDCT, fl::third_party::_IMDCTInfo::outBuf, fl::third_party::_IMDCTInfo::overBuf, fl::third_party::_BlockCount::prevType, fl::third_party::_IMDCTInfo::prevType, fl::third_party::_BlockCount::prevWinSwitch, fl::third_party::_IMDCTInfo::prevWinSwitch, fl::third_party::_FrameHeader::sfBand, fl::third_party::_SideInfo::sis, and fl::third_party::_FrameHeader::ver.

+ Here is the call graph for this function:

◆ imdct12()

static __inline void fl::third_party::imdct12 ( int32_t * x,
int32_t * out )
static

Definition at line 485 of file imdct.hpp.

486{
487 int32_t a0, a1, a2;
488 int32_t x0, x1, x2, x3, x4, x5;
489
490 x0 = *x; x+=3; x1 = *x; x+=3;
491 x2 = *x; x+=3; x3 = *x; x+=3;
492 x4 = *x; x+=3; x5 = *x; x+=3;
493
494 x4 -= x5;
495 x3 -= x4;
496 x2 -= x3;
497 x3 -= x5;
498 x1 -= x2;
499 x0 -= x1;
500 x1 -= x3;
501
502 x0 >>= 1;
503 x1 >>= 1;
504
505 a0 = MULSHIFT32(c3_0, x2) * 2L;
506 a1 = x0 + (x4 >> 1);
507 a2 = x0 - x4;
508 x0 = a1 + a0;
509 x2 = a2;
510 x4 = a1 - a0;
511
512 a0 = MULSHIFT32(c3_0, x3) * 2L;
513 a1 = x1 + (x5 >> 1);
514 a2 = x1 - x5;
515
516 /* cos window odd samples, mul by 2, eat sign bit */
517 x1 = MULSHIFT32(c6[0], a1 + a0) * 4L;
518 x3 = MULSHIFT32(c6[1], a2) * 4L;
519 x5 = MULSHIFT32(c6[2], a1 - a0) * 4L;
520
521 *out = x0 + x1; out++;
522 *out = x2 + x3; out++;
523 *out = x4 + x5; out++;
524 *out = x4 - x5; out++;
525 *out = x2 - x3; out++;
526 *out = x0 - x1;
527}
static int32_t c3_0
Definition imdct.hpp:479
static int32_t c6[3]
Definition imdct.hpp:480

References c3_0, c6, FL_NOEXCEPT, MULSHIFT32(), and fl::x.

Referenced by IMDCT12x3().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMDCT12x3()

static int32_t fl::third_party::IMDCT12x3 ( int32_t * xCurr,
int32_t * xPrev,
int32_t * y,
int32_t btPrev,
int32_t blockIdx,
int32_t gb )
static

Definition at line 551 of file imdct.hpp.

552{
553 int32_t i, es, mOut;
554 int32_t yLo, xBuf[18], xPrevWin[18]; /* need temp buffer for reordering short blocks */
555 const int32_t *wp;
556
557 es = 0;
558 /* 7 gb is always adequate for accumulator loop + idct12 + window + overlap */
559 if (gb < 7) {
560 es = 7 - gb;
561 for (i = 0; i < 18; i+=2) {
562 xCurr[i+0] >>= es;
563 xCurr[i+1] >>= es;
564 *xPrev++ >>= es;
565 }
566 xPrev -= 9;
567 }
568
569 /* requires 4 input guard bits for each imdct12 */
570 imdct12(xCurr + 0, xBuf + 0);
571 imdct12(xCurr + 1, xBuf + 6);
572 imdct12(xCurr + 2, xBuf + 12);
573
574 /* window previous from last time */
575 WinPrevious(xPrev, xPrevWin, btPrev);
576
577 /* could unroll this for speed, minimum loads (short blocks usually rare, so doesn't make much overall difference)
578 * xPrevWin[i] << 2 still has 1 gb always, max gain of windowed xBuf stuff also < 1.0 and gain the sign bit
579 * so y calculations won't overflow
580 */
581 wp = imdctWin[2];
582 mOut = 0;
583 for (i = 0; i < 3; i++) {
584 yLo = (xPrevWin[ 0+i] * 4L);
585 mOut |= FASTABS(yLo); y[( 0+i)*NBANDS] = yLo;
586 yLo = (xPrevWin[ 3+i] * 4L);
587 mOut |= FASTABS(yLo); y[( 3+i)*NBANDS] = yLo;
588 yLo = (xPrevWin[ 6+i] * 4L) + (MULSHIFT32(wp[0+i], xBuf[3+i]));
589 mOut |= FASTABS(yLo); y[( 6+i)*NBANDS] = yLo;
590 yLo = (xPrevWin[ 9+i] * 4L) + (MULSHIFT32(wp[3+i], xBuf[5-i]));
591 mOut |= FASTABS(yLo); y[( 9+i)*NBANDS] = yLo;
592 yLo = (xPrevWin[12+i] * 4L) + (MULSHIFT32(wp[6+i], xBuf[2-i]) + MULSHIFT32(wp[0+i], xBuf[(6+3)+i]));
593 mOut |= FASTABS(yLo); y[(12+i)*NBANDS] = yLo;
594 yLo = (xPrevWin[15+i] * 4L) + (MULSHIFT32(wp[9+i], xBuf[0+i]) + MULSHIFT32(wp[3+i], xBuf[(6+5)-i]));
595 mOut |= FASTABS(yLo); y[(15+i)*NBANDS] = yLo;
596 }
597
598 /* save previous (unwindowed) for overlap - only need samples 6-8, 12-17 */
599 for (i = 6; i < 9; i++)
600 *xPrev++ = xBuf[i] >> 2;
601 for (i = 12; i < 18; i++)
602 *xPrev++ = xBuf[i] >> 2;
603
604 xPrev -= 9;
605 mOut |= FreqInvertRescale(y, xPrev, blockIdx, es);
606
607 return mOut;
608}
static int32_t FreqInvertRescale(int32_t *y, int32_t *xPrev, int32_t blockIdx, int32_t es) FL_NOEXCEPT
Definition imdct.hpp:195
const int32_t imdctWin[4][36]
Definition trigtabs.hpp:107
static __inline void imdct12(int32_t *x, int32_t *out) FL_NOEXCEPT
Definition imdct.hpp:485

References FASTABS(), FL_NOEXCEPT, FreqInvertRescale(), imdct12(), imdctWin, MULSHIFT32(), NBANDS, WinPrevious(), and fl::y.

Referenced by HybridTransform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMDCT36()

static int32_t fl::third_party::IMDCT36 ( int32_t * xCurr,
int32_t * xPrev,
int32_t * y,
int32_t btCurr,
int32_t btPrev,
int32_t blockIdx,
int32_t gb )
static

Definition at line 381 of file imdct.hpp.

382{
383 int32_t i, es;
384 int32_t xBuf[18], xPrevWin[18];
385 int32_t acc1, acc2, s, d, t, mOut;
386 int32_t xo, xe, c, *xp, yLo, yHi;
387 const int32_t *cp, *wp;
388
389 acc1 = acc2 = 0;
390 xCurr += 17;
391
392 /* 7 gb is always adequate for antialias + accumulator loop + idct9 */
393 if (gb < 7) {
394 /* rarely triggered - 5% to 10% of the time on normal clips (with Q25 input) */
395 es = 7 - gb;
396 for (i = 8; i >= 0; i--) {
397 acc1 = ((*xCurr--) >> es) - acc1;
398 acc2 = acc1 - acc2;
399 acc1 = ((*xCurr--) >> es) - acc1;
400 xBuf[i+9] = acc2; /* odd */
401 xBuf[i+0] = acc1; /* even */
402 xPrev[i] >>= es;
403 }
404 } else {
405 es = 0;
406 /* max gain = 18, assume adequate guard bits */
407 for (i = 8; i >= 0; i--) {
408 acc1 = (*xCurr--) - acc1;
409 acc2 = acc1 - acc2;
410 acc1 = (*xCurr--) - acc1;
411 xBuf[i+9] = acc2; /* odd */
412 xBuf[i+0] = acc1; /* even */
413 }
414 }
415 /* xEven[0] and xOdd[0] scaled by 0.5 */
416 xBuf[9] >>= 1;
417 xBuf[0] >>= 1;
418
419 /* do 9-point IDCT on even and odd */
420 idct9(xBuf+0); /* even */
421 idct9(xBuf+9); /* odd */
422
423 xp = xBuf + 8;
424 cp = c18 + 8;
425 mOut = 0;
426 if (btPrev == 0 && btCurr == 0) {
427 /* fast path - use symmetry of sin window to reduce windowing multiplies to 18 (N/2) */
428 wp = fastWin36;
429 for (i = 0; i < 9; i++) {
430 /* do ARM-style pointer arithmetic (i still needed for y[] indexing - compiler spills if 2 y pointers) */
431 c = *cp--; xo = *(xp + 9); xe = *xp--;
432 /* gain 2 int bits here */
433 xo = MULSHIFT32(c, xo); /* 2*c18*xOdd (mul by 2 implicit in scaling) */
434 xe >>= 2;
435
436 s = -(*xPrev); /* sum from last block (always at least 2 guard bits) */
437 d = -(xe - xo); /* gain 2 int bits, don't shift xo (effective << 1 to eat sign bit, << 1 for mul by 2) */
438 (*xPrev++) = xe + xo; /* symmetry - xPrev[i] = xPrev[17-i] for long blocks */
439 t = s - d;
440
441 yLo = (d + (MULSHIFT32(t, *wp++) * 4L));
442 yHi = (s + (MULSHIFT32(t, *wp++) * 4L));
443 y[(i)*NBANDS] = yLo;
444 y[(17-i)*NBANDS] = yHi;
445 mOut |= FASTABS(yLo);
446 mOut |= FASTABS(yHi);
447 }
448 } else {
449 /* slower method - either prev or curr is using window type != 0 so do full 36-point window
450 * output xPrevWin has at least 3 guard bits (xPrev has 2, gain 1 in WinPrevious)
451 */
452 WinPrevious(xPrev, xPrevWin, btPrev);
453
454 wp = imdctWin[btCurr];
455 for (i = 0; i < 9; i++) {
456 c = *cp--; xo = *(xp + 9); xe = *xp--;
457 /* gain 2 int bits here */
458 xo = MULSHIFT32(c, xo); /* 2*c18*xOdd (mul by 2 implicit in scaling) */
459 xe >>= 2;
460
461 d = xe - xo;
462 (*xPrev++) = xe + xo; /* symmetry - xPrev[i] = xPrev[17-i] for long blocks */
463
464 yLo = (xPrevWin[i] + MULSHIFT32(d, wp[i])) * 4L;
465 yHi = (xPrevWin[17-i] + MULSHIFT32(d, wp[17-i])) * 4L;
466 y[(i)*NBANDS] = yLo;
467 y[(17-i)*NBANDS] = yHi;
468 mOut |= FASTABS(yLo);
469 mOut |= FASTABS(yHi);
470 }
471 }
472
473 xPrev -= 9;
474 mOut |= FreqInvertRescale(y, xPrev, blockIdx, es);
475
476 return mOut;
477}
static __inline void idct9(int32_t *x) FL_NOEXCEPT
Definition imdct.hpp:272
static const int32_t c18[9]
Definition imdct.hpp:267
int32_t fastWin36[18]
Definition imdct.hpp:342

References c18, FASTABS(), fastWin36, FL_NOEXCEPT, FreqInvertRescale(), idct9(), imdctWin, MULSHIFT32(), NBANDS, fl::t, WinPrevious(), and fl::y.

Referenced by HybridTransform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IntensityProcMPEG1()

void fl::third_party::IntensityProcMPEG1 ( int32_t x[MAX_NCHAN][MAX_NSAMP],
int32_t nSamps,
FrameHeader * fh,
ScaleFactorInfoSub * sfis,
CriticalBandInfo * cbi,
int32_t midSideFlag,
int32_t mixFlag,
int32_t mOut[2] )

Definition at line 113 of file stproc.hpp.

115{
116 (void)mixFlag; // Unused parameter - reserved for future use
117 int32_t i=0, j=0, n=0, cb=0, w=0;
118 int32_t sampsLeft, isf, mOutL, mOutR, xl, xr;
119 int32_t fl, fr, fls[3], frs[3];
120 int32_t cbStartL=0, cbStartS=0, cbEndL=0, cbEndS=0;
121 int32_t *isfTab;
122
123 /* NOTE - this works fine for mixed blocks, as long as the switch point starts in the
124 * short block section (i.e. on or after sample 36 = sfBand->l[8] = 3*sfBand->s[3]
125 * is this a safe assumption?
126 * TODO - intensity + mixed not quite right (diff = 11 on he_mode)
127 * figure out correct implementation (spec ambiguous about when to do short block reorder)
128 */
129 if (cbi[1].cbType == 0) {
130 /* long block */
131 cbStartL = cbi[1].cbEndL + 1;
132 cbEndL = cbi[0].cbEndL + 1;
133 cbStartS = cbEndS = 0;
134 i = fh->sfBand->l[cbStartL];
135 } else if (cbi[1].cbType == 1 || cbi[1].cbType == 2) {
136 /* short or mixed block */
137 cbStartS = cbi[1].cbEndSMax + 1;
138 cbEndS = cbi[0].cbEndSMax + 1;
139 cbStartL = cbEndL = 0;
140 i = 3 * fh->sfBand->s[cbStartS];
141 }
142
143 sampsLeft = nSamps - i; /* process to length of left */
144 isfTab = (int32_t *)ISFMpeg1[midSideFlag];
145 mOutL = mOutR = 0;
146
147 /* long blocks */
148 for (cb = cbStartL; cb < cbEndL && sampsLeft > 0; cb++) {
149 isf = sfis->l[cb];
150 if (isf == 7) {
151 fl = ISFIIP[midSideFlag][0];
152 fr = ISFIIP[midSideFlag][1];
153 } else {
154 fl = isfTab[isf];
155 fr = isfTab[6] - isfTab[isf];
156 }
157
158 n = fh->sfBand->l[cb + 1] - fh->sfBand->l[cb];
159 for (j = 0; j < n && sampsLeft > 0; j++, i++) {
160 xr = MULSHIFT32(fr, x[0][i]) << 2; x[1][i] = xr; mOutR |= FASTABS(xr);
161 xl = MULSHIFT32(fl, x[0][i]) << 2; x[0][i] = xl; mOutL |= FASTABS(xl);
162 sampsLeft--;
163 }
164 }
165
166 /* short blocks */
167 for (cb = cbStartS; cb < cbEndS && sampsLeft >= 3; cb++) {
168 for (w = 0; w < 3; w++) {
169 isf = sfis->s[cb][w];
170 if (isf == 7) {
171 fls[w] = ISFIIP[midSideFlag][0];
172 frs[w] = ISFIIP[midSideFlag][1];
173 } else {
174 fls[w] = isfTab[isf];
175 frs[w] = isfTab[6] - isfTab[isf];
176 }
177 }
178
179 n = fh->sfBand->s[cb + 1] - fh->sfBand->s[cb];
180 for (j = 0; j < n && sampsLeft >= 3; j++, i+=3) {
181 xr = MULSHIFT32(frs[0], x[0][i+0]) << 2; x[1][i+0] = xr; mOutR |= FASTABS(xr);
182 xl = MULSHIFT32(fls[0], x[0][i+0]) << 2; x[0][i+0] = xl; mOutL |= FASTABS(xl);
183 xr = MULSHIFT32(frs[1], x[0][i+1]) << 2; x[1][i+1] = xr; mOutR |= FASTABS(xr);
184 xl = MULSHIFT32(fls[1], x[0][i+1]) << 2; x[0][i+1] = xl; mOutL |= FASTABS(xl);
185 xr = MULSHIFT32(frs[2], x[0][i+2]) << 2; x[1][i+2] = xr; mOutR |= FASTABS(xr);
186 xl = MULSHIFT32(fls[2], x[0][i+2]) << 2; x[0][i+2] = xl; mOutL |= FASTABS(xl);
187 sampsLeft -= 3;
188 }
189 }
190 mOut[0] = mOutL;
191 mOut[1] = mOutR;
192
193 return;
194}
const int32_t ISFIIP[2][2]
Definition trigtabs.hpp:218
const int32_t ISFMpeg1[2][7]
Definition trigtabs.hpp:164
Base definition for an LED controller.
Definition crgb.hpp:179

References FASTABS(), FL_NOEXCEPT, ISFIIP, ISFMpeg1, MAX_NCHAN, MAX_NSAMP, MULSHIFT32(), and fl::x.

Referenced by Dequantize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IntensityProcMPEG2()

void fl::third_party::IntensityProcMPEG2 ( int32_t x[MAX_NCHAN][MAX_NSAMP],
int32_t nSamps,
FrameHeader * fh,
ScaleFactorInfoSub * sfis,
CriticalBandInfo * cbi,
ScaleFactorJS * sfjs,
int32_t midSideFlag,
int32_t mixFlag,
int32_t mOut[2] )

Definition at line 220 of file stproc.hpp.

222{
223 (void)mixFlag; // Unused parameter - reserved for future use
224 int32_t i, j, k, n, r, cb, w;
225 int32_t fl, fr, mOutL, mOutR, xl, xr;
226 int32_t sampsLeft;
227 int32_t isf, sfIdx, tmp, il[23];
228 int32_t *isfTab;
229 int32_t cbStartL, cbStartS, cbEndL, cbEndS;
230
231 isfTab = (int32_t *)ISFMpeg2[sfjs->intensityScale][midSideFlag];
232 mOutL = mOutR = 0;
233
234 /* fill buffer with illegal intensity positions (depending on slen) */
235 for (k = r = 0; r < 4; r++) {
236 tmp = (1 << sfjs->slen[r]) - 1;
237 for (j = 0; j < sfjs->nr[r]; j++, k++)
238 il[k] = tmp;
239 }
240
241 if (cbi[1].cbType == 0) {
242 /* long blocks */
243 il[21] = il[22] = 1;
244 cbStartL = cbi[1].cbEndL + 1; /* start at end of right */
245 cbEndL = cbi[0].cbEndL + 1; /* process to end of left */
246 i = fh->sfBand->l[cbStartL];
247 sampsLeft = nSamps - i;
248
249 for(cb = cbStartL; cb < cbEndL; cb++) {
250 sfIdx = sfis->l[cb];
251 if (sfIdx == il[cb]) {
252 fl = ISFIIP[midSideFlag][0];
253 fr = ISFIIP[midSideFlag][1];
254 } else {
255 isf = (sfis->l[cb] + 1) >> 1;
256 fl = isfTab[(sfIdx & 0x01 ? isf : 0)];
257 fr = isfTab[(sfIdx & 0x01 ? 0 : isf)];
258 }
259 n = MIN(fh->sfBand->l[cb + 1] - fh->sfBand->l[cb], sampsLeft);
260
261 for(j = 0; j < n; j++, i++) {
262 xr = MULSHIFT32(fr, x[0][i]) << 2; x[1][i] = xr; mOutR |= FASTABS(xr);
263 xl = MULSHIFT32(fl, x[0][i]) << 2; x[0][i] = xl; mOutL |= FASTABS(xl);
264 }
265
266 /* early exit once we've used all the non-zero samples */
267 sampsLeft -= n;
268 if (sampsLeft == 0)
269 break;
270 }
271 } else {
272 /* short or mixed blocks */
273 il[12] = 1;
274
275 for(w = 0; w < 3; w++) {
276 cbStartS = cbi[1].cbEndS[w] + 1; /* start at end of right */
277 cbEndS = cbi[0].cbEndS[w] + 1; /* process to end of left */
278 i = 3 * fh->sfBand->s[cbStartS] + w;
279
280 /* skip through sample array by 3, so early-exit logic would be more tricky */
281 for(cb = cbStartS; cb < cbEndS; cb++) {
282 sfIdx = sfis->s[cb][w];
283 if (sfIdx == il[cb]) {
284 fl = ISFIIP[midSideFlag][0];
285 fr = ISFIIP[midSideFlag][1];
286 } else {
287 isf = (sfis->s[cb][w] + 1) >> 1;
288 fl = isfTab[(sfIdx & 0x01 ? isf : 0)];
289 fr = isfTab[(sfIdx & 0x01 ? 0 : isf)];
290 }
291 n = fh->sfBand->s[cb + 1] - fh->sfBand->s[cb];
292
293 for(j = 0; j < n; j++, i+=3) {
294 xr = MULSHIFT32(fr, x[0][i]) << 2; x[1][i] = xr; mOutR |= FASTABS(xr);
295 xl = MULSHIFT32(fl, x[0][i]) << 2; x[0][i] = xl; mOutL |= FASTABS(xl);
296 }
297 }
298 }
299 }
300 mOut[0] = mOutL;
301 mOut[1] = mOutR;
302
303 return;
304}
const int32_t ISFMpeg2[2][2][16]
Definition trigtabs.hpp:186

References FASTABS(), FL_NOEXCEPT, ISFIIP, ISFMpeg2, MAX_NCHAN, MAX_NSAMP, MIN, MULSHIFT32(), and fl::x.

Referenced by Dequantize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jd_decomp()

JRESULT fl::third_party::jd_decomp ( JDEC * jd,
int(* outfunc )(JDEC *, void *, JRECT *),
uint8_t scale )

Definition at line 1144 of file tjpgd.cpp.hpp.

1149{
1150 unsigned int x, y, mx, my;
1151 uint16_t rst, rsc;
1152 JRESULT rc;
1153
1154
1155 if (scale > (JD_USE_SCALE ? 3 : 0)) return JDR_PAR;
1156 jd->scale = scale;
1157
1158 mx = jd->msx * 8; my = jd->msy * 8; /* Size of the MCU (pixel) */
1159
1160 jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0; /* Initialize DC values */
1161 rst = rsc = 0;
1162
1163 rc = JDR_OK;
1164 for (y = 0; y < jd->height; y += my) { /* Vertical loop of MCUs */
1165 for (x = 0; x < jd->width; x += mx) { /* Horizontal loop of MCUs */
1166 if (jd->nrst && rst++ == jd->nrst) { /* Process restart interval if enabled */
1167 rc = restart(jd, rsc++);
1168 if (rc != JDR_OK) return rc;
1169 rst = 1;
1170 }
1171 rc = mcu_load(jd); /* Load an MCU (decompress huffman coded stream, dequantize and apply IDCT) */
1172 if (rc != JDR_OK) return rc;
1173 rc = mcu_output(jd, outfunc, x, y); /* Output the MCU (YCbCr to RGB, scaling and output) */
1174 if (rc != JDR_OK) return rc;
1175 }
1176 }
1177
1178 return rc;
1179}
static JRESULT restart(JDEC *jd, uint16_t rstn) FL_NOEXCEPT
static JRESULT mcu_load(JDEC *jd) FL_NOEXCEPT
static JRESULT mcu_output(JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), unsigned int x, unsigned int y) FL_NOEXCEPT
int16_t dcv[3]
Definition tjpgd.h:59
uint16_t height
Definition tjpgd.h:61
#define JD_USE_SCALE
Definition tjpgdcnf.h:15

References fl::third_party::JDEC::dcv, FL_NOEXCEPT, fl::third_party::JDEC::height, JD_USE_SCALE, JDR_OK, JDR_PAR, mcu_load(), mcu_output(), fl::third_party::JDEC::msx, fl::third_party::JDEC::msy, fl::third_party::JDEC::nrst, restart(), fl::third_party::JDEC::scale, scale, fl::third_party::JDEC::width, fl::x, and fl::y.

Referenced by fl::third_party::TJpg_Decoder::drawJpg(), and fl::third_party::TJpgInstanceDecoder::processChunk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jd_decomp_progressive()

JRESULT fl::third_party::jd_decomp_progressive ( JDEC_Progressive * jpd,
int(* outfunc )(JDEC *, void *, JRECT *),
uint8_t scale,
uint16_t max_mcus_per_call,
uint8_t * more_data_needed,
uint8_t * processing_complete )

Definition at line 1186 of file tjpgd.cpp.hpp.

1194{
1195 JDEC* jd = &jpd->base;
1196 unsigned int mx, my;
1197 uint16_t rst, rsc;
1198 JRESULT rc;
1199 uint16_t mcus_processed_this_call = 0;
1200
1201 // Initialize output flags
1202 if (more_data_needed) *more_data_needed = 0;
1203 if (processing_complete) *processing_complete = 0;
1204
1205 if (scale > (JD_USE_SCALE ? 3 : 0)) return JDR_PAR;
1206 jd->scale = scale;
1207
1208 mx = jd->msx * 8; my = jd->msy * 8; /* Size of the MCU (pixel) */
1209
1210 // Initialize progressive state if first call
1211 if (!jpd->workspace_initialized) {
1212 jpd->current_mcu_x = 0;
1213 jpd->current_mcu_y = 0;
1214 jpd->mcus_processed = 0;
1215 jpd->total_mcus = ((jd->width + mx - 1) / mx) * ((jd->height + my - 1) / my);
1216 jpd->is_suspended = 0;
1217 jpd->workspace_initialized = 1;
1218
1219 // Initialize DC values and restart state
1220 jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0;
1221 rst = rsc = 0;
1222 }
1223
1224 rc = JDR_OK;
1225
1226 // Resume from where we left off
1227 unsigned int x = jpd->current_mcu_x * mx;
1228 unsigned int y = jpd->current_mcu_y * my;
1229 rst = jpd->mcus_processed % (jd->nrst ? jd->nrst : 1);
1230 rsc = jpd->mcus_processed / (jd->nrst ? jd->nrst : 1);
1231
1232 // Process MCUs with yield support
1233 while (y < jd->height) {
1234 while (x < jd->width) {
1235 // Process restart interval if enabled
1236 if (jd->nrst && rst++ == jd->nrst) {
1237 rc = restart(jd, rsc++);
1238 if (rc != JDR_OK) return rc;
1239 rst = 1;
1240 }
1241
1242 // Load and output single MCU
1243 rc = mcu_load(jd);
1244 if (rc != JDR_OK) return rc;
1245
1246 rc = mcu_output(jd, outfunc, x, y);
1247 if (rc != JDR_OK) return rc;
1248
1249 // Update progressive state
1250 jpd->mcus_processed++;
1251 mcus_processed_this_call++;
1252 x += mx;
1253 jpd->current_mcu_x++;
1254
1255 // Check if we should yield
1256 if (mcus_processed_this_call >= max_mcus_per_call) {
1257 jpd->is_suspended = 1;
1258 jpd->suspend_reason = 1; // Time/MCU limit reached
1259
1260 // Save current position
1261 if (x >= jd->width) {
1262 jpd->current_mcu_x = 0;
1263 jpd->current_mcu_y++;
1264 } else {
1265 jpd->current_mcu_x = x / mx;
1266 }
1267
1268 return (JRESULT)JDR_SUSPEND;
1269 }
1270 }
1271
1272 // Move to next row
1273 x = 0;
1274 y += my;
1275 jpd->current_mcu_x = 0;
1276 jpd->current_mcu_y++;
1277 }
1278
1279 // Processing complete
1280 if (processing_complete) *processing_complete = 1;
1281 return rc;
1282}
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

References fl::third_party::JDEC_Progressive::base, fl::third_party::JDEC_Progressive::current_mcu_x, fl::third_party::JDEC_Progressive::current_mcu_y, fl::third_party::JDEC::dcv, FL_NOEXCEPT, fl::height, fl::third_party::JDEC::height, fl::third_party::JDEC_Progressive::is_suspended, JD_USE_SCALE, JDR_OK, JDR_PAR, JDR_SUSPEND, mcu_load(), mcu_output(), fl::third_party::JDEC_Progressive::mcus_processed, fl::third_party::JDEC::msx, fl::third_party::JDEC::msy, fl::third_party::JDEC::nrst, restart(), fl::third_party::JDEC::scale, scale, fl::third_party::JDEC_Progressive::suspend_reason, fl::third_party::JDEC_Progressive::total_mcus, fl::third_party::JDEC::width, fl::width, fl::third_party::JDEC_Progressive::workspace_initialized, fl::x, and fl::y.

Referenced by fl::third_party::TJpgInstanceDecoder::processChunk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jd_prepare()

JRESULT fl::third_party::jd_prepare ( JDEC * jd,
size_t(* infunc )(JDEC *, uint8_t *, size_t),
void * pool,
size_t sz_pool,
void * dev )

Definition at line 987 of file tjpgd.cpp.hpp.

994{
995 uint8_t *seg, b;
996 uint16_t marker;
997 unsigned int n, i, ofs;
998 size_t len;
999 JRESULT rc;
1000
1001 uint8_t tmp = jd->swap; // Copy the swap flag
1002 fl::memset(jd, 0, sizeof (JDEC)); /* Clear decompression object (this might be a problem if machine's null pointer is not all bits zero) */
1003 jd->pool = pool; /* Work memroy */
1004 jd->sz_pool = sz_pool; /* Size of given work memory */
1005 jd->infunc = infunc; /* Stream input function */
1006 jd->device = dev; /* I/O device identifier */
1007 jd->swap = tmp; // Restore the swap flag
1008
1009 jd->inbuf = seg = (uint8_t*)alloc_pool(jd, JD_SZBUF); /* Allocate stream input buffer */
1010 if (!seg) return JDR_MEM1;
1011
1012 ofs = marker = 0; /* Find SOI marker */
1013 do {
1014 if (jd->infunc(jd, seg, 1) != 1) return JDR_INP; /* Err: SOI was not detected */
1015 ofs++;
1016 marker = marker << 8 | seg[0];
1017 } while (marker != 0xFFD8);
1018
1019 for (;;) { /* Parse JPEG segments */
1020 /* Get a JPEG marker */
1021 if (jd->infunc(jd, seg, 4) != 4) return JDR_INP;
1022 marker = LDB_WORD(seg); /* Marker */
1023 len = LDB_WORD(seg + 2); /* Length field */
1024 if (len <= 2 || (marker >> 8) != 0xFF) return JDR_FMT1;
1025 len -= 2; /* Segent content size */
1026 ofs += 4 + len; /* Number of bytes loaded */
1027
1028 switch (marker & 0xFF) {
1029 case 0xC0: /* SOF0 (baseline JPEG) */
1030 if (len > JD_SZBUF) return JDR_MEM2;
1031 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */
1032
1033 jd->width = LDB_WORD(&seg[3]); /* Image width in unit of pixel */
1034 jd->height = LDB_WORD(&seg[1]); /* Image height in unit of pixel */
1035 jd->ncomp = seg[5]; /* Number of color components */
1036 if (jd->ncomp != 3 && jd->ncomp != 1) return JDR_FMT3; /* Err: Supports only Grayscale and Y/Cb/Cr */
1037
1038 /* Check each image component */
1039 for (i = 0; i < jd->ncomp; i++) {
1040 b = seg[7 + 3 * i]; /* Get sampling factor */
1041 if (i == 0) { /* Y component */
1042 if (b != 0x11 && b != 0x22 && b != 0x21) { /* Check sampling factor */
1043 return JDR_FMT3; /* Err: Supports only 4:4:4, 4:2:0 or 4:2:2 */
1044 }
1045 jd->msx = b >> 4; jd->msy = b & 15; /* Size of MCU [blocks] */
1046 } else { /* Cb/Cr component */
1047 if (b != 0x11) return JDR_FMT3; /* Err: Sampling factor of Cb/Cr must be 1 */
1048 }
1049 jd->qtid[i] = seg[8 + 3 * i]; /* Get dequantizer table ID for this component */
1050 if (jd->qtid[i] > 3) return JDR_FMT3; /* Err: Invalid ID */
1051 }
1052 break;
1053
1054 case 0xDD: /* DRI - Define Restart Interval */
1055 if (len > JD_SZBUF) return JDR_MEM2;
1056 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */
1057
1058 jd->nrst = LDB_WORD(seg); /* Get restart interval (MCUs) */
1059 break;
1060
1061 case 0xC4: /* DHT - Define Huffman Tables */
1062 if (len > JD_SZBUF) return JDR_MEM2;
1063 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */
1064
1065 rc = create_huffman_tbl(jd, seg, len); /* Create huffman tables */
1066 if (rc) return rc;
1067 break;
1068
1069 case 0xDB: /* DQT - Define Quaitizer Tables */
1070 if (len > JD_SZBUF) return JDR_MEM2;
1071 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */
1072
1073 rc = create_qt_tbl(jd, seg, len); /* Create de-quantizer tables */
1074 if (rc) return rc;
1075 break;
1076
1077 case 0xDA: /* SOS - Start of Scan */
1078 if (len > JD_SZBUF) return JDR_MEM2;
1079 if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Load segment data */
1080
1081 if (!jd->width || !jd->height) return JDR_FMT1; /* Err: Invalid image size */
1082 if (seg[0] != jd->ncomp) return JDR_FMT3; /* Err: Wrong color components */
1083
1084 /* Check if all tables corresponding to each components have been loaded */
1085 for (i = 0; i < jd->ncomp; i++) {
1086 b = seg[2 + 2 * i]; /* Get huffman table ID */
1087 if (b != 0x00 && b != 0x11) return JDR_FMT3; /* Err: Different table number for DC/AC element */
1088 n = i ? 1 : 0; /* Component class */
1089 if (!jd->huffbits[n][0] || !jd->huffbits[n][1]) { /* Check huffman table for this component */
1090 return JDR_FMT1; /* Err: Nnot loaded */
1091 }
1092 if (!jd->qttbl[jd->qtid[i]]) { /* Check dequantizer table for this component */
1093 return JDR_FMT1; /* Err: Not loaded */
1094 }
1095 }
1096
1097 /* Allocate working buffer for MCU and pixel output */
1098 n = jd->msy * jd->msx; /* Number of Y blocks in the MCU */
1099 if (!n) return JDR_FMT1; /* Err: SOF0 has not been loaded */
1100 len = n * 64 * 2 + 64; /* Allocate buffer for IDCT and RGB output */
1101 if (len < 256) len = 256; /* but at least 256 byte is required for IDCT */
1102 jd->workbuf = alloc_pool(jd, len); /* and it may occupy a part of following MCU working buffer for RGB output */
1103 if (!jd->workbuf) return JDR_MEM1; /* Err: not enough memory */
1104 jd->mcubuf = (jd_yuv_t*)alloc_pool(jd, (n + 2) * 64 * sizeof (jd_yuv_t)); /* Allocate MCU working buffer */
1105 if (!jd->mcubuf) return JDR_MEM1; /* Err: not enough memory */
1106
1107 /* Align stream read offset to JD_SZBUF */
1108 if (ofs %= JD_SZBUF) {
1109 jd->dctr = jd->infunc(jd, seg + ofs, (size_t)(JD_SZBUF - ofs));
1110 }
1111 jd->dptr = seg + ofs - (JD_FASTDECODE ? 0 : 1);
1112
1113 return JDR_OK; /* Initialization succeeded. Ready to decompress the JPEG image. */
1114
1115 case 0xC1: /* SOF1 */
1116 case 0xC2: /* SOF2 */
1117 case 0xC3: /* SOF3 */
1118 case 0xC5: /* SOF5 */
1119 case 0xC6: /* SOF6 */
1120 case 0xC7: /* SOF7 */
1121 case 0xC9: /* SOF9 */
1122 case 0xCA: /* SOF10 */
1123 case 0xCB: /* SOF11 */
1124 case 0xCD: /* SOF13 */
1125 case 0xCE: /* SOF14 */
1126 case 0xCF: /* SOF15 */
1127 case 0xD9: /* EOI */
1128 return JDR_FMT3; /* Unsuppoted JPEG standard (may be progressive JPEG) */
1129
1130 default: /* Unknown segment (comment, exif or etc..) */
1131 /* Skip segment data (null pointer specifies to remove data from the stream) */
1132 if (jd->infunc(jd, 0, len) != len) return JDR_INP;
1133 }
1134 }
1135}
static JRESULT create_huffman_tbl(JDEC *jd, const uint8_t *data, size_t ndata) FL_NOEXCEPT
static JRESULT create_qt_tbl(JDEC *jd, const uint8_t *data, size_t ndata) FL_NOEXCEPT
uint8_t jd_yuv_t
Definition tjpgd.h:19
uint8_t qtid[3]
Definition tjpgd.h:57
jd_yuv_t * mcubuf
Definition tjpgd.h:76
#define LDB_WORD(ptr)
#define JD_FASTDECODE
Definition tjpgdcnf.h:27

References alloc_pool(), create_huffman_tbl(), create_qt_tbl(), fl::third_party::JDEC::dctr, fl::third_party::JDEC::device, fl::third_party::JDEC::dptr, FL_NOEXCEPT, fl::third_party::JDEC::height, fl::third_party::JDEC::huffbits, fl::third_party::JDEC::inbuf, fl::third_party::JDEC::infunc, JD_FASTDECODE, JD_SZBUF, JDR_FMT1, JDR_FMT3, JDR_INP, JDR_MEM1, JDR_MEM2, JDR_OK, LDB_WORD, fl::third_party::JDEC::mcubuf, fl::memset(), fl::third_party::JDEC::msx, fl::third_party::JDEC::msy, fl::third_party::JDEC::ncomp, fl::third_party::JDEC::nrst, fl::third_party::JDEC::pool, fl::third_party::JDEC::qtid, fl::third_party::JDEC::qttbl, fl::third_party::JDEC::swap, fl::third_party::JDEC::sz_pool, fl::third_party::JDEC::width, and fl::third_party::JDEC::workbuf.

Referenced by fl::third_party::TJpg_Decoder::drawJpg(), fl::third_party::TJpg_Decoder::getJpgSize(), and fl::third_party::TJpgInstanceDecoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw__block_advance()

static lzw_result fl::third_party::lzw__block_advance ( struct lzw_read_ctx * ctx)
static

Advance the context to the next sub-block in the input data.

Parameters
[in]ctxLZW reading context, updated on success.
Returns
LZW_OK or LZW_OK_EOD on success, appropriate error otherwise.

Definition at line 127 of file lzw.cpp.hpp.

128{
129 fl::size block_size;
130 fl::size next_block_pos = ctx->data_sb_next;
131 const fl::u8 *data_next = ctx->data + next_block_pos;
132
133 if (next_block_pos >= ctx->data_len) {
134 return LZW_NO_DATA;
135 }
136
137 block_size = *data_next;
138
139 if ((next_block_pos + block_size) >= ctx->data_len) {
140 return LZW_NO_DATA;
141 }
142
143 ctx->sb_bit = 0;
144 ctx->sb_bit_count = block_size * 8;
145
146 if (block_size == 0) {
147 ctx->data_sb_next += 1;
148 return LZW_OK_EOD;
149 }
150
151 ctx->sb_data = data_next + 1;
152 ctx->data_sb_next += block_size + 1;
153
154 return LZW_OK;
155}
unsigned char u8
Definition coder.h:132
fl::size data_sb_next
Offset to sub-block size.
Definition lzw.cpp.hpp:45
const fl::u8 * sb_data
Pointer to current sub-block in data.
Definition lzw.cpp.hpp:47
fl::u32 sb_bit_count
Bit count in sub-block.
Definition lzw.cpp.hpp:49
fl::size sb_bit
Current bit offset in sub-block.
Definition lzw.cpp.hpp:48
fl::size data_len
Input data length.
Definition lzw.cpp.hpp:44
const fl::u8 * data
Pointer to start of input data.
Definition lzw.cpp.hpp:43

References FL_NOEXCEPT, LZW_NO_DATA, LZW_OK, and LZW_OK_EOD.

Referenced by lzw__read_code().

+ Here is the caller graph for this function:

◆ lzw__decode()

static lzw_result fl::third_party::lzw__decode ( struct lzw_ctx * ctx,
lzw_writer_fn write_fn,
void * output_data,
fl::u32 output_length,
fl::u32 * output_written )
inlinestatic

Get the next LZW code and write its value(s) to output buffer.

Parameters
[in]ctxLZW reading context, updated.
[in]write_fnFunction for writing pixels to output.
[in]output_dataArray to write output values into.
[in]output_lengthSize of output array.
[in,out]output_writtenNumber of values written. Updated on exit.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 389 of file lzw.cpp.hpp.

395{
396 lzw_result res;
397 fl::u16 code = 0;
398
399 /* Get a new code from the input */
400 res = lzw__read_code(&ctx->input, ctx->code_size, &code);
401 if (res != LZW_OK) {
402 return res;
403 }
404
405 /* Handle the new code */
406 if (code == ctx->eoi_code) {
407 /* Got End of Information code */
408 return LZW_EOI_CODE;
409
410 } else if (code > ctx->table_size) {
411 /* Code is invalid */
412 return LZW_BAD_CODE;
413
414 } else if (code == ctx->clear_code) {
415 res = lzw__handle_clear(ctx, &code);
416 if (res != LZW_OK) {
417 return res;
418 }
419
420 } else if (ctx->table_size < LZW_TABLE_ENTRY_MAX) {
421 fl::u16 size = ctx->table_size;
422 lzw__table_add_entry(ctx, (code < size) ?
423 ctx->table[code].first :
424 ctx->prev_code_first);
425
426 /* Ensure code size is increased, if needed. */
427 if (size == ctx->code_max && ctx->code_size < LZW_CODE_MAX) {
428 ctx->code_size++;
429 ctx->code_max = (1 << ctx->code_size) - 1;
430 }
431 }
432
433 *output_written += write_fn(ctx,
434 output_data, output_length, *output_written,
435 code, ctx->table[code].count);
436
437 /* Store details of this code as "previous code" to the context. */
438 ctx->prev_code_first = ctx->table[code].first;
439 ctx->prev_code_count = ctx->table[code].count;
440 ctx->prev_code = code;
441
442 return LZW_OK;
443}
#define LZW_TABLE_ENTRY_MAX
Maximum number of lzw table entries.
Definition lzw.cpp.hpp:29
#define LZW_CODE_MAX
Maximum LZW code size in bits.
Definition lzw.h:27
static lzw_result lzw__read_code(struct lzw_read_ctx *ctx, fl::u16 code_size, fl::u16 *code_out) FL_NOEXCEPT
Get the next LZW code of given size from the raw input data.
Definition lzw.cpp.hpp:167
static void lzw__table_add_entry(struct lzw_ctx *ctx, fl::u16 code) FL_NOEXCEPT
Create new table entry.
Definition lzw.cpp.hpp:357
static lzw_result lzw__handle_clear(struct lzw_ctx *ctx, fl::u16 *code_out) FL_NOEXCEPT
Handle clear code.
Definition lzw.cpp.hpp:233
fl::u8 first
First value in entry's entire record.
Definition lzw.cpp.hpp:64
fl::u16 table_size
Next position in table to fill.
Definition lzw.cpp.hpp:87
fl::u16 clear_code
Special Clear code value.
Definition lzw.cpp.hpp:84
fl::u16 prev_code_first
First value of previous code.
Definition lzw.cpp.hpp:76
struct lzw_table_entry table[LZW_TABLE_ENTRY_MAX]
LZW code table.
Definition lzw.cpp.hpp:97
fl::u16 eoi_code
Special End of Information code value.
Definition lzw.cpp.hpp:85
fl::u16 count
Count of values in this entry's record.
Definition lzw.cpp.hpp:65
fl::u8 code_size
Current LZW code size.
Definition lzw.cpp.hpp:81
fl::u16 prev_code
Code read from input previously.
Definition lzw.cpp.hpp:75
struct lzw_read_ctx input
Input reading context.
Definition lzw.cpp.hpp:73
fl::u16 code_max
Max code value for current code size.
Definition lzw.cpp.hpp:82
fl::u16 prev_code_count
Total values for previous code.
Definition lzw.cpp.hpp:77

References fl::third_party::lzw_ctx::clear_code, fl::third_party::lzw_ctx::code_max, fl::third_party::lzw_ctx::code_size, fl::third_party::lzw_table_entry::count, fl::third_party::lzw_ctx::eoi_code, fl::third_party::lzw_table_entry::first, FL_NOEXCEPT, fl::third_party::lzw_ctx::input, lzw__handle_clear(), lzw__read_code(), lzw__table_add_entry(), LZW_BAD_CODE, LZW_CODE_MAX, LZW_EOI_CODE, LZW_OK, LZW_TABLE_ENTRY_MAX, fl::third_party::lzw_ctx::prev_code, fl::third_party::lzw_ctx::prev_code_count, fl::third_party::lzw_ctx::prev_code_first, fl::third_party::lzw_ctx::table, and fl::third_party::lzw_ctx::table_size.

Referenced by lzw_decode(), and lzw_decode_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw__handle_clear()

static lzw_result fl::third_party::lzw__handle_clear ( struct lzw_ctx * ctx,
fl::u16 * code_out )
inlinestatic

Handle clear code.

Parameters
[in]ctxLZW reading context, updated.
[out]code_outReturns next code after a clear code.
Returns
LZW_OK or error code.

Definition at line 233 of file lzw.cpp.hpp.

236{
237 fl::u16 code = 0;
238
239 /* Reset table building context */
240 ctx->code_size = ctx->initial_code_size;
241 ctx->code_max = (1 << ctx->initial_code_size) - 1;
242 ctx->table_size = ctx->eoi_code + 1;
243
244 /* There might be a sequence of clear codes, so process them all */
245 do {
246 lzw_result res = lzw__read_code(&ctx->input,
247 ctx->code_size, &code);
248 if (res != LZW_OK) {
249 return res;
250 }
251 } while (code == ctx->clear_code);
252
253 /* The initial code must be from the initial table. */
254 if (code > ctx->clear_code) {
255 return LZW_BAD_ICODE;
256 }
257
258 *code_out = code;
259 return LZW_OK;
260}
fl::u8 initial_code_size
Starting LZW code size.
Definition lzw.cpp.hpp:79

References FL_NOEXCEPT, lzw__read_code(), LZW_BAD_ICODE, and LZW_OK.

Referenced by lzw__decode(), and lzw_decode_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw__map_write_fn()

static fl::u32 fl::third_party::lzw__map_write_fn ( struct lzw_ctx * ctx,
void * output_data,
fl::u32 output_length,
fl::u32 output_used,
fl::u16 code,
fl::u16 left )
inlinestatic

Write colour mapped values for this code to the output.

If there isn't enough space in the output stack, this function will write the as many as it can into the output. If ctx->output_left > 0 after this call, then there is more data for this code left to output. The code is stored to the context as ctx->output_code.

Parameters
[in]ctxLZW reading context, updated.
[in]output_dataArray to write output values into.
[in]output_lengthSize of output array.
[in]output_usedCurrent position in output array.
[in]codeLZW code to output values for.
[in]leftNumber of values remaining to output for code.
Returns
Number of pixel values written.

Definition at line 542 of file lzw.cpp.hpp.

548{
549 fl::u32 * output_pos = (fl::u32 *)output_data + output_used;
550 const struct lzw_table_entry * const table = ctx->table;
551 fl::u32 space = output_length - output_used;
552 fl::u16 count = left;
553
554 if (count > space) {
555 left = count - space;
556 count = space;
557 } else {
558 left = 0;
559 }
560
561 ctx->output_code = code;
562 ctx->output_left = left;
563
564 for (unsigned i = left; i != 0; i--) {
565 const struct lzw_table_entry *entry = table + code;
566 code = entry->extends;
567 }
568
569 output_pos += count;
570 if (ctx->has_transparency) {
571 for (unsigned i = count; i != 0; i--) {
572 const struct lzw_table_entry *entry = table + code;
573 --output_pos;
574 if (entry->value != ctx->transparency_idx) {
575 *output_pos = ctx->colour_map[entry->value];
576 }
577 code = entry->extends;
578 }
579 } else {
580 for (unsigned i = count; i != 0; i--) {
581 const struct lzw_table_entry *entry = table + code;
582 *--output_pos = ctx->colour_map[entry->value];
583 code = entry->extends;
584 }
585 }
586
587 return count;
588}
fl::u16 extends
Offset in table to previous entry.
Definition lzw.cpp.hpp:66
bool has_transparency
Whether the image is opaque.
Definition lzw.cpp.hpp:92
const fl::u32 * colour_map
Index to colour mapping.
Definition lzw.cpp.hpp:94
fl::u8 transparency_idx
Index representing transparency.
Definition lzw.cpp.hpp:93
fl::u16 output_left
Number of values left for output_code.
Definition lzw.cpp.hpp:90
fl::u16 output_code
Code that has been partially output.
Definition lzw.cpp.hpp:89
LZW table entry.
Definition lzw.cpp.hpp:62

References fl::third_party::lzw_ctx::colour_map, fl::third_party::lzw_table_entry::extends, FL_NOEXCEPT, fl::third_party::lzw_ctx::has_transparency, fl::third_party::lzw_ctx::output_code, fl::third_party::lzw_ctx::output_left, fl::third_party::lzw_ctx::table, fl::third_party::lzw_ctx::transparency_idx, and fl::third_party::lzw_table_entry::value.

Referenced by lzw_decode_map().

+ Here is the caller graph for this function:

◆ lzw__read_code()

static lzw_result fl::third_party::lzw__read_code ( struct lzw_read_ctx * ctx,
fl::u16 code_size,
fl::u16 * code_out )
inlinestatic

Get the next LZW code of given size from the raw input data.

Reads codes from the input data stream coping with GIF data sub-blocks.

Parameters
[in]ctxLZW reading context, updated.
[in]code_sizeSize of LZW code to get from data.
[out]code_outReturns an LZW code on success.
Returns
LZW_OK or LZW_OK_EOD on success, appropriate error otherwise.

Definition at line 167 of file lzw.cpp.hpp.

171{
172 fl::u32 code = 0;
173 fl::u32 current_bit = ctx->sb_bit & 0x7;
174
175 if (ctx->sb_bit + 24 <= ctx->sb_bit_count) {
176 /* Fast path: read three bytes from this sub-block */
177 const fl::u8 *data = ctx->sb_data + (ctx->sb_bit >> 3);
178 code |= static_cast<fl::u32>(*data++) << 0;
179 code |= static_cast<fl::u32>(*data++) << 8;
180 code |= static_cast<fl::u32>(*data) << 16;
181 ctx->sb_bit += code_size;
182 } else {
183 /* Slow path: code spans sub-blocks */
184 fl::u8 byte_advance = (current_bit + code_size) >> 3;
185 fl::u8 byte = 0;
186 fl::u8 bits_remaining_0 = (code_size < (8u - current_bit)) ?
187 code_size : (8u - current_bit);
188 fl::u8 bits_remaining_1 = code_size - bits_remaining_0;
189 fl::u8 bits_used[3] = {
190 bits_remaining_0,
191 (fl::u8)(bits_remaining_1 < 8 ? bits_remaining_1 : 8),
192 (fl::u8)(bits_remaining_1 - 8),
193 };
194
195 FL_ASSERT(byte_advance <= 2, "Byte advance too large");
196
197 while (true) {
198 const fl::u8 *data = ctx->sb_data;
199 lzw_result res;
200
201 /* Get any data from end of this sub-block */
202 while (byte <= byte_advance &&
203 ctx->sb_bit < ctx->sb_bit_count) {
204 code |= data[ctx->sb_bit >> 3] << (byte << 3);
205 ctx->sb_bit += bits_used[byte];
206 byte++;
207 }
208
209 /* Check if we have all we need */
210 if (byte > byte_advance) {
211 break;
212 }
213
214 /* Move to next sub-block */
215 res = lzw__block_advance(ctx);
216 if (res != LZW_OK) {
217 return res;
218 }
219 }
220 }
221
222 *code_out = (code >> current_bit) & ((1 << code_size) - 1);
223 return LZW_OK;
224}
#define FL_ASSERT(x, MSG)
Definition assert.h:6
uint8_t byte
Definition midi_Defs.h:36
unsigned char u8
Definition s16x16x4.h:132
static lzw_result lzw__block_advance(struct lzw_read_ctx *ctx) FL_NOEXCEPT
Advance the context to the next sub-block in the input data.
Definition lzw.cpp.hpp:127
unsigned char u8
Definition stdint.h:131

References FL_ASSERT, FL_NOEXCEPT, lzw__block_advance(), and LZW_OK.

Referenced by lzw__decode(), and lzw__handle_clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw__table_add_entry()

static void fl::third_party::lzw__table_add_entry ( struct lzw_ctx * ctx,
fl::u16 code )
inlinestatic

Create new table entry.

Parameters
[in]ctxLZW reading context, updated.
[in]codeLast value code for new table entry.

Definition at line 357 of file lzw.cpp.hpp.

360{
361 struct lzw_table_entry *entry = &ctx->table[ctx->table_size];
362
363 entry->value = code;
364 entry->first = ctx->prev_code_first;
365 entry->count = ctx->prev_code_count + 1;
366 entry->extends = ctx->prev_code;
367
368 ctx->table_size++;
369}
fl::u8 value
Last value for record ending at entry.
Definition lzw.cpp.hpp:63

References fl::third_party::lzw_table_entry::count, fl::third_party::lzw_table_entry::extends, fl::third_party::lzw_table_entry::first, FL_NOEXCEPT, and fl::third_party::lzw_table_entry::value.

Referenced by lzw__decode().

+ Here is the caller graph for this function:

◆ lzw__write_fn()

static fl::u32 fl::third_party::lzw__write_fn ( struct lzw_ctx * ctx,
void * output_data,
fl::u32 output_length,
fl::u32 output_used,
fl::u16 code,
fl::u16 left )
inlinestatic

Write values for this code to the output stack.

If there isn't enough space in the output stack, this function will write the as many as it can into the output. If ctx->output_left > 0 after this call, then there is more data for this code left to output. The code is stored to the context as ctx->output_code.

Parameters
[in]ctxLZW reading context, updated.
[in]output_dataArray to write output values into.
[in]output_lengthlength Size of output array.
[in]output_usedCurrent position in output array.
[in]codeLZW code to output values for.
[in]leftNumber of values remaining to output for this code.
Returns
Number of pixel values written.

Definition at line 461 of file lzw.cpp.hpp.

467{
468 fl::u8 * output_pos = (fl::u8 *)output_data + output_used;
469 const struct lzw_table_entry * const table = ctx->table;
470 fl::u32 space = output_length - output_used;
471 fl::u16 count = left;
472
473 if (count > space) {
474 left = count - space;
475 count = space;
476 } else {
477 left = 0;
478 }
479
480 ctx->output_code = code;
481 ctx->output_left = left;
482
483 /* Skip over any values we don't have space for. */
484 for (unsigned i = left; i != 0; i--) {
485 const struct lzw_table_entry *entry = table + code;
486 code = entry->extends;
487 }
488
489 output_pos += count;
490 for (unsigned i = count; i != 0; i--) {
491 const struct lzw_table_entry *entry = table + code;
492 *--output_pos = entry->value;
493 code = entry->extends;
494 }
495
496 return count;
497}

References fl::third_party::lzw_table_entry::extends, FL_NOEXCEPT, fl::third_party::lzw_ctx::output_code, fl::third_party::lzw_ctx::output_left, fl::third_party::lzw_ctx::table, and fl::third_party::lzw_table_entry::value.

Referenced by lzw_decode().

+ Here is the caller graph for this function:

◆ lzw_context_create()

lzw_result fl::third_party::lzw_context_create ( struct lzw_ctx ** ctx)

Create an LZW decompression context.

Parameters
[out]ctxReturns an LZW decompression context. Caller owned, free with lzw_context_destroy().
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 104 of file lzw.cpp.hpp.

105{
106 struct lzw_ctx *c = static_cast<struct lzw_ctx*>(fl::Malloc(sizeof(*c)));
107 if (c == nullptr) {
108 return LZW_NO_MEM;
109 }
110
111 *ctx = c;
112 return LZW_OK;
113}
LZW decompression context.
Definition lzw.cpp.hpp:72
void * Malloc(fl::size size)

References FL_NOEXCEPT, LZW_NO_MEM, LZW_OK, and fl::Malloc().

Referenced by nsgif_data_scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw_context_destroy()

void fl::third_party::lzw_context_destroy ( struct lzw_ctx * ctx)

Destroy an LZW decompression context.

Parameters
[in]ctxThe LZW decompression context to destroy.

Definition at line 116 of file lzw.cpp.hpp.

117{
118 fl::Free(ctx);
119}
void Free(void *ptr)

References FL_NOEXCEPT, and fl::Free().

Referenced by nsgif_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw_decode()

lzw_result fl::third_party::lzw_decode ( struct lzw_ctx * ctx,
const fl::u8 **const output_data,
fl::u32 * output_written )

Read input codes until end of LZW context owned output buffer.

Ensure anything in output is used before calling this, as anything there before this call will be trampled.

Parameters
[in]ctxLZW reading context, updated.
[out]output_dataReturns pointer to array of output values.
[out]output_writtenReturns the number of values written to data.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 500 of file lzw.cpp.hpp.

503{
504 const fl::u32 output_length = sizeof(ctx->stack_base);
505
506 *output_written = 0;
507 *output_data = ctx->stack_base;
508
509 if (ctx->output_left != 0) {
510 *output_written += lzw__write_fn(ctx,
511 ctx->stack_base, output_length, *output_written,
512 ctx->output_code, ctx->output_left);
513 }
514
515 while (*output_written != output_length) {
517 ctx->stack_base, output_length, output_written);
518 if (res != LZW_OK) {
519 return res;
520 }
521 }
522
523 return LZW_OK;
524}
static lzw_result lzw__decode(struct lzw_ctx *ctx, lzw_writer_fn write_fn, void *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
Get the next LZW code and write its value(s) to output buffer.
Definition lzw.cpp.hpp:389
static fl::u32 lzw__write_fn(struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
Write values for this code to the output stack.
Definition lzw.cpp.hpp:461
fl::u8 stack_base[LZW_TABLE_ENTRY_MAX]
Output value stack.
Definition lzw.cpp.hpp:100

References FL_NOEXCEPT, lzw__decode(), lzw__write_fn(), LZW_OK, fl::third_party::lzw_ctx::output_code, fl::third_party::lzw_ctx::output_left, and fl::third_party::lzw_ctx::stack_base.

Referenced by nsgif__decode_complex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw_decode_init()

lzw_result fl::third_party::lzw_decode_init ( struct lzw_ctx * ctx,
fl::u8 minimum_code_size,
const fl::u8 * input_data,
fl::size input_length,
fl::size input_pos )

Initialise an LZW decompression context for decoding.

Parameters
[in]ctxThe LZW decompression context to initialise.
[in]minimum_code_sizeThe LZW Minimum Code Size.
[in]input_dataThe compressed data.
[in]input_lengthByte length of compressed data.
[in]input_posStart position in data. Must be position of a size byte at sub-block start.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 263 of file lzw.cpp.hpp.

269{
270 struct lzw_table_entry *table = ctx->table;
271 lzw_result res;
272 fl::u16 code;
273
274 if (minimum_code_size >= LZW_CODE_MAX) {
275 return LZW_BAD_ICODE;
276 }
277
278 /* Initialise the input reading context */
279 ctx->input.data = input_data;
280 ctx->input.data_len = input_length;
281 ctx->input.data_sb_next = input_pos;
282
283 ctx->input.sb_bit = 0;
284 ctx->input.sb_bit_count = 0;
285
286 /* Initialise the table building context */
287 ctx->initial_code_size = minimum_code_size + 1;
288
289 ctx->clear_code = (1 << minimum_code_size) + 0;
290 ctx->eoi_code = (1 << minimum_code_size) + 1;
291
292 ctx->output_left = 0;
293
294 /* Initialise the standard table entries */
295 for (fl::u16 i = 0; i < ctx->clear_code; i++) {
296 table[i].first = i;
297 table[i].value = i;
298 table[i].count = 1;
299 }
300
301 res = lzw__handle_clear(ctx, &code);
302 if (res != LZW_OK) {
303 return res;
304 }
305
306 /* Store details of this code as "previous code" to the context. */
307 ctx->prev_code_first = ctx->table[code].first;
308 ctx->prev_code_count = ctx->table[code].count;
309 ctx->prev_code = code;
310
311 /* Add code to context for immediate output. */
312 ctx->output_code = code;
313 ctx->output_left = 1;
314
315 ctx->has_transparency = false;
316 ctx->transparency_idx = 0;
317 ctx->colour_map = nullptr;
318
319 return LZW_OK;
320}

References fl::third_party::lzw_table_entry::count, fl::third_party::lzw_table_entry::first, FL_NOEXCEPT, lzw__handle_clear(), LZW_BAD_ICODE, LZW_CODE_MAX, LZW_OK, and fl::third_party::lzw_table_entry::value.

Referenced by lzw_decode_init_map(), and nsgif__decode_complex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw_decode_init_map()

lzw_result fl::third_party::lzw_decode_init_map ( struct lzw_ctx * ctx,
fl::u8 minimum_code_size,
fl::u32 transparency_idx,
const fl::u32 * colour_table,
const fl::u8 * input_data,
fl::size input_length,
fl::size input_pos )

Initialise an LZW decompression context for decoding to colour map values.

For transparency to work correctly, the given client buffer must have the values from the previous frame. The transparency_idx should be a value of 256 or above, if the frame does not have transparency.

Parameters
[in]ctxThe LZW decompression context to initialise.
[in]minimum_code_sizeThe LZW Minimum Code Size.
[in]transparency_idxIndex representing transparency.
[in]colour_tableIndex to pixel colour mapping.
[in]input_dataThe compressed data.
[in]input_lengthByte length of compressed data.
[in]input_posStart position in data. Must be position of a size byte at sub-block start.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 323 of file lzw.cpp.hpp.

331{
332 lzw_result res;
333
334 if (colour_table == nullptr) {
335 return LZW_BAD_PARAM;
336 }
337
338 res = lzw_decode_init(ctx, minimum_code_size,
339 input_data, input_length, input_pos);
340 if (res != LZW_OK) {
341 return res;
342 }
343
344 ctx->has_transparency = (transparency_idx <= 0xFF);
345 ctx->transparency_idx = transparency_idx;
346 ctx->colour_map = colour_table;
347
348 return LZW_OK;
349}
lzw_result lzw_decode_init(struct lzw_ctx *ctx, fl::u8 minimum_code_size, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
Initialise an LZW decompression context for decoding.
Definition lzw.cpp.hpp:263

References FL_NOEXCEPT, LZW_BAD_PARAM, lzw_decode_init(), and LZW_OK.

Referenced by nsgif__decode_simple().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lzw_decode_map()

lzw_result fl::third_party::lzw_decode_map ( struct lzw_ctx * ctx,
fl::u32 * output_data,
fl::u32 output_length,
fl::u32 * output_written )

Read LZW codes into client buffer, mapping output to colours.

The context must have been initialised using lzw_decode_init_map before calling this function, in order to provide the colour mapping table and any transparency index.

Ensure anything in output is used before calling this, as anything there before this call will be trampled.

Parameters
[in]ctxLZW reading context, updated.
[in]output_dataClient buffer to fill with colour mapped values.
[in]output_lengthSize of output array.
[out]output_writtenReturns the number of values written to data.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 591 of file lzw.cpp.hpp.

595{
596 *output_written = 0;
597
598 if (ctx->colour_map == nullptr) {
599 return LZW_NO_COLOUR;
600 }
601
602 if (ctx->output_left != 0) {
603 *output_written += lzw__map_write_fn(ctx,
604 output_data, output_length, *output_written,
605 ctx->output_code, ctx->output_left);
606 }
607
608 while (*output_written != output_length) {
610 output_data, output_length, output_written);
611 if (res != LZW_OK) {
612 return res;
613 }
614 }
615
616 return LZW_OK;
617}
static fl::u32 lzw__map_write_fn(struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
Write colour mapped values for this code to the output.
Definition lzw.cpp.hpp:542

References fl::third_party::lzw_ctx::colour_map, FL_NOEXCEPT, lzw__decode(), lzw__map_write_fn(), LZW_NO_COLOUR, LZW_OK, fl::third_party::lzw_ctx::output_code, and fl::third_party::lzw_ctx::output_left.

Referenced by nsgif__decode_simple().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MADD64()

__inline Word64 fl::third_party::MADD64 ( Word64 sum64,
int x,
int y )

Increase sum by x * y.

Definition at line 546 of file assembly.h.

547{
548 sum64 += (Word64)x * (Word64)y;
549
550 return sum64;
551}
long long Word64
Definition assembly.h:498

References FL_NOEXCEPT, fl::x, and fl::y.

◆ mcu_load()

static JRESULT fl::third_party::mcu_load ( JDEC * jd)
static

Definition at line 711 of file tjpgd.cpp.hpp.

714{
715 int32_t *tmp = (int32_t*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */
716 int d, e;
717 unsigned int blk, nby, i, bc, z, id, cmp;
718 jd_yuv_t *bp;
719 const int32_t *dqf;
720
721
722 nby = jd->msx * jd->msy; /* Number of Y blocks (1, 2 or 4) */
723 bp = jd->mcubuf; /* Pointer to the first block of MCU */
724
725 for (blk = 0; blk < nby + 2; blk++) { /* Get nby Y blocks and two C blocks */
726 cmp = (blk < nby) ? 0 : blk - nby + 1; /* Component number 0:Y, 1:Cb, 2:Cr */
727
728 if (cmp && jd->ncomp != 3) { /* Clear C blocks if not exist (monochrome image) */
729 for (i = 0; i < 64; bp[i++] = 128) ;
730
731 } else { /* Load Y/C blocks from input stream */
732 id = cmp ? 1 : 0; /* Huffman table ID of this component */
733
734 /* Extract a DC element from input stream */
735 d = huffext(jd, id, 0); /* Extract a huffman coded data (bit length) */
736 if (d < 0) return (JRESULT)(0 - d); /* Err: invalid code or input */
737 bc = (unsigned int)d;
738 d = jd->dcv[cmp]; /* DC value of previous block */
739 if (bc) { /* If there is any difference from previous block */
740 e = bitext(jd, bc); /* Extract data bits */
741 if (e < 0) return (JRESULT)(0 - e); /* Err: input */
742 bc = 1 << (bc - 1); /* MSB position */
743 if (!(e & bc)) e -= (bc << 1) - 1; /* Restore negative value if needed */
744 d += e; /* Get current value */
745 jd->dcv[cmp] = (int16_t)d; /* Save current DC value for next block */
746 }
747 dqf = jd->qttbl[jd->qtid[cmp]]; /* De-quantizer table ID for this component */
748 tmp[0] = d * dqf[0] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */
749
750 /* Extract following 63 AC elements from input stream */
751 fl::memset(&tmp[1], 0, 63 * sizeof (int32_t)); /* Initialize all AC elements */
752 z = 1; /* Top of the AC elements (in zigzag-order) */
753 do {
754 d = huffext(jd, id, 1); /* Extract a huffman coded value (zero runs and bit length) */
755 if (d == 0) break; /* EOB? */
756 if (d < 0) return (JRESULT)(0 - d); /* Err: invalid code or input error */
757 bc = (unsigned int)d;
758 z += bc >> 4; /* Skip leading zero run */
759 if (z >= 64) return JDR_FMT1; /* Too long zero run */
760 if (bc &= 0x0F) { /* Bit length? */
761 d = bitext(jd, bc); /* Extract data bits */
762 if (d < 0) return (JRESULT)(0 - d); /* Err: input device */
763 bc = 1 << (bc - 1); /* MSB position */
764 if (!(d & bc)) d -= (bc << 1) - 1; /* Restore negative value if needed */
765 i = Zig[z]; /* Get raster-order index */
766 tmp[i] = d * dqf[i] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */
767 }
768 } while (++z < 64); /* Next AC element */
769
770 if (JD_FORMAT != 2 || !cmp) { /* C components may not be processed if in grayscale output */
771 if (z == 1 || (JD_USE_SCALE && jd->scale == 3)) { /* If no AC element or scale ratio is 1/8, IDCT can be ommited and the block is filled with DC value */
772 d = (jd_yuv_t)((*tmp / 256) + 128);
773 if (JD_FASTDECODE >= 1) {
774 for (i = 0; i < 64; bp[i++] = d) ;
775 } else {
776 fl::memset(bp, d, 64);
777 }
778 } else {
779 block_idct(tmp, bp); /* Apply IDCT and store the block to the MCU buffer */
780 }
781 }
782 }
783
784 bp += 64; /* Next block */
785 }
786
787 return JDR_OK; /* All blocks have been loaded successfully */
788}
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:93
static void block_idct(int32_t *src, jd_yuv_t *dst) FL_NOEXCEPT
static int bitext(JDEC *jd, unsigned int nbit) FL_NOEXCEPT
static int huffext(JDEC *jd, unsigned int id, unsigned int cls) FL_NOEXCEPT
#define JD_FORMAT
Definition tjpgdcnf.h:8

References bitext(), block_idct(), FL_NOEXCEPT, huffext(), JD_FASTDECODE, JD_FORMAT, JD_USE_SCALE, JDR_FMT1, JDR_OK, fl::memset(), z, and Zig.

Referenced by jd_decomp(), and jd_decomp_progressive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mcu_output()

static JRESULT fl::third_party::mcu_output ( JDEC * jd,
int(* outfunc )(JDEC *, void *, JRECT *),
unsigned int x,
unsigned int y )
static

Definition at line 797 of file tjpgd.cpp.hpp.

803{
804 const int CVACC = (sizeof (int) > 2) ? 1024 : 128; /* Adaptive accuracy for both 16-/32-bit systems */
805 unsigned int ix, iy, mx, my, rx, ry;
806 int yy, cb, cr;
807 jd_yuv_t *py, *pc;
808 uint8_t *pix;
809 JRECT rect;
810
811
812 mx = jd->msx * 8; my = jd->msy * 8; /* MCU size (pixel) */
813 rx = (x + mx <= jd->width) ? mx : jd->width - x; /* Output rectangular size (it may be clipped at right/bottom end of image) */
814 ry = (y + my <= jd->height) ? my : jd->height - y;
815 if (JD_USE_SCALE) {
816 rx >>= jd->scale; ry >>= jd->scale;
817 if (!rx || !ry) return JDR_OK; /* Skip this MCU if all pixel is to be rounded off */
818 x >>= jd->scale; y >>= jd->scale;
819 }
820 rect.left = x; rect.right = x + rx - 1; /* Rectangular area in the frame buffer */
821 rect.top = y; rect.bottom = y + ry - 1;
822
823
824 if (!JD_USE_SCALE || jd->scale != 3) { /* Not for 1/8 scaling */
825 pix = (uint8_t*)jd->workbuf;
826
827 if (JD_FORMAT != 2) { /* RGB output (build an RGB MCU from Y/C component) */
828 for (iy = 0; iy < my; iy++) {
829 pc = py = jd->mcubuf;
830 if (my == 16) { /* Double block height? */
831 pc += 64 * 4 + (iy >> 1) * 8;
832 if (iy >= 8) py += 64;
833 } else { /* Single block height */
834 pc += mx * 8 + iy * 8;
835 }
836 py += iy * 8;
837 for (ix = 0; ix < mx; ix++) {
838 cb = pc[0] - 128; /* Get Cb/Cr component and remove offset */
839 cr = pc[64] - 128;
840 if (mx == 16) { /* Double block width? */
841 if (ix == 8) py += 64 - 8; /* Jump to next block if double block heigt */
842 pc += ix & 1; /* Step forward chroma pointer every two pixels */
843 } else { /* Single block width */
844 pc++; /* Step forward chroma pointer every pixel */
845 }
846 yy = *py++; /* Get Y component */
847 *pix++ = /*R*/ BYTECLIP(yy + ((int)(1.402 * CVACC) * cr) / CVACC);
848 *pix++ = /*G*/ BYTECLIP(yy - ((int)(0.344 * CVACC) * cb + (int)(0.714 * CVACC) * cr) / CVACC);
849 *pix++ = /*B*/ BYTECLIP(yy + ((int)(1.772 * CVACC) * cb) / CVACC);
850 }
851 }
852 } else { /* Monochrome output (build a grayscale MCU from Y comopnent) */
853 for (iy = 0; iy < my; iy++) {
854 py = jd->mcubuf + iy * 8;
855 if (my == 16) { /* Double block height? */
856 if (iy >= 8) py += 64;
857 }
858 for (ix = 0; ix < mx; ix++) {
859 if (mx == 16) { /* Double block width? */
860 if (ix == 8) py += 64 - 8; /* Jump to next block if double block height */
861 }
862 if (JD_FASTDECODE >= 1) {
863 *pix++ = BYTECLIP(*py++); /* Get and store a Y value as grayscale */
864 } else {
865 *pix++ = *py++; /* Get and store a Y value as grayscale */
866 }
867 }
868 }
869 }
870
871 /* Descale the MCU rectangular if needed */
872 if (JD_USE_SCALE && jd->scale) {
873 unsigned int x, y, r, g, b, s, w, a;
874 uint8_t *op;
875
876 /* Get averaged RGB value of each square correcponds to a pixel */
877 s = jd->scale * 2; /* Number of shifts for averaging */
878 w = 1 << jd->scale; /* Width of square */
879 a = (mx - w) * (JD_FORMAT != 2 ? 3 : 1); /* Bytes to skip for next line in the square */
880 op = (uint8_t*)jd->workbuf;
881 for (iy = 0; iy < my; iy += w) {
882 for (ix = 0; ix < mx; ix += w) {
883 pix = (uint8_t*)jd->workbuf + (iy * mx + ix) * (JD_FORMAT != 2 ? 3 : 1);
884 r = g = b = 0;
885 for (y = 0; y < w; y++) { /* Accumulate RGB value in the square */
886 for (x = 0; x < w; x++) {
887 r += *pix++; /* Accumulate R or Y (monochrome output) */
888 if (JD_FORMAT != 2) { /* RGB output? */
889 g += *pix++; /* Accumulate G */
890 b += *pix++; /* Accumulate B */
891 }
892 }
893 pix += a;
894 } /* Put the averaged pixel value */
895 *op++ = (uint8_t)(r >> s); /* Put R or Y (monochrome output) */
896 if (JD_FORMAT != 2) { /* RGB output? */
897 *op++ = (uint8_t)(g >> s); /* Put G */
898 *op++ = (uint8_t)(b >> s); /* Put B */
899 }
900 }
901 }
902 }
903
904 } else { /* For only 1/8 scaling (left-top pixel in each block are the DC value of the block) */
905
906 /* Build a 1/8 descaled RGB MCU from discrete comopnents */
907 pix = (uint8_t*)jd->workbuf;
908 pc = jd->mcubuf + mx * my;
909 cb = pc[0] - 128; /* Get Cb/Cr component and restore right level */
910 cr = pc[64] - 128;
911 for (iy = 0; iy < my; iy += 8) {
912 py = jd->mcubuf;
913 if (iy == 8) py += 64 * 2;
914 for (ix = 0; ix < mx; ix += 8) {
915 yy = *py; /* Get Y component */
916 py += 64;
917 if (JD_FORMAT != 2) {
918 *pix++ = /*R*/ BYTECLIP(yy + ((int)(1.402 * CVACC) * cr / CVACC));
919 *pix++ = /*G*/ BYTECLIP(yy - ((int)(0.344 * CVACC) * cb + (int)(0.714 * CVACC) * cr) / CVACC);
920 *pix++ = /*B*/ BYTECLIP(yy + ((int)(1.772 * CVACC) * cb / CVACC));
921 } else {
922 *pix++ = yy;
923 }
924 }
925 }
926 }
927
928 /* Squeeze up pixel table if a part of MCU is to be truncated */
929 mx >>= jd->scale;
930 if (rx < mx) { /* Is the MCU spans rigit edge? */
931 uint8_t *s, *d;
932 unsigned int x, y;
933
934 s = d = (uint8_t*)jd->workbuf;
935 for (y = 0; y < ry; y++) {
936 for (x = 0; x < rx; x++) { /* Copy effective pixels */
937 *d++ = *s++;
938 if (JD_FORMAT != 2) {
939 *d++ = *s++;
940 *d++ = *s++;
941 }
942 }
943 s += (mx - rx) * (JD_FORMAT != 2 ? 3 : 1); /* Skip truncated pixels */
944 }
945 }
946
947 /* Convert RGB888 to RGB565 if needed */
948 if (JD_FORMAT == 1) {
949 uint8_t *s = (uint8_t*)jd->workbuf;
950 uint16_t w, *d = (uint16_t*)s;
951 unsigned int n = rx * ry;
952
953 if (jd->swap)
954 {
955 do {
956 w = (*s++ & 0xF8) << 8; // RRRRR-----------
957 w |= (*s++ & 0xFC) << 3; // -----GGGGGG-----
958 w |= *s++ >> 3; // -----------BBBBB
959 *d++ = (w << 8) | (w >> 8); // Swap bytes
960 } while (--n);
961 }
962 else
963 {
964 do {
965 w = ( *s++ & 0xF8) << 8; // RRRRR-----------
966 w |= (*s++ & 0xFC) << 3; // -----GGGGGG-----
967 w |= *s++ >> 3; // -----------BBBBB
968 *d++ = w;
969 } while (--n);
970 }
971 }
972
973 /* Output the rectangular */
974 return outfunc(jd, jd->workbuf, &rect) ? JDR_OK : JDR_INTR;
975}
unsigned char uint8_t
Definition s16x16x4.h:209

References BYTECLIP(), FL_NOEXCEPT, fl::third_party::JDEC::height, JD_FASTDECODE, JD_FORMAT, JD_USE_SCALE, JDR_INTR, JDR_OK, fl::third_party::JDEC::mcubuf, fl::third_party::JDEC::msx, fl::third_party::JDEC::msy, fl::third_party::JDEC::scale, fl::third_party::JDEC::swap, fl::third_party::JDEC::width, fl::third_party::JDEC::workbuf, fl::x, and fl::y.

Referenced by jd_decomp(), and jd_decomp_progressive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MidSideProc()

void fl::third_party::MidSideProc ( int32_t x[MAX_NCHAN][MAX_NSAMP],
int32_t nSamps,
int32_t mOut[2] )

Definition at line 71 of file stproc.hpp.

72{
73 int32_t i, xr, xl, mOutL, mOutR;
74
75 /* L = (M+S)/sqrt(2), R = (M-S)/sqrt(2)
76 * NOTE: 1/sqrt(2) done in DequantChannel() - see comments there
77 */
78 mOutL = mOutR = 0;
79 for(i = 0; i < nSamps; i++) {
80 xl = x[0][i];
81 xr = x[1][i];
82 x[0][i] = xl + xr;
83 x[1][i] = xl - xr;
84 mOutL |= FASTABS(x[0][i]);
85 mOutR |= FASTABS(x[1][i]);
86 }
87 mOut[0] |= mOutL;
88 mOut[1] |= mOutR;
89}

References FASTABS(), FL_NOEXCEPT, MAX_NCHAN, MAX_NSAMP, and fl::x.

Referenced by Dequantize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MP3ClearBadFrame()

static void fl::third_party::MP3ClearBadFrame ( MP3DecInfo * mp3DecInfo,
short * outbuf )
static

Definition at line 260 of file mp3dec.hpp.

261{
262 int i;
263
264 if (!mp3DecInfo)
265 return;
266
267 for (i = 0; i < mp3DecInfo->nGrans * mp3DecInfo->nGranSamps * mp3DecInfo->nChans; i++)
268 outbuf[i] = 0;
269}
int nGranSamps
Definition mp3common.h:88

References FL_NOEXCEPT.

Referenced by MP3Decode().

+ Here is the caller graph for this function:

◆ MP3Decode()

int fl::third_party::MP3Decode ( HMP3Decoder hMP3Decoder,
const unsigned char ** inbuf,
size_t * bytesLeft,
short * outbuf,
int useSize )

Definition at line 292 of file mp3dec.hpp.

293{
294 int offset, bitOffset, mainBits, gr, ch, fhBytes, siBytes, freeFrameBytes;
295 int prevBitOffset, sfBlockBits, huffBlockBits;
296 const unsigned char *mainPtr;
297 MP3DecInfo *mp3DecInfo = (MP3DecInfo *)hMP3Decoder;
298
299 #ifdef PROFILE
300 long time;
301 #endif
302
303 if (!mp3DecInfo)
305
306 /* unpack frame header */
307 fhBytes = UnpackFrameHeader(mp3DecInfo, *inbuf);
308 if (fhBytes < 0)
309 return ERR_MP3_INVALID_FRAMEHEADER; /* don't clear outbuf since we don't know size (failed to parse header) */
310 *inbuf += fhBytes;
311
312#ifdef PROFILE
313 time = systime_get();
314#endif
315 /* unpack side info */
316 siBytes = UnpackSideInfo(mp3DecInfo, *inbuf);
317 if (siBytes < 0) {
318 MP3ClearBadFrame(mp3DecInfo, outbuf);
320 }
321 *inbuf += siBytes;
322 *bytesLeft -= (fhBytes + siBytes);
323#ifdef PROFILE
324 time = systime_get() - time;
325 printf("UnpackSideInfo: %i ms\n", time);
326#endif
327
328
329 /* if free mode, need to calculate bitrate and nSlots manually, based on frame size */
330 if (mp3DecInfo->bitrate == 0 || mp3DecInfo->freeBitrateFlag) {
331 if (!mp3DecInfo->freeBitrateFlag) {
332 /* first time through, need to scan for next sync word and figure out frame size */
333 mp3DecInfo->freeBitrateFlag = 1;
334 mp3DecInfo->freeBitrateSlots = MP3FindFreeSync(*inbuf, *inbuf - fhBytes - siBytes, *bytesLeft);
335 if (mp3DecInfo->freeBitrateSlots < 0) {
336 MP3ClearBadFrame(mp3DecInfo, outbuf);
338 }
339 freeFrameBytes = mp3DecInfo->freeBitrateSlots + fhBytes + siBytes;
340 mp3DecInfo->bitrate = (freeFrameBytes * mp3DecInfo->samprate * 8) / (mp3DecInfo->nGrans * mp3DecInfo->nGranSamps);
341 }
342 mp3DecInfo->nSlots = mp3DecInfo->freeBitrateSlots + CheckPadBit(mp3DecInfo); /* add pad byte, if required */
343 }
344
345 /* useSize != 0 means we're getting reformatted (RTP) packets (see RFC 3119)
346 * - calling function assembles "self-contained" MP3 frames by shifting any main_data
347 * from the bit reservoir (in previous frames) to AFTER the sync word and side info
348 * - calling function should set mainDataBegin to 0, and tell us exactly how large this
349 * frame is (in bytesLeft)
350 */
351 if (useSize) {
352 mp3DecInfo->nSlots = *bytesLeft;
353 if (mp3DecInfo->mainDataBegin != 0 || mp3DecInfo->nSlots <= 0) {
354 /* error - non self-contained frame, or missing frame (size <= 0), could do loss concealment here */
355 MP3ClearBadFrame(mp3DecInfo, outbuf);
357 }
358
359 /* can operate in-place on reformatted frames */
360 mp3DecInfo->mainDataBytes = mp3DecInfo->nSlots;
361 mainPtr = *inbuf;
362 *inbuf += mp3DecInfo->nSlots;
363 *bytesLeft -= (mp3DecInfo->nSlots);
364 } else {
365 /* out of data - assume last or truncated frame */
366 if (mp3DecInfo->nSlots > (int)*bytesLeft) {
367 MP3ClearBadFrame(mp3DecInfo, outbuf);
369 }
370
371#ifdef PROFILE
372 time = systime_get();
373#endif
374 /* fill main data buffer with enough new data for this frame */
375 if (mp3DecInfo->mainDataBytes >= mp3DecInfo->mainDataBegin) {
376 /* adequate "old" main data available (i.e. bit reservoir) */
377 ::fl::memmove(mp3DecInfo->mainBuf, mp3DecInfo->mainBuf + mp3DecInfo->mainDataBytes - mp3DecInfo->mainDataBegin, static_cast<fl::size>(mp3DecInfo->mainDataBegin));
378 ::fl::memcopy(mp3DecInfo->mainBuf + mp3DecInfo->mainDataBegin, *inbuf, static_cast<fl::size>(mp3DecInfo->nSlots));
379
380 mp3DecInfo->mainDataBytes = mp3DecInfo->mainDataBegin + mp3DecInfo->nSlots;
381 *inbuf += mp3DecInfo->nSlots;
382 *bytesLeft -= (mp3DecInfo->nSlots);
383 mainPtr = mp3DecInfo->mainBuf;
384 } else {
385 /* not enough data in bit reservoir from previous frames (perhaps starting in middle of file) */
386 ::fl::memcopy(mp3DecInfo->mainBuf + mp3DecInfo->mainDataBytes, *inbuf, static_cast<fl::size>(mp3DecInfo->nSlots));
387 mp3DecInfo->mainDataBytes += mp3DecInfo->nSlots;
388 *inbuf += mp3DecInfo->nSlots;
389 *bytesLeft -= (mp3DecInfo->nSlots);
390 MP3ClearBadFrame(mp3DecInfo, outbuf);
392 }
393#ifdef PROFILE
394 time = systime_get() - time;
395 printf("data buffer filling: %i ms\n", time);
396#endif
397
398 }
399 bitOffset = 0;
400 mainBits = mp3DecInfo->mainDataBytes * 8;
401
402 /* decode one complete frame */
403 for (gr = 0; gr < mp3DecInfo->nGrans; gr++) {
404 for (ch = 0; ch < mp3DecInfo->nChans; ch++) {
405
406 #ifdef PROFILE
407 time = systime_get();
408 #endif
409 /* unpack scale factors and compute size of scale factor block */
410 prevBitOffset = bitOffset;
411 offset = UnpackScaleFactors(mp3DecInfo, mainPtr, &bitOffset, mainBits, gr, ch);
412 #ifdef PROFILE
413 time = systime_get() - time;
414 printf("UnpackScaleFactors: %i ms\n", time);
415 #endif
416
417 sfBlockBits = 8*offset - prevBitOffset + bitOffset;
418 huffBlockBits = mp3DecInfo->part23Length[gr][ch] - sfBlockBits;
419 mainPtr += offset;
420 mainBits -= sfBlockBits;
421
422 if (offset < 0 || mainBits < huffBlockBits) {
423 MP3ClearBadFrame(mp3DecInfo, outbuf);
425 }
426
427 #ifdef PROFILE
428 time = systime_get();
429 #endif
430 /* decode Huffman code words */
431 prevBitOffset = bitOffset;
432 offset = DecodeHuffman(mp3DecInfo, mainPtr, &bitOffset, huffBlockBits, gr, ch);
433 if (offset < 0) {
434 MP3ClearBadFrame(mp3DecInfo, outbuf);
436 }
437 #ifdef PROFILE
438 time = systime_get() - time;
439 printf("Huffman: %i ms\n", time);
440 #endif
441
442 mainPtr += offset;
443 mainBits -= (8*offset - prevBitOffset + bitOffset);
444 }
445
446 #ifdef PROFILE
447 time = systime_get();
448 #endif
449 /* dequantize coefficients, decode stereo, reorder short blocks */
450 if (Dequantize(mp3DecInfo, gr) < 0) {
451 MP3ClearBadFrame(mp3DecInfo, outbuf);
453 }
454 #ifdef PROFILE
455 time = systime_get() - time;
456 printf("Dequantize: %i ms\n", time);
457 #endif
458
459 /* alias reduction, inverse MDCT, overlap-add, frequency inversion */
460 for (ch = 0; ch < mp3DecInfo->nChans; ch++)
461 {
462 #ifdef PROFILE
463 time = systime_get();
464 #endif
465 if (IMDCT(mp3DecInfo, gr, ch) < 0) {
466 MP3ClearBadFrame(mp3DecInfo, outbuf);
467 return ERR_MP3_INVALID_IMDCT;
468 }
469 #ifdef PROFILE
470 time = systime_get() - time;
471 printf("IMDCT: %i ms\n", time);
472 #endif
473 }
474
475 #ifdef PROFILE
476 time = systime_get();
477 #endif
478 /* subband transform - if stereo, interleaves pcm LRLRLR */
479 if (Subband(mp3DecInfo, outbuf + gr*mp3DecInfo->nGranSamps*mp3DecInfo->nChans) < 0) {
480 MP3ClearBadFrame(mp3DecInfo, outbuf);
482 }
483 #ifdef PROFILE
484 time = systime_get() - time;
485 printf("Subband: %i ms\n", time);
486 #endif
487
488 }
489 return ERR_MP3_NONE;
490}
int part23Length[MAX_NGRAN][MAX_NCHAN]
Definition mp3common.h:96
int mainDataBegin
Definition mp3common.h:93
int mainDataBytes
Definition mp3common.h:94
int freeBitrateSlots
Definition mp3common.h:81
unsigned char mainBuf[MAINBUF_SIZE]
Definition mp3common.h:77
int freeBitrateFlag
Definition mp3common.h:80
@ ERR_MP3_INVALID_SCALEFACT
Definition mp3dec.h:99
@ ERR_MP3_INVALID_IMDCT
Definition mp3dec.h:102
@ ERR_MP3_NONE
Definition mp3dec.h:91
@ ERR_MP3_INDATA_UNDERFLOW
Definition mp3dec.h:92
@ ERR_MP3_MAINDATA_UNDERFLOW
Definition mp3dec.h:93
@ ERR_MP3_INVALID_HUFFCODES
Definition mp3dec.h:100
@ ERR_MP3_INVALID_FRAMEHEADER
Definition mp3dec.h:97
@ ERR_MP3_INVALID_SUBBAND
Definition mp3dec.h:103
@ ERR_MP3_INVALID_DEQUANTIZE
Definition mp3dec.h:101
@ ERR_MP3_FREE_BITRATE_SYNC
Definition mp3dec.h:94
@ ERR_MP3_INVALID_SIDEINFO
Definition mp3dec.h:98
@ ERR_MP3_NULL_POINTER
Definition mp3dec.h:96
int Dequantize(MP3DecInfo *mp3DecInfo, int gr) FL_NOEXCEPT
Definition dequant.hpp:78
static void MP3ClearBadFrame(MP3DecInfo *mp3DecInfo, short *outbuf) FL_NOEXCEPT
Definition mp3dec.hpp:260
int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) FL_NOEXCEPT
Definition scalfact.hpp:357
static int MP3FindFreeSync(const unsigned char *buf, const unsigned char firstFH[4], int nBytes) FL_NOEXCEPT
Definition mp3dec.hpp:153
int UnpackSideInfo(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
int DecodeHuffman(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) FL_NOEXCEPT
Definition huffman.hpp:385
int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch) FL_NOEXCEPT
int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf) FL_NOEXCEPT
Definition subband.hpp:65
int CheckPadBit(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
fl::u64 time() FL_NOEXCEPT
Alias for millis64() - returns 64-bit millisecond time.
Definition chrono.h:346
void printf(const char *format, const Args &... args) FL_NOEXCEPT
Printf-like formatting function that prints directly to the platform output.
Definition stdio.h:635
void * memcopy(void *dest, const void *src, size_t n) FL_NOEXCEPT
Definition cstring.h:103
void * memmove(void *dest, const void *src, size_t n) FL_NOEXCEPT

References _MP3DecInfo::bitrate, CheckPadBit(), DecodeHuffman(), Dequantize(), ERR_MP3_FREE_BITRATE_SYNC, ERR_MP3_INDATA_UNDERFLOW, ERR_MP3_INVALID_DEQUANTIZE, ERR_MP3_INVALID_FRAMEHEADER, ERR_MP3_INVALID_HUFFCODES, ERR_MP3_INVALID_IMDCT, ERR_MP3_INVALID_SCALEFACT, ERR_MP3_INVALID_SIDEINFO, ERR_MP3_INVALID_SUBBAND, ERR_MP3_MAINDATA_UNDERFLOW, ERR_MP3_NONE, ERR_MP3_NULL_POINTER, FL_NOEXCEPT, _MP3DecInfo::freeBitrateFlag, _MP3DecInfo::freeBitrateSlots, IMDCT(), _MP3DecInfo::mainBuf, _MP3DecInfo::mainDataBegin, _MP3DecInfo::mainDataBytes, fl::memcopy(), fl::memmove(), MP3ClearBadFrame(), MP3FindFreeSync(), _MP3DecInfo::nChans, _MP3DecInfo::nGrans, _MP3DecInfo::nGranSamps, _MP3DecInfo::nSlots, offset(), _MP3DecInfo::part23Length, fl::printf(), _MP3DecInfo::samprate, Subband(), fl::time(), UnpackFrameHeader(), UnpackScaleFactors(), and UnpackSideInfo().

Referenced by fl::third_party::Mp3HelixDecoder::decodeFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MP3FindFreeSync()

static int fl::third_party::MP3FindFreeSync ( const unsigned char * buf,
const unsigned char firstFH[4],
int nBytes )
static

Definition at line 153 of file mp3dec.hpp.

154{
155 int offset = 0;
156 const unsigned char *bufPtr = buf;
157
158 /* loop until we either:
159 * - run out of nBytes (FindMP3SyncWord() returns -1)
160 * - find the next valid frame header (sync word, version, layer, CRC flag, bitrate, and sample rate
161 * in next header must match current header)
162 */
163 while (1) {
164 offset = MP3FindSyncWord(bufPtr, nBytes);
165 bufPtr += offset;
166 if (offset < 0) {
167 return -1;
168 } else if ( (bufPtr[0] == firstFH[0]) && (bufPtr[1] == firstFH[1]) && ((bufPtr[2] & 0xfc) == (firstFH[2] & 0xfc)) ) {
169 /* want to return number of bytes per frame, NOT counting the padding byte, so subtract one if padFlag == 1 */
170 if ((firstFH[2] >> 1) & 0x01)
171 bufPtr--;
172 return bufPtr - buf;
173 }
174 bufPtr += 3;
175 nBytes -= (offset + 3);
176 };
177
178 return -1;
179}
int MP3FindSyncWord(const unsigned char *buf, int nBytes) FL_NOEXCEPT
Definition mp3dec.hpp:116

References FL_NOEXCEPT, MP3FindSyncWord(), and offset().

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MP3FindSyncWord()

int fl::third_party::MP3FindSyncWord ( const unsigned char * buf,
int nBytes )

Definition at line 116 of file mp3dec.hpp.

117{
118 int i;
119
120 /* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching bits */
121 for (i = 0; i < nBytes - 1; i++) {
122 if ( (buf[i+0] & SYNCWORDH) == SYNCWORDH && (buf[i+1] & SYNCWORDL) == SYNCWORDL )
123 return i;
124 }
125
126 return -1;
127}
#define SYNCWORDL
Definition mp3common.h:64
#define SYNCWORDH
Definition mp3common.h:63

References FL_NOEXCEPT, SYNCWORDH, and SYNCWORDL.

Referenced by fl::third_party::Mp3HelixDecoder::findSyncWord(), and MP3FindFreeSync().

+ Here is the caller graph for this function:

◆ MP3FreeDecoder()

void fl::third_party::MP3FreeDecoder ( HMP3Decoder hMP3Decoder)

Definition at line 93 of file mp3dec.hpp.

94{
95 MP3DecInfo *mp3DecInfo = (MP3DecInfo *)hMP3Decoder;
96
97 if (!mp3DecInfo)
98 return;
99
100 FreeBuffers(mp3DecInfo);
101}

References FL_NOEXCEPT, and FreeBuffers().

Referenced by fl::third_party::Mp3HelixDecoder::init(), and fl::third_party::Mp3HelixDecoder::reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MP3GetLastFrameInfo()

void fl::third_party::MP3GetLastFrameInfo ( HMP3Decoder hMP3Decoder,
MP3FrameInfo * mp3FrameInfo )

Definition at line 196 of file mp3dec.hpp.

197{
198 MP3DecInfo *mp3DecInfo = (MP3DecInfo *)hMP3Decoder;
199
200 if (!mp3DecInfo || mp3DecInfo->layer != 3) {
201 mp3FrameInfo->bitrate = 0;
202 mp3FrameInfo->nChans = 0;
203 mp3FrameInfo->samprate = 0;
204 mp3FrameInfo->bitsPerSample = 0;
205 mp3FrameInfo->outputSamps = 0;
206 mp3FrameInfo->layer = 0;
207 mp3FrameInfo->version = 0;
208 } else {
209 mp3FrameInfo->bitrate = mp3DecInfo->bitrate;
210 mp3FrameInfo->nChans = mp3DecInfo->nChans;
211 mp3FrameInfo->samprate = mp3DecInfo->samprate;
212 mp3FrameInfo->bitsPerSample = 16;
213 mp3FrameInfo->outputSamps = mp3DecInfo->nChans * (int)samplesPerFrameTab[mp3DecInfo->version][mp3DecInfo->layer - 1];
214 mp3FrameInfo->layer = mp3DecInfo->layer;
215 mp3FrameInfo->version = mp3DecInfo->version;
216 }
217}
MPEGVersion version
Definition mp3common.h:91
int outputSamps
Definition mp3dec.h:113
int bitsPerSample
Definition mp3dec.h:112
const short samplesPerFrameTab[3][3]
Definition mp3tabs.hpp:88

References _MP3DecInfo::bitrate, FL_NOEXCEPT, _MP3DecInfo::layer, _MP3DecInfo::nChans, samplesPerFrameTab, _MP3DecInfo::samprate, and _MP3DecInfo::version.

Referenced by fl::third_party::Mp3HelixDecoder::decodeFrame(), and MP3GetNextFrameInfo().

+ Here is the caller graph for this function:

◆ MP3GetNextFrameInfo()

int fl::third_party::MP3GetNextFrameInfo ( HMP3Decoder hMP3Decoder,
MP3FrameInfo * mp3FrameInfo,
unsigned char * buf )

Definition at line 233 of file mp3dec.hpp.

234{
235 MP3DecInfo *mp3DecInfo = (MP3DecInfo *)hMP3Decoder;
236
237 if (!mp3DecInfo)
239
240 if (UnpackFrameHeader(mp3DecInfo, buf) == -1 || mp3DecInfo->layer != 3)
242
243 MP3GetLastFrameInfo(mp3DecInfo, mp3FrameInfo);
244
245 return ERR_MP3_NONE;
246}
void MP3GetLastFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo) FL_NOEXCEPT
Definition mp3dec.hpp:196

References ERR_MP3_INVALID_FRAMEHEADER, ERR_MP3_NONE, ERR_MP3_NULL_POINTER, FL_NOEXCEPT, _MP3DecInfo::layer, MP3GetLastFrameInfo(), and UnpackFrameHeader().

+ Here is the call graph for this function:

◆ MP3InitDecoder()

HMP3Decoder fl::third_party::MP3InitDecoder ( void )

Definition at line 72 of file mp3dec.hpp.

73{
74 MP3DecInfo *mp3DecInfo;
75
76 mp3DecInfo = AllocateBuffers();
77
78 return (HMP3Decoder)mp3DecInfo;
79}
void * HMP3Decoder
Definition mp3dec.h:88
MP3DecInfo * AllocateBuffers(void) FL_NOEXCEPT
Definition buffers.hpp:99

References AllocateBuffers(), and FL_NOEXCEPT.

Referenced by fl::third_party::Mp3HelixDecoder::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MULSHIFT32()

__inline int32_t fl::third_party::MULSHIFT32 ( int32_t x,
int32_t y )

Multiply together two 32-bit numbers and return the top 32-bits of the result.

Definition at line 503 of file assembly.h.

504{
505 Word64 result = ((Word64) x) * y;
506
507 return (int32_t)(result >> 32);
508}
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References FL_NOEXCEPT, fl::x, and fl::y.

Referenced by AntiAlias(), DequantBlock(), FDCT32(), idct9(), imdct12(), IMDCT12x3(), IMDCT36(), IntensityProcMPEG1(), IntensityProcMPEG2(), and WinPrevious().

+ Here is the caller graph for this function:

◆ nsgif__animation_complete()

static bool fl::third_party::nsgif__animation_complete ( int count,
int max )
inlinestatic

Definition at line 1863 of file gif.cpp.hpp.

1864{
1865 if (max == 0) {
1866 return false;
1867 }
1868
1869 return (count >= max);
1870}
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Definition math.h:75

References FL_NOEXCEPT, and fl::max().

Referenced by nsgif_frame_prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__app_ext_is_loop_count()

static bool fl::third_party::nsgif__app_ext_is_loop_count ( const fl::u8 * data,
fl::size len )
static

Check an app ext identifier and authentication code for loop count extension.

Parameters
[in]dataThe data to decode.
[in]lenByte length of data.
Returns
true if extension is a loop count extension.

Definition at line 816 of file gif.cpp.hpp.

819{
820 enum {
821 EXT_LOOP_COUNT_BLOCK_SIZE = 0x0b,
822 };
823
824 FL_ASSERT(len > 13, "Extension data too short");
825 (void)(len);
826
827 if (data[1] == EXT_LOOP_COUNT_BLOCK_SIZE) {
828 if (strncmp((const char *)data + 2, "NETSCAPE2.0", 11) == 0 ||
829 strncmp((const char *)data + 2, "ANIMEXTS1.0", 11) == 0) {
830 return true;
831 }
832 }
833
834 return false;
835}
int strncmp(const char *s1, const char *s2, size_t n) FL_NOEXCEPT

References FL_ASSERT, FL_NOEXCEPT, and fl::strncmp().

Referenced by nsgif__parse_extension_application().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__bitmap_fmt_to_colour_layout()

static struct nsgif_colour_layout fl::third_party::nsgif__bitmap_fmt_to_colour_layout ( nsgif_bitmap_fmt_t bitmap_fmt)
static

Definition at line 1434 of file gif.cpp.hpp.

1436{
1437 bool le = nsgif__host_is_little_endian();
1438
1439 /* Map endian-dependant formats to byte-wise format for the host. */
1440 switch (bitmap_fmt) {
1442 bitmap_fmt = (le) ? NSGIF_BITMAP_FMT_A8B8G8R8
1444 break;
1446 bitmap_fmt = (le) ? NSGIF_BITMAP_FMT_A8R8G8B8
1448 break;
1450 bitmap_fmt = (le) ? NSGIF_BITMAP_FMT_B8G8R8A8
1452 break;
1454 bitmap_fmt = (le) ? NSGIF_BITMAP_FMT_R8G8B8A8
1456 break;
1461 /* These are already byte-wise formats, no conversion needed */
1462 break;
1463 default:
1464 break;
1465 }
1466
1467 /* Set up colour component order for bitmap format. */
1468 switch (bitmap_fmt) {
1469 default:
1470 /* Fall through. */
1472 { struct nsgif_colour_layout result = {0, 1, 2, 3}; return result; }
1473
1475 { struct nsgif_colour_layout result = {2, 1, 0, 3}; return result; }
1476
1478 { struct nsgif_colour_layout result = {1, 2, 3, 0}; return result; }
1479
1481 { struct nsgif_colour_layout result = {3, 2, 1, 0}; return result; }
1482
1487 /* These should have been converted to byte-wise formats above */
1488 { struct nsgif_colour_layout result = {0, 1, 2, 3}; return result; }
1489 }
1490}
static bool nsgif__host_is_little_endian(void) FL_NOEXCEPT
Check whether the host is little endian.
Definition gif.cpp.hpp:1427
Pixel format: colour component order.
Definition gif.cpp.hpp:63

References FL_NOEXCEPT, nsgif__bitmap_fmt_to_colour_layout(), nsgif__host_is_little_endian(), NSGIF_BITMAP_FMT_A8B8G8R8, NSGIF_BITMAP_FMT_A8R8G8B8, NSGIF_BITMAP_FMT_ABGR8888, NSGIF_BITMAP_FMT_ARGB8888, NSGIF_BITMAP_FMT_B8G8R8A8, NSGIF_BITMAP_FMT_BGRA8888, NSGIF_BITMAP_FMT_R8G8B8A8, and NSGIF_BITMAP_FMT_RGBA8888.

Referenced by nsgif__bitmap_fmt_to_colour_layout(), and nsgif_create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__bitmap_get()

static fl::u32 * fl::third_party::nsgif__bitmap_get ( struct nsgif * gif)
inlinestatic

Helper to get the rendering bitmap for a gif.

Parameters
[in]gifThe gif object we're decoding.
Returns
Client pixel buffer for rendering into.

Definition at line 233 of file gif.cpp.hpp.

235{
236 nsgif_error ret;
237
238 /* Make sure we have a buffer to decode to. */
239 ret = nsgif__initialise_sprite(gif, gif->info.width, gif->info.height);
240 if (ret != NSGIF_OK) {
241 return nullptr;
242 }
243
244 gif->rowspan = gif->info.width;
245 if (gif->bitmap.get_rowspan) {
246 gif->rowspan = gif->bitmap.get_rowspan(gif->frame_image);
247 }
248
249 /* Get the frame data */
250 FL_ASSERT(gif->bitmap.get_buffer, "GIF bitmap get_buffer function required");
251 return reinterpret_cast<fl::u32*>(gif->bitmap.get_buffer(gif->frame_image));
252}
static nsgif_error nsgif__initialise_sprite(struct nsgif *gif, fl::u32 width, fl::u32 height) FL_NOEXCEPT
Updates the sprite memory size.
Definition gif.cpp.hpp:208
fl::u32(* get_rowspan)(nsgif_bitmap_t *bitmap)
Get row span in pixels.
Definition nsgif.hpp:241
nsgif_bitmap_t * frame_image
currently decoded image; stored as bitmap from bitmap_create callback
Definition gif.cpp.hpp:86
fl::u32 rowspan
Row span of frame_image in pixels.
Definition gif.cpp.hpp:88
nsgif_bitmap_cb_vt bitmap
callbacks for bitmap functions
Definition gif.cpp.hpp:77
fl::u32 width
width of GIF (may increase during decoding)
Definition nsgif.hpp:384
fl::u32 height
height of GIF (may increase during decoding)
Definition nsgif.hpp:386
fl::u8 *(* get_buffer)(nsgif_bitmap_t *bitmap)
Get pointer to pixel buffer in a bitmap.
Definition nsgif.hpp:205
struct nsgif_info info
Definition gif.cpp.hpp:72

References FL_ASSERT, FL_NOEXCEPT, nsgif__initialise_sprite(), and NSGIF_OK.

Referenced by nsgif__record_frame(), and nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__bitmap_get_opaque()

static bool fl::third_party::nsgif__bitmap_get_opaque ( const struct nsgif * gif)
inlinestatic

Helper to get the client to determine if the bitmap is opaque.

Todo
: We don't really need to get the client to do this for us.
Parameters
[in]gifThe gif object we're decoding.
Returns
true if the bitmap is opaque, false otherwise.

Definition at line 291 of file gif.cpp.hpp.

293{
294 if (gif->bitmap.test_opaque) {
295 return gif->bitmap.test_opaque(
296 gif->frame_image);
297 }
298
299 return false;
300}
bool(* test_opaque)(nsgif_bitmap_t *bitmap)
Tests whether a bitmap has an opaque alpha channel.
Definition nsgif.hpp:223

References FL_NOEXCEPT.

Referenced by nsgif__update_bitmap().

+ Here is the caller graph for this function:

◆ nsgif__bitmap_modified()

static void fl::third_party::nsgif__bitmap_modified ( const struct nsgif * gif)
inlinestatic

Helper to tell the client that their bitmap was modified.

Parameters
[in]gifThe gif object we're decoding.

Definition at line 259 of file gif.cpp.hpp.

261{
262 if (gif->bitmap.modified) {
263 gif->bitmap.modified(gif->frame_image);
264 }
265}
void(* modified)(nsgif_bitmap_t *bitmap)
Bitmap modified notification.
Definition nsgif.hpp:230

References FL_NOEXCEPT.

Referenced by nsgif__update_bitmap().

+ Here is the caller graph for this function:

◆ nsgif__bitmap_set_opaque()

static void fl::third_party::nsgif__bitmap_set_opaque ( const struct nsgif * gif,
const struct nsgif_frame * frame )
inlinestatic

Helper to tell the client that whether the bitmap is opaque.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame that has been decoded.

Definition at line 273 of file gif.cpp.hpp.

276{
277 if (gif->bitmap.set_opaque) {
278 gif->bitmap.set_opaque(
279 gif->frame_image, frame->opaque);
280 }
281}
bool opaque
whether the frame is totally opaque
Definition gif.cpp.hpp:45
void(* set_opaque)(nsgif_bitmap_t *bitmap, bool opaque)
Set whether a bitmap can be plotted opaque.
Definition nsgif.hpp:215

References FL_NOEXCEPT.

Referenced by nsgif__update_bitmap().

+ Here is the caller graph for this function:

◆ nsgif__colour_table_decode()

static void fl::third_party::nsgif__colour_table_decode ( fl::u32 colour_table[NSGIF_MAX_COLOURS],
const struct nsgif_colour_layout * layout,
fl::size colour_table_entries,
const fl::u8 * data )
static

Extract a GIF colour table into a LibNSGIF colour table buffer.

Parameters
[in]colour_tableThe colour table to populate.
[in]layoutla.
[in]colour_table_entriesThe number of colour table entries.
[in]dataRaw colour table data.

Definition at line 1079 of file gif.cpp.hpp.

1084{
1085 fl::u8 *entry = (fl::u8 *)colour_table;
1086
1087 while (colour_table_entries--) {
1088 /* Gif colour map contents are r,g,b.
1089 *
1090 * We want to pack them bytewise into the colour table,
1091 * according to the client colour layout.
1092 */
1093
1094 entry[layout->r] = *data++;
1095 entry[layout->g] = *data++;
1096 entry[layout->b] = *data++;
1097 entry[layout->a] = 0xff;
1098
1099 entry += sizeof(fl::u32);
1100 }
1101}
fl::u8 b
Byte offset within pixel to blue component.
Definition gif.cpp.hpp:66
fl::u8 g
Byte offset within pixel to green component.
Definition gif.cpp.hpp:65
fl::u8 r
Byte offset within pixel to red component.
Definition gif.cpp.hpp:64
fl::u8 a
Byte offset within pixel to alpha component.
Definition gif.cpp.hpp:67

References FL_NOEXCEPT, and NSGIF_MAX_COLOURS.

Referenced by nsgif__colour_table_extract(), and nsgif_local_palette().

+ Here is the caller graph for this function:

◆ nsgif__colour_table_extract()

static nsgif_error fl::third_party::nsgif__colour_table_extract ( fl::u32 colour_table[NSGIF_MAX_COLOURS],
const struct nsgif_colour_layout * layout,
fl::size colour_table_entries,
const fl::u8 * data,
fl::size data_len,
fl::size * used,
bool decode )
inlinestatic

Extract a GIF colour table into a LibNSGIF colour table buffer.

Parameters
[in]colour_tableThe colour table to populate.
[in]layoutThe target pixel format to decode to.
[in]colour_table_entriesThe number of colour table entries.
[in]dataCurrent position in data.
[in]data_lenThe available length of data.
[out]usedNumber of colour table bytes read.
[in]decodeWhether to decode the colour table.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1115 of file gif.cpp.hpp.

1123{
1124 if (data_len < colour_table_entries * 3) {
1125 return NSGIF_ERR_END_OF_DATA;
1126 }
1127
1128 if (decode) {
1129 nsgif__colour_table_decode(colour_table, layout,
1130 colour_table_entries, data);
1131 }
1132
1133 *used = colour_table_entries * 3;
1134 return NSGIF_OK;
1135}
static void nsgif__colour_table_decode(fl::u32 colour_table[NSGIF_MAX_COLOURS], const struct nsgif_colour_layout *layout, fl::size colour_table_entries, const fl::u8 *data) FL_NOEXCEPT
Extract a GIF colour table into a LibNSGIF colour table buffer.
Definition gif.cpp.hpp:1079

References FL_NOEXCEPT, nsgif__colour_table_decode(), NSGIF_ERR_END_OF_DATA, NSGIF_MAX_COLOURS, and NSGIF_OK.

Referenced by nsgif__parse_colour_table(), and nsgif_data_scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__decode()

static nsgif_error fl::third_party::nsgif__decode ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 * data,
fl::u32 * frame_data )
inlinestatic

Definition at line 605 of file gif.cpp.hpp.

610{
611 nsgif_error ret;
612 fl::u32 width = frame->info.rect.x1 - frame->info.rect.x0;
613 fl::u32 height = frame->info.rect.y1 - frame->info.rect.y0;
614 fl::u32 offset_x = frame->info.rect.x0;
615 fl::u32 offset_y = frame->info.rect.y0;
616 fl::u32 transparency_index = frame->transparency_index;
617 fl::u32 * colour_table = gif->colour_table;
618
619 if (frame->info.interlaced == false && offset_x == 0 &&
620 width == gif->info.width &&
621 width == gif->rowspan) {
622 ret = nsgif__decode_simple(gif, height, offset_y,
623 data, transparency_index,
624 frame_data, colour_table);
625 } else {
627 offset_x, offset_y, frame->info.interlaced,
628 data, transparency_index,
629 frame_data, colour_table);
630 }
631
632 if (gif->data_complete && ret == NSGIF_ERR_END_OF_DATA) {
633 /* This is all the data there is, so make do. */
634 ret = NSGIF_OK;
635 }
636
637 return ret;
638}
static nsgif_error nsgif__decode_simple(struct nsgif *gif, fl::u32 height, fl::u32 offset_y, const fl::u8 *data, fl::u32 transparency_index, fl::u32 *frame_data, fl::u32 *colour_table) FL_NOEXCEPT
Definition gif.cpp.hpp:546
static nsgif_error nsgif__decode_complex(struct nsgif *gif, fl::u32 width, fl::u32 height, fl::u32 offset_x, fl::u32 offset_y, fl::u32 interlace, const fl::u8 *data, fl::u32 transparency_index, fl::u32 *frame_data, fl::u32 *colour_table) FL_NOEXCEPT
Definition gif.cpp.hpp:446
nsgif_rect_t rect
Frame's redraw rectangle.
Definition nsgif.hpp:437
fl::u32 * colour_table
current colour table
Definition gif.cpp.hpp:125
fl::u32 y0
y co-ordinate of redraw rectangle, top
Definition nsgif.hpp:48
bool interlaced
whether the frame is interlaced
Definition nsgif.hpp:430
fl::u32 transparency_index
the index designating a transparent pixel
Definition gif.cpp.hpp:53
fl::u32 x1
x co-ordinate of redraw rectangle, right
Definition nsgif.hpp:50
fl::u32 y1
y co-ordinate of redraw rectangle, bottom
Definition nsgif.hpp:52
fl::u32 x0
x co-ordinate of redraw rectangle, left
Definition nsgif.hpp:46
struct nsgif_frame_info info
Definition gif.cpp.hpp:38
bool data_complete
Whether all the GIF data has been supplied, or if there may be more to come.
Definition gif.cpp.hpp:106

References FL_NOEXCEPT, fl::height, nsgif__decode_complex(), nsgif__decode_simple(), NSGIF_ERR_END_OF_DATA, NSGIF_OK, and fl::width.

Referenced by nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__decode_complex()

static nsgif_error fl::third_party::nsgif__decode_complex ( struct nsgif * gif,
fl::u32 width,
fl::u32 height,
fl::u32 offset_x,
fl::u32 offset_y,
fl::u32 interlace,
const fl::u8 * data,
fl::u32 transparency_index,
fl::u32 * frame_data,
fl::u32 * colour_table )
static

Definition at line 446 of file gif.cpp.hpp.

457{
458 lzw_result res;
459 nsgif_error ret = NSGIF_OK;
460 fl::u32 clip_x = gif__clip(offset_x, width, gif->info.width);
461 fl::u32 clip_y = gif__clip(offset_y, height, gif->info.height);
462 const fl::u8 *uncompressed;
463 fl::u32 available = 0;
464 fl::u8 step = 24;
465 fl::u32 skip = 0;
466 fl::u32 y = 0;
467
468 if (offset_x >= gif->info.width ||
469 offset_y >= gif->info.height) {
470 return NSGIF_OK;
471 }
472
473 width -= clip_x;
474 height -= clip_y;
475
476 if (width == 0 || height == 0) {
477 return NSGIF_OK;
478 }
479
480 /* Initialise the LZW decoding */
481 res = lzw_decode_init(static_cast<struct lzw_ctx*>(gif->lzw_ctx), data[0],
482 gif->buf, gif->buf_len,
483 data + 1 - gif->buf);
484 if (res != LZW_OK) {
485 return nsgif__error_from_lzw(res);
486 }
487
488 do {
489 fl::u32 x;
490 fl::u32 *frame_scanline;
491
492 frame_scanline = frame_data + offset_x +
493 (y + offset_y) * gif->rowspan;
494
495 x = width;
496 while (x > 0) {
497 unsigned row_available;
498 while (available == 0) {
499 if (res != LZW_OK) {
500 /* Unexpected end of frame, try to recover */
501 if (res == LZW_OK_EOD ||
502 res == LZW_EOI_CODE) {
503 ret = NSGIF_OK;
504 } else {
505 ret = nsgif__error_from_lzw(res);
506 }
507 return ret;
508 }
509 res = lzw_decode(static_cast<struct lzw_ctx*>(gif->lzw_ctx),
510 &uncompressed, &available);
511
512 if (available == 0) {
513 return NSGIF_OK;
514 }
515 gif__jump_data(&skip, &available, &uncompressed);
516 }
517
518 row_available = x < available ? x : available;
519 x -= row_available;
520 available -= row_available;
521 if (transparency_index > 0xFF) {
522 while (row_available-- > 0) {
523 *frame_scanline++ =
524 colour_table[*uncompressed++];
525 }
526 } else {
527 while (row_available-- > 0) {
528 fl::u32 colour;
529 colour = *uncompressed++;
530 if (colour != transparency_index) {
531 *frame_scanline =
532 colour_table[colour];
533 }
534 frame_scanline++;
535 }
536 }
537 }
538
539 skip = clip_x;
540 gif__jump_data(&skip, &available, &uncompressed);
541 } while (nsgif__next_row(interlace, height, &y, &step));
542
543 return ret;
544}
static fl::u32 gif__clip(fl::u32 frame_off, fl::u32 frame_dim, fl::u32 image_ext) FL_NOEXCEPT
Get any frame clip adjustment for the image extent.
Definition gif.cpp.hpp:413
static nsgif_error nsgif__error_from_lzw(lzw_result l_res) FL_NOEXCEPT
Convert an LZW result code to equivalent GIF result code.
Definition gif.cpp.hpp:182
static bool nsgif__next_row(fl::u32 interlace, fl::u32 height, fl::u32 *y, fl::u8 *step) FL_NOEXCEPT
Get the next line for GIF decode.
Definition gif.cpp.hpp:394
lzw_result lzw_decode(struct lzw_ctx *ctx, const fl::u8 **const output_data, fl::u32 *output_written) FL_NOEXCEPT
Read input codes until end of LZW context owned output buffer.
Definition lzw.cpp.hpp:500
static void gif__jump_data(fl::u32 *skip, fl::u32 *available, const fl::u8 **pos) FL_NOEXCEPT
Perform any jump over decoded data, to accommodate clipped portion of frame.
Definition gif.cpp.hpp:434
fl::size buf_len
total number of bytes of GIF data available
Definition gif.cpp.hpp:113
void * lzw_ctx
LZW decode context.
Definition gif.cpp.hpp:75
const fl::u8 * buf
pointer to GIF data
Definition gif.cpp.hpp:109
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NOEXCEPT

References fl::available(), FL_NOEXCEPT, gif__clip(), gif__jump_data(), fl::height, lzw_decode(), lzw_decode_init(), LZW_EOI_CODE, LZW_OK, LZW_OK_EOD, nsgif__error_from_lzw(), nsgif__next_row(), NSGIF_OK, fl::step(), fl::width, fl::x, and fl::y.

Referenced by nsgif__decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__decode_simple()

static nsgif_error fl::third_party::nsgif__decode_simple ( struct nsgif * gif,
fl::u32 height,
fl::u32 offset_y,
const fl::u8 * data,
fl::u32 transparency_index,
fl::u32 * frame_data,
fl::u32 * colour_table )
static

Definition at line 546 of file gif.cpp.hpp.

554{
555 fl::u32 pixels;
556 fl::u32 written = 0;
557 nsgif_error ret = NSGIF_OK;
558 lzw_result res;
559
560 if (offset_y >= gif->info.height) {
561 return NSGIF_OK;
562 }
563
564 height -= gif__clip(offset_y, height, gif->info.height);
565
566 if (height == 0) {
567 return NSGIF_OK;
568 }
569
570 /* Initialise the LZW decoding */
571 res = lzw_decode_init_map(static_cast<struct lzw_ctx*>(gif->lzw_ctx), data[0],
572 transparency_index, colour_table,
573 gif->buf, gif->buf_len,
574 data + 1 - gif->buf);
575 if (res != LZW_OK) {
576 return nsgif__error_from_lzw(res);
577 }
578
579 frame_data += (offset_y * gif->info.width);
580 pixels = gif->info.width * height;
581
582 while (pixels > 0) {
583 res = lzw_decode_map(static_cast<struct lzw_ctx*>(gif->lzw_ctx),
584 frame_data, pixels, &written);
585 pixels -= written;
586 frame_data += written;
587 if (res != LZW_OK) {
588 /* Unexpected end of frame, try to recover */
589 if (res == LZW_OK_EOD || res == LZW_EOI_CODE) {
590 ret = NSGIF_OK;
591 } else {
592 ret = nsgif__error_from_lzw(res);
593 }
594 break;
595 }
596 }
597
598 if (pixels == 0) {
599 ret = NSGIF_OK;
600 }
601
602 return ret;
603}
lzw_result lzw_decode_init_map(struct lzw_ctx *ctx, fl::u8 minimum_code_size, fl::u32 transparency_idx, const fl::u32 *colour_table, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
Initialise an LZW decompression context for decoding to colour map values.
Definition lzw.cpp.hpp:323
lzw_result lzw_decode_map(struct lzw_ctx *ctx, fl::u32 *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
Read LZW codes into client buffer, mapping output to colours.
Definition lzw.cpp.hpp:591

References FL_NOEXCEPT, gif__clip(), fl::height, lzw_decode_init_map(), lzw_decode_map(), LZW_EOI_CODE, LZW_OK, LZW_OK_EOD, nsgif__error_from_lzw(), and NSGIF_OK.

Referenced by nsgif__decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__deinterlace()

static bool fl::third_party::nsgif__deinterlace ( fl::u32 height,
fl::u32 * y,
fl::u8 * step )
inlinestatic

Get the next line for GIF decode.

Note that the step size must be initialised to 24 at the start of the frame (when y == 0). This is because of the first two passes of the frame have the same step size of 8, and the step size is used to determine the current pass.

Parameters
[in]heightFrame height in pixels.
[in,out]yCurrent row, starting from 0, updated on exit.
[in,out]stepCurrent step starting with 24, updated on exit.
Returns
true if there is a row to process, false at the end of the frame.

Definition at line 365 of file gif.cpp.hpp.

366{
367 *y += *step & 0xf;
368
369 if (*y < height) return true;
370
371 switch (*step) {
372 case 24: *y = 4; *step = 8; if (*y < height) return true;
373 /* Fall through. */
374 case 8: *y = 2; *step = 4; if (*y < height) return true;
375 /* Fall through. */
376 case 4: *y = 1; *step = 2; if (*y < height) return true;
377 /* Fall through. */
378 default:
379 break;
380 }
381
382 return false;
383}

References FL_NOEXCEPT, fl::height, fl::step(), and fl::y.

Referenced by nsgif__next_row().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__error_from_lzw()

static nsgif_error fl::third_party::nsgif__error_from_lzw ( lzw_result l_res)
static

Convert an LZW result code to equivalent GIF result code.

Parameters
[in]l_resLZW response code.
Returns
GIF result code.

Definition at line 182 of file gif.cpp.hpp.

183{
184 static const nsgif_error g_res[] = {
185 NSGIF_OK, /* LZW_OK */
186 NSGIF_ERR_END_OF_DATA, /* LZW_OK_EOD */
187 NSGIF_ERR_OOM, /* LZW_NO_MEM */
188 NSGIF_ERR_END_OF_DATA, /* LZW_NO_DATA */
189 NSGIF_ERR_DATA_FRAME, /* LZW_EOI_CODE */
190 NSGIF_ERR_DATA_FRAME, /* LZW_NO_COLOUR */
191 NSGIF_ERR_DATA_FRAME, /* LZW_BAD_ICODE */
192 NSGIF_ERR_DATA_FRAME, /* LZW_BAD_PARAM */
193 NSGIF_ERR_DATA_FRAME, /* LZW_BAD_CODE */
194 };
195 FL_ASSERT(l_res != LZW_BAD_PARAM, "LZW bad parameter");
196 FL_ASSERT(l_res != LZW_NO_COLOUR, "LZW no colour");
197 return g_res[l_res];
198}

References FL_ASSERT, FL_NOEXCEPT, LZW_BAD_PARAM, LZW_NO_COLOUR, NSGIF_ERR_DATA_FRAME, NSGIF_ERR_END_OF_DATA, NSGIF_ERR_OOM, and NSGIF_OK.

Referenced by nsgif__decode_complex(), nsgif__decode_simple(), and nsgif_data_scan().

+ Here is the caller graph for this function:

◆ nsgif__frame_next()

static fl::u32 fl::third_party::nsgif__frame_next ( const nsgif_t * gif,
bool partial,
fl::u32 frame )
static

Definition at line 1819 of file gif.cpp.hpp.

1823{
1824 fl::u32 frames = partial ?
1825 gif->frame_count_partial :
1826 gif->info.frame_count;
1827
1828 if (frames == 0) {
1829 return NSGIF_FRAME_INVALID;
1830 }
1831
1832 frame++;
1833 return (frame >= frames) ? 0 : frame;
1834}
fl::u32 frame_count
number of frames decoded
Definition nsgif.hpp:388
fl::u32 frame_count_partial
number of frames partially decoded
Definition gif.cpp.hpp:100
#define NSGIF_FRAME_INVALID
Internal flag that a frame is invalid/unprocessed.
Definition gif.cpp.hpp:162

References FL_NOEXCEPT, and NSGIF_FRAME_INVALID.

Referenced by nsgif__next_displayable_frame(), and nsgif_frame_decode().

+ Here is the caller graph for this function:

◆ nsgif__get_frame()

static struct nsgif_frame * fl::third_party::nsgif__get_frame ( struct nsgif * gif,
fl::u32 frame_idx )
static

Definition at line 1273 of file gif.cpp.hpp.

1276{
1277 struct nsgif_frame *frame;
1278
1279 if (gif->frame_holders > frame_idx) {
1280 frame = &gif->frames[frame_idx];
1281 } else {
1282 /* Allocate more memory */
1283 fl::size count = frame_idx + 1;
1284 struct nsgif_frame *temp;
1285
1286 temp = static_cast<struct nsgif_frame*>(fl::Malloc(count * sizeof(*frame)));
1287 if (temp == nullptr) {
1288 return nullptr;
1289 }
1290 if (gif->frames) {
1291 fl::memcpy(temp, gif->frames, gif->frame_holders * sizeof(*frame));
1292 fl::Free(gif->frames);
1293 }
1294 gif->frames = temp;
1295 gif->frame_holders = count;
1296
1297 frame = &gif->frames[frame_idx];
1298
1299 frame->info.local_palette = false;
1300 frame->info.transparency = false;
1301 frame->info.display = false;
1302 frame->info.disposal = 0;
1303 frame->info.delay = 10;
1304
1306 frame->frame_offset = gif->buf_pos;
1307 frame->redraw_required = false;
1308 frame->lzw_data_length = 0;
1309 frame->decoded = false;
1310 }
1311
1312 return frame;
1313}
struct fl::third_party::nsgif_frame nsgif_frame
GIF frame data.
fl::size frame_offset
offset (in bytes) to the GIF frame data
Definition gif.cpp.hpp:41
bool redraw_required
whether a full image redraw is required
Definition gif.cpp.hpp:47
bool transparency
whether the frame may have transparency
Definition nsgif.hpp:426
bool local_palette
whether the frame has a local colour table
Definition nsgif.hpp:428
nsgif_frame * frames
decoded frames
Definition gif.cpp.hpp:79
bool display
whether the frame should be displayed/animated
Definition nsgif.hpp:424
fl::size buf_pos
current index into GIF data
Definition gif.cpp.hpp:111
fl::u32 delay
delay (in cs) before animating the frame
Definition nsgif.hpp:434
fl::u32 lzw_data_length
Amount of LZW data found in scan.
Definition gif.cpp.hpp:50
bool decoded
whether the frame has previously been decoded.
Definition gif.cpp.hpp:43
fl::u32 frame_holders
current number of frame holders
Definition gif.cpp.hpp:116
fl::u8 disposal
Disposal method for previous frame; affects plotting.
Definition nsgif.hpp:432
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
#define NSGIF_NO_TRANSPARENCY
No transparency.
Definition gif.cpp.hpp:168

References fl::third_party::nsgif_frame::decoded, fl::third_party::nsgif_frame_info::delay, fl::third_party::nsgif_frame_info::display, fl::third_party::nsgif_frame_info::disposal, FL_NOEXCEPT, fl::third_party::nsgif_frame::frame_offset, fl::Free(), fl::third_party::nsgif_frame::info, fl::third_party::nsgif_frame_info::local_palette, fl::third_party::nsgif_frame::lzw_data_length, fl::Malloc(), fl::memcpy(), NSGIF_NO_TRANSPARENCY, fl::third_party::nsgif_frame::redraw_required, fl::third_party::nsgif_frame_info::transparency, and fl::third_party::nsgif_frame::transparency_index.

Referenced by nsgif__process_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__host_is_little_endian()

static bool fl::third_party::nsgif__host_is_little_endian ( void )
inlinestatic

Check whether the host is little endian.

Checks whether least significant bit is in the first byte of a fl::u16.

Returns
true if host is little endian.

Definition at line 1427 of file gif.cpp.hpp.

1428{
1429 const fl::u16 test = 1;
1430
1431 return ((const fl::u8 *) &test)[0];
1432}

References FL_NOEXCEPT.

Referenced by nsgif__bitmap_fmt_to_colour_layout().

+ Here is the caller graph for this function:

◆ nsgif__initialise_sprite()

static nsgif_error fl::third_party::nsgif__initialise_sprite ( struct nsgif * gif,
fl::u32 width,
fl::u32 height )
static

Updates the sprite memory size.

Parameters
gifThe animation context
widthThe width of the sprite
heightThe height of the sprite
Returns
NSGIF_ERR_OOM for a memory error NSGIF_OK for success

Definition at line 208 of file gif.cpp.hpp.

212{
213 /* Already allocated? */
214 if (gif->frame_image) {
215 return NSGIF_OK;
216 }
217
218 FL_ASSERT(gif->bitmap.create, "GIF bitmap create function required");
219 gif->frame_image = gif->bitmap.create(width, height);
220 if (gif->frame_image == nullptr) {
221 return NSGIF_ERR_OOM;
222 }
223
224 return NSGIF_OK;
225}
nsgif_bitmap_t *(* create)(int width, int height)
Callback to create a bitmap with the given dimensions.
Definition nsgif.hpp:186

References FL_ASSERT, FL_NOEXCEPT, fl::height, NSGIF_ERR_OOM, NSGIF_OK, and fl::width.

Referenced by nsgif__bitmap_get().

+ Here is the caller graph for this function:

◆ nsgif__next_displayable_frame()

static nsgif_error fl::third_party::nsgif__next_displayable_frame ( const nsgif_t * gif,
fl::u32 * frame,
fl::u32 * delay )
static

Definition at line 1836 of file gif.cpp.hpp.

1840{
1841 fl::u32 next = *frame;
1842
1843 do {
1844 next = nsgif__frame_next(gif, false, next);
1845 if (next <= *frame && *frame != NSGIF_FRAME_INVALID &&
1846 gif->data_complete == false) {
1847 return NSGIF_ERR_END_OF_DATA;
1848
1849 } else if (next == *frame || next == NSGIF_FRAME_INVALID) {
1851 }
1852
1853 if (delay != nullptr) {
1854 *delay += gif->frames[next].info.delay;
1855 }
1856
1857 } while (gif->frames[next].info.display == false);
1858
1859 *frame = next;
1860 return NSGIF_OK;
1861}
static fl::u32 nsgif__frame_next(const nsgif_t *gif, bool partial, fl::u32 frame) FL_NOEXCEPT
Definition gif.cpp.hpp:1819
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98

References fl::delay(), FL_NOEXCEPT, nsgif__frame_next(), NSGIF_ERR_END_OF_DATA, NSGIF_ERR_FRAME_DISPLAY, NSGIF_FRAME_INVALID, and NSGIF_OK.

Referenced by nsgif_frame_prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__next_row()

static bool fl::third_party::nsgif__next_row ( fl::u32 interlace,
fl::u32 height,
fl::u32 * y,
fl::u8 * step )
inlinestatic

Get the next line for GIF decode.

Parameters
[in]interlaceNon-zero if the frame is not interlaced.
[in]heightFrame height in pixels.
[in,out]yCurrent row, starting from 0, updated on exit.
[in,out]stepCurrent step starting with 24, updated on exit.
Returns
true if there is a row to process, false at the end of the frame.

Definition at line 394 of file gif.cpp.hpp.

396{
397 if (!interlace) {
398 return (++*y != height);
399 } else {
401 }
402}
static bool nsgif__deinterlace(fl::u32 height, fl::u32 *y, fl::u8 *step) FL_NOEXCEPT
Get the next line for GIF decode.
Definition gif.cpp.hpp:365

References FL_NOEXCEPT, fl::height, nsgif__deinterlace(), fl::step(), and fl::y.

Referenced by nsgif__decode_complex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_colour_table()

static nsgif_error fl::third_party::nsgif__parse_colour_table ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 ** pos,
bool decode )
static

Get a frame's colour table.

Sets up gif->colour_table for the frame.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to get the colour table for.
[in]posCurrent position in data, updated on exit.
[in]decodeWhether to decode the colour table.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1148 of file gif.cpp.hpp.

1153{
1154 nsgif_error ret;
1155 const fl::u8 *data = *pos;
1156 fl::size len = gif->buf + gif->buf_len - data;
1157 fl::size used_bytes;
1158
1159 FL_ASSERT(gif != nullptr, "GIF object required");
1160 FL_ASSERT(frame != nullptr, "Frame object required");
1161
1162 if ((frame->flags & NSGIF_COLOUR_TABLE_MASK) == 0) {
1164 return NSGIF_OK;
1165 }
1166
1167 if (decode == false) {
1168 frame->colour_table_offset = *pos - gif->buf;
1169 }
1170
1173 2 << (frame->flags & NSGIF_COLOUR_TABLE_SIZE_MASK),
1174 data, len, &used_bytes, decode);
1175 if (ret != NSGIF_OK) {
1176 return ret;
1177 }
1178 *pos += used_bytes;
1179
1180 if (decode) {
1181 gif->colour_table = gif->local_colour_table;
1182 } else {
1183 frame->info.local_palette = true;
1184 }
1185
1186 return NSGIF_OK;
1187}
static nsgif_error nsgif__colour_table_extract(fl::u32 colour_table[NSGIF_MAX_COLOURS], const struct nsgif_colour_layout *layout, fl::size colour_table_entries, const fl::u8 *data, fl::size data_len, fl::size *used, bool decode) FL_NOEXCEPT
Extract a GIF colour table into a LibNSGIF colour table buffer.
Definition gif.cpp.hpp:1115
fl::u32 global_colour_table[NSGIF_MAX_COLOURS]
global colour table
Definition gif.cpp.hpp:129
fl::u32 colour_table_offset
offset to frame colour table
Definition gif.cpp.hpp:56
struct nsgif_colour_layout colour_layout
Client's colour component order.
Definition gif.cpp.hpp:127
fl::u32 local_colour_table[NSGIF_MAX_COLOURS]
local colour table
Definition gif.cpp.hpp:131
#define NSGIF_COLOUR_TABLE_SIZE_MASK
Definition gif.cpp.hpp:172
#define NSGIF_COLOUR_TABLE_MASK
Definition gif.cpp.hpp:171

References FL_ASSERT, FL_NOEXCEPT, nsgif__colour_table_extract(), NSGIF_COLOUR_TABLE_MASK, NSGIF_COLOUR_TABLE_SIZE_MASK, NSGIF_OK, and pos.

Referenced by nsgif__process_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_extension_application()

static nsgif_error fl::third_party::nsgif__parse_extension_application ( struct nsgif * gif,
const fl::u8 * data,
fl::size len )
static

Parse the application extension.

Parameters
[in]gifThe gif object we're decoding.
[in]dataThe data to decode.
[in]lenByte length of data.
Returns
NSGIF_ERR_END_OF_DATA if more data is needed, NSGIF_OK for success.

Definition at line 846 of file gif.cpp.hpp.

850{
851 /* 14-byte+ Application Extension is:
852 *
853 * +0 CHAR Application Extension Label
854 * +1 CHAR Block Size
855 * +2 8CHARS Application Identifier
856 * +10 3CHARS Appl. Authentication Code
857 * +13 1-256 Application Data (Data sub-blocks)
858 */
859 if (len < 17) {
861 }
862
863 if (nsgif__app_ext_is_loop_count(data, len)) {
864 enum {
865 EXT_LOOP_COUNT_SUB_BLOCK_SIZE = 0x03,
866 EXT_LOOP_COUNT_SUB_BLOCK_ID = 0x01,
867 };
868 if ((data[13] == EXT_LOOP_COUNT_SUB_BLOCK_SIZE) &&
869 (data[14] == EXT_LOOP_COUNT_SUB_BLOCK_ID)) {
870 gif->info.loop_max = data[15] | (data[16] << 8);
871
872 /* The value in the source data means repeat N times
873 * after the first implied play. A value of zero has
874 * the special meaning of loop forever. (The only way
875 * to play the animation once is not to have this
876 * extension at all. */
877 if (gif->info.loop_max > 0) {
878 gif->info.loop_max++;
879 }
880 }
881 }
882
883 return NSGIF_OK;
884}
static bool nsgif__app_ext_is_loop_count(const fl::u8 *data, fl::size len) FL_NOEXCEPT
Check an app ext identifier and authentication code for loop count extension.
Definition gif.cpp.hpp:816
int loop_max
number of times to play animation (zero means loop forever)
Definition nsgif.hpp:390

References FL_NOEXCEPT, nsgif__app_ext_is_loop_count(), NSGIF_ERR_END_OF_DATA, and NSGIF_OK.

Referenced by nsgif__parse_frame_extensions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_extension_graphic_control()

static nsgif_error fl::third_party::nsgif__parse_extension_graphic_control ( struct nsgif_frame * frame,
const fl::u8 * data,
fl::size len )
static

Parse the graphic control extension.

Parameters
[in]frameThe gif frame object we're decoding.
[in]dataThe data to decode.
[in]lenByte length of data.
Returns
NSGIF_ERR_END_OF_DATA if more data is needed, NSGIF_OK for success.

Definition at line 756 of file gif.cpp.hpp.

760{
761 enum {
762 GIF_MASK_TRANSPARENCY = 0x01,
763 GIF_MASK_DISPOSAL = 0x1c,
764 };
765
766 /* 6-byte Graphic Control Extension is:
767 *
768 * +0 CHAR Graphic Control Label
769 * +1 CHAR Block Size
770 * +2 CHAR __Packed Fields__
771 * 3BITS Reserved
772 * 3BITS Disposal Method
773 * 1BIT User Input Flag
774 * 1BIT Transparent Color Flag
775 * +3 SHORT Delay Time
776 * +5 CHAR Transparent Color Index
777 */
778 if (len < 6) {
780 }
781
782 frame->info.delay = data[3] | (data[4] << 8);
783
784 if (data[2] & GIF_MASK_TRANSPARENCY) {
785 frame->info.transparency = true;
786 frame->transparency_index = data[5];
787 }
788
789 frame->info.disposal = ((data[2] & GIF_MASK_DISPOSAL) >> 2);
790 /* I have encountered documentation and GIFs in the
791 * wild that use 0x04 to restore the previous frame,
792 * rather than the officially documented 0x03. I
793 * believe some (older?) software may even actually
794 * export this way. We handle this as a type of
795 * "quirks" mode. */
798 }
799
800 /* if we are clearing the background then we need to
801 * redraw enough to cover the previous frame too. */
802 frame->redraw_required =
805
806 return NSGIF_OK;
807}

References FL_NOEXCEPT, NSGIF_DISPOSAL_RESTORE_BG, NSGIF_DISPOSAL_RESTORE_PREV, NSGIF_DISPOSAL_RESTORE_QUIRK, NSGIF_ERR_END_OF_DATA, and NSGIF_OK.

Referenced by nsgif__parse_frame_extensions().

+ Here is the caller graph for this function:

◆ nsgif__parse_frame_extensions()

static nsgif_error fl::third_party::nsgif__parse_frame_extensions ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 ** pos,
bool decode )
static

Parse the frame's extensions.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to parse extensions for.
[in]posCurrent position in data, updated on exit.
[in]decodeWhether to decode or skip over the extension.
Returns
NSGIF_ERR_END_OF_DATA if more data is needed, NSGIF_OK for success.

Definition at line 896 of file gif.cpp.hpp.

901{
902 enum {
903 GIF_EXT_INTRODUCER = 0x21,
904 GIF_EXT_GRAPHIC_CONTROL = 0xf9,
905 GIF_EXT_COMMENT = 0xfe,
906 GIF_EXT_PLAIN_TEXT = 0x01,
907 GIF_EXT_APPLICATION = 0xff,
908 };
909 const fl::u8 *nsgif_data = *pos;
910 const fl::u8 *nsgif_end = gif->buf + gif->buf_len;
911 int nsgif_bytes = nsgif_end - nsgif_data;
912
913 /* Initialise the extensions */
914 while (nsgif_bytes > 0 && nsgif_data[0] == GIF_EXT_INTRODUCER) {
915 bool block_step = true;
916 nsgif_error ret;
917
918 nsgif_data++;
919 nsgif_bytes--;
920
921 if (nsgif_bytes == 0) {
923 }
924
925 /* Switch on extension label */
926 switch (nsgif_data[0]) {
927 case GIF_EXT_GRAPHIC_CONTROL:
928 if (decode) {
930 frame,
931 nsgif_data,
932 nsgif_bytes);
933 if (ret != NSGIF_OK) {
934 return ret;
935 }
936 }
937 break;
938
939 case GIF_EXT_APPLICATION:
940 if (decode) {
942 gif, nsgif_data, nsgif_bytes);
943 if (ret != NSGIF_OK) {
944 return ret;
945 }
946 }
947 break;
948
949 case GIF_EXT_COMMENT:
950 /* Move the pointer to the first data sub-block Skip 1
951 * byte for the extension label. */
952 ++nsgif_data;
953 block_step = false;
954 break;
955
956 default:
957 break;
958 }
959
960 if (block_step) {
961 /* Move the pointer to the first data sub-block Skip 2
962 * bytes for the extension label and size fields Skip
963 * the extension size itself
964 */
965 if (nsgif_bytes < 2) {
967 }
968 nsgif_data += 2 + nsgif_data[1];
969 }
970
971 /* Repeatedly skip blocks until we get a zero block or run out
972 * of data. This data is ignored by this gif decoder. */
973 while (nsgif_data < nsgif_end && nsgif_data[0] != NSGIF_BLOCK_TERMINATOR) {
974 nsgif_data += nsgif_data[0] + 1;
975 if (nsgif_data >= nsgif_end) {
977 }
978 }
979 nsgif_data++;
980 nsgif_bytes = nsgif_end - nsgif_data;
981 }
982
983 if (nsgif_data > nsgif_end) {
984 nsgif_data = nsgif_end;
985 }
986
987 /* Set buffer position and return */
988 *pos = nsgif_data;
989 return NSGIF_OK;
990}
static nsgif_error nsgif__parse_extension_graphic_control(struct nsgif_frame *frame, const fl::u8 *data, fl::size len) FL_NOEXCEPT
Parse the graphic control extension.
Definition gif.cpp.hpp:756
static nsgif_error nsgif__parse_extension_application(struct nsgif *gif, const fl::u8 *data, fl::size len) FL_NOEXCEPT
Parse the application extension.
Definition gif.cpp.hpp:846
#define NSGIF_BLOCK_TERMINATOR
Definition gif.cpp.hpp:173

References FL_NOEXCEPT, nsgif__parse_extension_application(), nsgif__parse_extension_graphic_control(), NSGIF_BLOCK_TERMINATOR, NSGIF_ERR_END_OF_DATA, NSGIF_OK, and pos.

Referenced by nsgif__process_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_header()

static nsgif_error fl::third_party::nsgif__parse_header ( struct nsgif * gif,
const fl::u8 ** pos,
bool strict )
static

Read GIF header.

6-byte GIF file header is:

+0 3CHARS Signature ('GIF') +3 3CHARS Version ('87a' or '89a')

Parameters
[in]gifThe GIF object we're decoding.
[in,out]posThe current buffer position, updated on success.
[in]strictWhether to require a known GIF version.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1544 of file gif.cpp.hpp.

1548{
1549 const fl::u8 *data = *pos;
1550 fl::size len = gif->buf + gif->buf_len - data;
1551
1552 if (len < 6) {
1553 return NSGIF_ERR_END_OF_DATA;
1554 }
1555
1556 if (strncmp((const char *) data, "GIF", 3) != 0) {
1557 return NSGIF_ERR_DATA;
1558 }
1559 data += 3;
1560
1561 if (strict == true) {
1562 if ((strncmp((const char *) data, "87a", 3) != 0) &&
1563 (strncmp((const char *) data, "89a", 3) != 0)) {
1564 return NSGIF_ERR_DATA;
1565 }
1566 }
1567 data += 3;
1568
1569 *pos = data;
1570 return NSGIF_OK;
1571}

References FL_NOEXCEPT, NSGIF_ERR_DATA, NSGIF_ERR_END_OF_DATA, NSGIF_OK, pos, and fl::strncmp().

Referenced by nsgif_data_scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_image_data()

static nsgif_error fl::third_party::nsgif__parse_image_data ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 ** pos,
bool decode )
static

Parse the image data for a gif frame.

Sets up gif->colour_table for the frame.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to parse image data for.
[in]posCurrent position in data, updated on exit.
[in]decodeWhether to decode the image data.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1200 of file gif.cpp.hpp.

1205{
1206 const fl::u8 *data = *pos;
1207 fl::size len = gif->buf + gif->buf_len - data;
1208 fl::u32 frame_idx = frame - gif->frames;
1209 fl::u8 minimum_code_size;
1210 nsgif_error ret;
1211
1212 FL_ASSERT(gif != nullptr, "GIF object required");
1213 FL_ASSERT(frame != nullptr, "Frame object required");
1214
1215 if (!decode) {
1216 gif->frame_count_partial = frame_idx + 1;
1217 }
1218
1219 /* Ensure sufficient data remains. A gif trailer or a minimum lzw code
1220 * followed by a gif trailer is treated as OK, although without any
1221 * image data. */
1222 switch (len) {
1223 default: if (data[0] == NSGIF_TRAILER) return NSGIF_OK;
1224 break;
1225 case 2: if (data[1] == NSGIF_TRAILER) return NSGIF_OK;
1226 /* Fall through. */
1227 case 1: if (data[0] == NSGIF_TRAILER) return NSGIF_OK;
1228 /* Fall through. */
1229 case 0: return NSGIF_ERR_END_OF_DATA;
1230 }
1231
1232 minimum_code_size = data[0];
1233 if (minimum_code_size >= LZW_CODE_MAX) {
1234 return NSGIF_ERR_DATA_FRAME;
1235 }
1236
1237 if (decode) {
1238 ret = nsgif__update_bitmap(gif, frame, data, frame_idx);
1239 } else {
1240 fl::u32 block_size = 0;
1241
1242 /* Skip the minimum code size. */
1243 data++;
1244 len--;
1245
1246 while (block_size != 1) {
1247 if (len < 1) {
1248 return NSGIF_ERR_END_OF_DATA;
1249 }
1250 block_size = data[0] + 1;
1251 /* Check if the frame data runs off the end of the file */
1252 if (block_size > len) {
1253 frame->lzw_data_length += len;
1254 return NSGIF_ERR_END_OF_DATA;
1255 }
1256
1257 len -= block_size;
1258 data += block_size;
1259 frame->lzw_data_length += block_size;
1260 }
1261
1262 *pos = data;
1263
1264 gif->info.frame_count = frame_idx + 1;
1265 gif->frames[frame_idx].info.display = true;
1266
1267 return NSGIF_OK;
1268 }
1269
1270 return ret;
1271}
static nsgif_error nsgif__update_bitmap(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 *data, fl::u32 frame_idx) FL_NOEXCEPT
Definition gif.cpp.hpp:694
#define NSGIF_TRAILER
Definition gif.cpp.hpp:174

References FL_ASSERT, FL_NOEXCEPT, LZW_CODE_MAX, nsgif__update_bitmap(), NSGIF_ERR_DATA_FRAME, NSGIF_ERR_END_OF_DATA, NSGIF_OK, NSGIF_TRAILER, and pos.

Referenced by nsgif__process_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__parse_image_descriptor()

static nsgif_error fl::third_party::nsgif__parse_image_descriptor ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 ** pos,
bool decode )
static

Parse a GIF Image Descriptor.

The format is:

+0 CHAR Image Separator (0x2c) +1 SHORT Image Left Position +3 SHORT Image Top Position +5 SHORT Width +7 SHORT Height +9 CHAR Packed Fields 1BIT Local Colour Table Flag 1BIT Interlace Flag 1BIT Sort Flag 2BITS Reserved 3BITS Size of Local Colour Table

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to parse an image descriptor for.
[in]posCurrent position in data, updated on exit.
[in]decodeWhether to decode the image descriptor.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1015 of file gif.cpp.hpp.

1020{
1021 const fl::u8 *data = *pos;
1022 fl::size len = gif->buf + gif->buf_len - data;
1023 enum {
1024 NSGIF_IMAGE_DESCRIPTOR_LEN = 10u,
1025 NSGIF_IMAGE_SEPARATOR = 0x2Cu,
1026 NSGIF_MASK_INTERLACE = 0x40u,
1027 };
1028
1029 FL_ASSERT(gif != nullptr, "GIF object required");
1030 FL_ASSERT(frame != nullptr, "Frame object required");
1031
1032 if (len < NSGIF_IMAGE_DESCRIPTOR_LEN) {
1033 return NSGIF_ERR_END_OF_DATA;
1034 }
1035
1036 if (decode) {
1037 fl::u32 x, y, w, h;
1038
1039 if (data[0] != NSGIF_IMAGE_SEPARATOR) {
1040 return NSGIF_ERR_DATA_FRAME;
1041 }
1042
1043 x = data[1] | (data[2] << 8);
1044 y = data[3] | (data[4] << 8);
1045 w = data[5] | (data[6] << 8);
1046 h = data[7] | (data[8] << 8);
1047 frame->flags = data[9];
1048
1049 frame->info.rect.x0 = x;
1050 frame->info.rect.y0 = y;
1051 frame->info.rect.x1 = x + w;
1052 frame->info.rect.y1 = y + h;
1053
1054 frame->info.interlaced = frame->flags & NSGIF_MASK_INTERLACE;
1055
1056 /* Allow first frame to grow image dimensions. */
1057 if (gif->info.frame_count == 0) {
1058 if (x + w > gif->info.width) {
1059 gif->info.width = x + w;
1060 }
1061 if (y + h > gif->info.height) {
1062 gif->info.height = y + h;
1063 }
1064 }
1065 }
1066
1067 *pos += NSGIF_IMAGE_DESCRIPTOR_LEN;
1068 return NSGIF_OK;
1069}

References FL_ASSERT, FL_NOEXCEPT, NSGIF_ERR_DATA_FRAME, NSGIF_ERR_END_OF_DATA, NSGIF_OK, pos, fl::x, and fl::y.

Referenced by nsgif__process_frame().

+ Here is the caller graph for this function:

◆ nsgif__parse_logical_screen_descriptor()

static nsgif_error fl::third_party::nsgif__parse_logical_screen_descriptor ( struct nsgif * gif,
const fl::u8 ** pos )
static

Read Logical Screen Descriptor.

7-byte Logical Screen Descriptor is:

+0 SHORT Logical Screen Width +2 SHORT Logical Screen Height +4 CHAR Packed Fields 1BIT Global Colour Table Flag 3BITS Colour Resolution 1BIT Sort Flag 3BITS Size of Global Colour Table +5 CHAR Background Colour Index +6 CHAR Pixel Aspect Ratio

Parameters
[in]gifThe GIF object we're decoding.
[in,out]posThe current buffer position, updated on success.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1592 of file gif.cpp.hpp.

1595{
1596 const fl::u8 *data = *pos;
1597 fl::size len = gif->buf + gif->buf_len - data;
1598
1599 if (len < 7) {
1600 return NSGIF_ERR_END_OF_DATA;
1601 }
1602
1603 gif->info.width = data[0] | (data[1] << 8);
1604 gif->info.height = data[2] | (data[3] << 8);
1606 gif->colour_table_size = 2 << (data[4] & NSGIF_COLOUR_TABLE_SIZE_MASK);
1607 gif->bg_index = data[5];
1608 gif->aspect_ratio = data[6];
1609 gif->info.loop_max = 1;
1610
1611 *pos += 7;
1612 return NSGIF_OK;
1613}
fl::u32 colour_table_size
size of global colour table (in entries)
Definition gif.cpp.hpp:122
fl::u32 aspect_ratio
image aspect ratio (ignored)
Definition gif.cpp.hpp:120
bool global_palette
whether the GIF has a global colour table
Definition nsgif.hpp:394
fl::u32 bg_index
background index
Definition gif.cpp.hpp:118

References FL_NOEXCEPT, NSGIF_COLOUR_TABLE_MASK, NSGIF_COLOUR_TABLE_SIZE_MASK, NSGIF_ERR_END_OF_DATA, NSGIF_OK, and pos.

Referenced by nsgif_data_scan().

+ Here is the caller graph for this function:

◆ nsgif__process_frame()

static nsgif_error fl::third_party::nsgif__process_frame ( struct nsgif * gif,
fl::u32 frame_idx,
bool decode )
static

Attempts to initialise the next frame.

Parameters
[in]gifThe animation context
[in]frame_idxThe frame number to decode.
[in]decodeWhether to decode the graphical image data.
Returns
NSGIF_OK on success, appropriate error otherwise.

Definition at line 1323 of file gif.cpp.hpp.

1327{
1328 nsgif_error ret;
1329 const fl::u8 *pos;
1330 const fl::u8 *end;
1331 struct nsgif_frame *frame;
1332
1333 frame = nsgif__get_frame(gif, frame_idx);
1334 if (frame == nullptr) {
1335 return NSGIF_ERR_OOM;
1336 }
1337
1338 end = gif->buf + gif->buf_len;
1339
1340 if (decode) {
1341 pos = gif->buf + frame->frame_offset;
1342
1343 /* Ensure this frame is supposed to be decoded */
1344 if (frame->info.display == false) {
1345 return NSGIF_OK;
1346 }
1347
1348 /* Ensure the frame is in range to decode */
1349 if (frame_idx > gif->frame_count_partial) {
1350 return NSGIF_ERR_END_OF_DATA;
1351 }
1352
1353 /* Done if frame is already decoded */
1354 if (frame_idx == gif->decoded_frame) {
1355 return NSGIF_OK;
1356 }
1357 } else {
1358 pos = gif->buf + gif->buf_pos;
1359
1360 /* Check if we've finished */
1361 if (pos < end && pos[0] == NSGIF_TRAILER) {
1362 return NSGIF_OK;
1363 }
1364 }
1365
1366 ret = nsgif__parse_frame_extensions(gif, frame, &pos, !decode);
1367 if (ret != NSGIF_OK) {
1368 goto cleanup;
1369 }
1370
1371 ret = nsgif__parse_image_descriptor(gif, frame, &pos, !decode);
1372 if (ret != NSGIF_OK) {
1373 goto cleanup;
1374 }
1375
1376 ret = nsgif__parse_colour_table(gif, frame, &pos, decode);
1377 if (ret != NSGIF_OK) {
1378 goto cleanup;
1379 }
1380
1381 ret = nsgif__parse_image_data(gif, frame, &pos, decode);
1382 if (ret != NSGIF_OK) {
1383 goto cleanup;
1384 }
1385
1386cleanup:
1387 if (!decode) {
1388 gif->buf_pos = pos - gif->buf;
1389 }
1390
1391 return ret;
1392}
static nsgif_error nsgif__parse_image_descriptor(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
Parse a GIF Image Descriptor.
Definition gif.cpp.hpp:1015
static nsgif_error nsgif__parse_frame_extensions(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
Parse the frame's extensions.
Definition gif.cpp.hpp:896
static nsgif_error nsgif__parse_image_data(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
Parse the image data for a gif frame.
Definition gif.cpp.hpp:1200
static struct nsgif_frame * nsgif__get_frame(struct nsgif *gif, fl::u32 frame_idx) FL_NOEXCEPT
Definition gif.cpp.hpp:1273
static nsgif_error nsgif__parse_colour_table(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 **pos, bool decode) FL_NOEXCEPT
Get a frame's colour table.
Definition gif.cpp.hpp:1148
fl::u32 decoded_frame
current frame decoded to bitmap
Definition gif.cpp.hpp:83
constexpr T * end(T(&array)[N]) FL_NOEXCEPT

References fl::third_party::nsgif_frame_info::display, fl::end(), FL_NOEXCEPT, fl::third_party::nsgif_frame::frame_offset, fl::third_party::nsgif_frame::info, nsgif__get_frame(), nsgif__parse_colour_table(), nsgif__parse_frame_extensions(), nsgif__parse_image_data(), nsgif__parse_image_descriptor(), NSGIF_ERR_END_OF_DATA, NSGIF_ERR_OOM, NSGIF_OK, NSGIF_TRAILER, and pos.

Referenced by nsgif_data_scan(), and nsgif_frame_decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__record_frame()

static void fl::third_party::nsgif__record_frame ( struct nsgif * gif,
const fl::u32 * bitmap )
static

Definition at line 302 of file gif.cpp.hpp.

305{
306 fl::size pixel_bytes = sizeof(*bitmap);
307 fl::size height = gif->info.height;
308 fl::size width = gif->info.width;
309 fl::u32 *prev_frame;
310
312 gif->decoded_frame == gif->prev_index) {
313 /* No frame to copy, or already have this frame recorded. */
314 return;
315 }
316
317 bitmap = nsgif__bitmap_get(gif);
318 if (bitmap == nullptr) {
319 return;
320 }
321
322 if (gif->prev_frame == nullptr) {
323 prev_frame = static_cast<fl::u32*>(fl::Malloc(width * height * pixel_bytes));
324 if (prev_frame == nullptr) {
325 return;
326 }
327 gif->prev_frame = prev_frame;
328 } else {
329 prev_frame = static_cast<fl::u32*>(gif->prev_frame);
330 }
331
332 fl::memcpy(prev_frame, bitmap, width * height * pixel_bytes);
333
334 gif->prev_frame = prev_frame;
335 gif->prev_index = gif->decoded_frame;
336}
static fl::u32 * nsgif__bitmap_get(struct nsgif *gif) FL_NOEXCEPT
Helper to get the rendering bitmap for a gif.
Definition gif.cpp.hpp:233
fl::u32 prev_index
previous frame index
Definition gif.cpp.hpp:136
void * prev_frame
previous frame for NSGIF_FRAME_RESTORE
Definition gif.cpp.hpp:134

References FL_NOEXCEPT, fl::height, fl::Malloc(), fl::memcpy(), nsgif__bitmap_get(), NSGIF_FRAME_INVALID, and fl::width.

Referenced by nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__recover_frame()

static nsgif_error fl::third_party::nsgif__recover_frame ( const struct nsgif * gif,
fl::u32 * bitmap )
static

Definition at line 338 of file gif.cpp.hpp.

341{
342 const fl::u32 *prev_frame = static_cast<const fl::u32*>(gif->prev_frame);
343 fl::size pixel_bytes = sizeof(*bitmap);
344 fl::size height = gif->info.height;
345 fl::size width = gif->info.width;
346
347 fl::memcpy(bitmap, prev_frame, height * width * pixel_bytes);
348
349 return NSGIF_OK;
350}

References FL_NOEXCEPT, fl::height, fl::memcpy(), NSGIF_OK, and fl::width.

Referenced by nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__redraw_rect_extend()

static void fl::third_party::nsgif__redraw_rect_extend ( const nsgif_rect_t * frame,
nsgif_rect_t * redraw )
static

Definition at line 1797 of file gif.cpp.hpp.

1800{
1801 if (redraw->x1 == 0 || redraw->y1 == 0) {
1802 *redraw = *frame;
1803 } else {
1804 if (redraw->x0 > frame->x0) {
1805 redraw->x0 = frame->x0;
1806 }
1807 if (redraw->x1 < frame->x1) {
1808 redraw->x1 = frame->x1;
1809 }
1810 if (redraw->y0 > frame->y0) {
1811 redraw->y0 = frame->y0;
1812 }
1813 if (redraw->y1 < frame->y1) {
1814 redraw->y1 = frame->y1;
1815 }
1816 }
1817}

References FL_NOEXCEPT.

Referenced by nsgif_frame_prepare().

+ Here is the caller graph for this function:

◆ nsgif__restore_bg()

static void fl::third_party::nsgif__restore_bg ( struct nsgif * gif,
struct nsgif_frame * frame,
fl::u32 * bitmap )
static

Restore a GIF to the background colour.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to clear, or NULL.
[in]bitmapThe bitmap to clear the frame in.

Definition at line 647 of file gif.cpp.hpp.

651{
652 fl::size pixel_bytes = sizeof(*bitmap);
653
654 if (frame == nullptr) {
655 fl::size width = gif->info.width;
656 fl::size height = gif->info.height;
657
659 width * height * pixel_bytes);
660 } else {
661 fl::u32 width = frame->info.rect.x1 - frame->info.rect.x0;
662 fl::u32 height = frame->info.rect.y1 - frame->info.rect.y0;
663 fl::u32 offset_x = frame->info.rect.x0;
664 fl::u32 offset_y = frame->info.rect.y0;
665
666 if (frame->info.display == false ||
667 frame->info.rect.x0 >= gif->info.width ||
668 frame->info.rect.y0 >= gif->info.height) {
669 return;
670 }
671
672 width -= gif__clip(offset_x, width, gif->info.width);
673 height -= gif__clip(offset_y, height, gif->info.height);
674
675 if (frame->info.transparency) {
676 for (fl::u32 y = 0; y < height; y++) {
677 fl::u32 *scanline = bitmap + offset_x +
678 (offset_y + y) * gif->info.width;
680 width * pixel_bytes);
681 }
682 } else {
683 for (fl::u32 y = 0; y < height; y++) {
684 fl::u32 *scanline = bitmap + offset_x +
685 (offset_y + y) * gif->info.width;
686 for (fl::u32 x = 0; x < width; x++) {
687 scanline[x] = gif->info.background;
688 }
689 }
690 }
691 }
692}
fl::u32 background
background colour in same pixel format as nsgif_bitmap_t.
Definition nsgif.hpp:392
#define NSGIF_TRANSPARENT_COLOUR
Transparent colour.
Definition gif.cpp.hpp:165

References FL_NOEXCEPT, gif__clip(), fl::height, fl::memset(), NSGIF_TRANSPARENT_COLOUR, fl::width, fl::x, and fl::y.

Referenced by nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif__update_bitmap()

static nsgif_error fl::third_party::nsgif__update_bitmap ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 * data,
fl::u32 frame_idx )
static

Definition at line 694 of file gif.cpp.hpp.

699{
700 nsgif_error ret;
701 fl::u32 *bitmap;
702
703 gif->decoded_frame = frame_idx;
704
705 bitmap = nsgif__bitmap_get(gif);
706 if (bitmap == nullptr) {
707 return NSGIF_ERR_OOM;
708 }
709
710 /* Handle any bitmap clearing/restoration required before decoding this
711 * frame. */
712 if (frame_idx == 0 || gif->decoded_frame == NSGIF_FRAME_INVALID) {
713 nsgif__restore_bg(gif, nullptr, bitmap);
714
715 } else {
716 struct nsgif_frame *prev = &gif->frames[frame_idx - 1];
717
718 if (prev->info.disposal == NSGIF_DISPOSAL_RESTORE_BG) {
719 nsgif__restore_bg(gif, prev, bitmap);
720
721 } else if (prev->info.disposal == NSGIF_DISPOSAL_RESTORE_PREV) {
722 ret = nsgif__recover_frame(gif, bitmap);
723 if (ret != NSGIF_OK) {
724 nsgif__restore_bg(gif, prev, bitmap);
725 }
726 }
727 }
728
730 /* Store the previous frame for later restoration */
731 nsgif__record_frame(gif, bitmap);
732 }
733
734 ret = nsgif__decode(gif, frame, data, bitmap);
735
737
738 if (!frame->decoded) {
739 frame->opaque = nsgif__bitmap_get_opaque(gif);
740 frame->decoded = true;
741 }
742 nsgif__bitmap_set_opaque(gif, frame);
743
744 return ret;
745}
static void nsgif__restore_bg(struct nsgif *gif, struct nsgif_frame *frame, fl::u32 *bitmap) FL_NOEXCEPT
Restore a GIF to the background colour.
Definition gif.cpp.hpp:647
static void nsgif__record_frame(struct nsgif *gif, const fl::u32 *bitmap) FL_NOEXCEPT
Definition gif.cpp.hpp:302
static bool nsgif__bitmap_get_opaque(const struct nsgif *gif) FL_NOEXCEPT
Helper to get the client to determine if the bitmap is opaque.
Definition gif.cpp.hpp:291
static nsgif_error nsgif__recover_frame(const struct nsgif *gif, fl::u32 *bitmap) FL_NOEXCEPT
Definition gif.cpp.hpp:338
static nsgif_error nsgif__decode(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 *data, fl::u32 *frame_data) FL_NOEXCEPT
Definition gif.cpp.hpp:605
static void nsgif__bitmap_modified(const struct nsgif *gif) FL_NOEXCEPT
Helper to tell the client that their bitmap was modified.
Definition gif.cpp.hpp:259
static void nsgif__bitmap_set_opaque(const struct nsgif *gif, const struct nsgif_frame *frame) FL_NOEXCEPT
Helper to tell the client that whether the bitmap is opaque.
Definition gif.cpp.hpp:273

References fl::third_party::nsgif_frame_info::disposal, FL_NOEXCEPT, fl::third_party::nsgif_frame::info, nsgif__bitmap_get(), nsgif__bitmap_get_opaque(), nsgif__bitmap_modified(), nsgif__bitmap_set_opaque(), nsgif__decode(), nsgif__record_frame(), nsgif__recover_frame(), nsgif__restore_bg(), NSGIF_DISPOSAL_RESTORE_BG, NSGIF_DISPOSAL_RESTORE_PREV, NSGIF_ERR_OOM, NSGIF_FRAME_INVALID, and NSGIF_OK.

Referenced by nsgif__parse_image_data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_create()

nsgif_error fl::third_party::nsgif_create ( const nsgif_bitmap_cb_vt * bitmap_vt,
nsgif_bitmap_fmt_t bitmap_fmt,
nsgif_t ** gif_out )

Create the NSGIF object.

Parameters
[in]bitmap_vtBitmap operation functions v-table.
[in]bitmap_fmtBitmap pixel format specification.
[out]gif_outReturn nsgif_t object on success.
Returns
NSGIF_OK on success, or appropriate error otherwise.

Definition at line 1493 of file gif.cpp.hpp.

1497{
1498 nsgif_t *gif;
1499
1500 gif = static_cast<nsgif_t*>(fl::Malloc(sizeof(*gif)));
1501 if (gif) {
1502 fl::memset(gif, 0, sizeof(*gif));
1503 }
1504 if (gif == nullptr) {
1505 return NSGIF_ERR_OOM;
1506 }
1507
1508 gif->bitmap = *bitmap_vt;
1511
1514
1516
1517 *gif_out = gif;
1518 return NSGIF_OK;
1519}
static struct nsgif_colour_layout nsgif__bitmap_fmt_to_colour_layout(nsgif_bitmap_fmt_t bitmap_fmt) FL_NOEXCEPT
Definition gif.cpp.hpp:1434
struct nsgif nsgif_t
Opaque type used by LibNSGIF to represent a GIF object in memory.
Definition nsgif.hpp:34
fl::u16 delay_min
Minimum allowable frame delay.
Definition gif.cpp.hpp:91
fl::u16 delay_default
Frame delay to apply when delay is less than delay_min.
Definition gif.cpp.hpp:94
#define NSGIF_FRAME_DELAY_MIN
Default minimum allowable frame delay in cs.
Definition gif.cpp.hpp:27
#define NSGIF_FRAME_DELAY_DEFAULT
Default frame delay to apply.
Definition gif.cpp.hpp:34

References fl::third_party::nsgif::bitmap, fl::third_party::nsgif::colour_layout, fl::third_party::nsgif::decoded_frame, fl::third_party::nsgif::delay_default, fl::third_party::nsgif::delay_min, FL_NOEXCEPT, fl::Malloc(), fl::memset(), nsgif__bitmap_fmt_to_colour_layout(), NSGIF_ERR_OOM, NSGIF_FRAME_DELAY_DEFAULT, NSGIF_FRAME_DELAY_MIN, NSGIF_FRAME_INVALID, NSGIF_OK, and fl::third_party::nsgif::prev_index.

Referenced by fl::third_party::SoftwareGifDecoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_data_complete()

void fl::third_party::nsgif_data_complete ( nsgif_t * gif)

Tell libnsgif that all the gif data has been provided.

Call this after calling nsgif_data_scan with the the entire GIF source data. You can call nsgif_data_scan multiple times up until this is called, and after this is called, nsgif_data_scan will return an error.

You can decode a GIF before this is called, however, it will fail to decode any truncated final frame data and will not perform loops when driven via nsgif_frame_prepare (because it doesn't know if there will be more frames supplied in future data).

Parameters
[in]gifThe nsgif_t object.

Definition at line 1772 of file gif.cpp.hpp.

1774{
1775 if (gif->data_complete == false) {
1776 fl::u32 start = gif->info.frame_count;
1777 fl::u32 end = gif->frame_count_partial;
1778
1779 for (fl::u32 f = start; f < end; f++) {
1780 nsgif_frame *frame = &gif->frames[f];
1781
1782 if (frame->lzw_data_length > 0) {
1783 frame->info.display = true;
1784 gif->info.frame_count = f + 1;
1785
1786 if (f == 0) {
1787 frame->info.transparency = true;
1788 }
1789 break;
1790 }
1791 }
1792 }
1793
1794 gif->data_complete = true;
1795}

References fl::third_party::nsgif_frame_info::display, fl::end(), FL_NOEXCEPT, fl::third_party::nsgif_frame::info, fl::third_party::nsgif_frame::lzw_data_length, and fl::third_party::nsgif_frame_info::transparency.

Referenced by fl::third_party::SoftwareGifDecoder::loadMoreData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_data_scan()

nsgif_error fl::third_party::nsgif_data_scan ( nsgif_t * gif,
fl::size size,
const fl::u8 * data )

Scan the source image data.

This is used to feed the source data into LibNSGIF. This must be called before calling nsgif_frame_decode.

It can be called multiple times with, with increasing sizes. If it is called several times, as more data is available (e.g. slow network fetch) the data already given to nsgif_data_scan must be provided each time.

Once all the data has been provided, call nsgif_data_complete.

For example, if you call nsgif_data_scan with 25 bytes of data, and then fetch another 10 bytes, you would need to call nsgif_data_scan with a size of 35 bytes, and the whole 35 bytes must be contiguous memory. It is safe to realloc the source buffer between calls to nsgif_data_scan. (The actual data pointer is allowed to be different.)

If an error occurs, all previously scanned frames are retained.

Note that an error returned from this function is purely informational. So long as at least one frame is available, you can display frames.

Parameters
[in]gifThe nsgif_t object.
[in]sizeNumber of bytes in data.
[in]dataRaw source GIF data.
Returns
NSGIF_OK on success, or appropriate error otherwise.

Definition at line 1616 of file gif.cpp.hpp.

1620{
1621 const fl::u8 *nsgif_data;
1622 nsgif_error ret;
1623 fl::u32 frames;
1624
1625 if (gif->data_complete) {
1627 }
1628
1629 /* Initialize values */
1630 gif->buf_len = size;
1631 gif->buf = data;
1632
1633 /* Get our current processing position */
1634 nsgif_data = gif->buf + gif->buf_pos;
1635
1636 /* See if we should initialise the GIF */
1637 if (gif->buf_pos == 0) {
1638 /* We want everything to be NULL before we start so we've no
1639 * chance of freeing bad pointers (paranoia)
1640 */
1641 gif->frame_image = nullptr;
1642 gif->frames = nullptr;
1643 gif->frame_holders = 0;
1644
1645 /* The caller may have been lazy and not reset any values */
1646 gif->info.frame_count = 0;
1647 gif->frame_count_partial = 0;
1650
1651 ret = nsgif__parse_header(gif, &nsgif_data, false);
1652 if (ret != NSGIF_OK) {
1653 return ret;
1654 }
1655
1656 ret = nsgif__parse_logical_screen_descriptor(gif, &nsgif_data);
1657 if (ret != NSGIF_OK) {
1658 return ret;
1659 }
1660
1661 /* Remember we've done this now */
1662 gif->buf_pos = nsgif_data - gif->buf;
1663
1664 /* Some broken GIFs report the size as the screen size they
1665 * were created in. As such, we detect for the common cases and
1666 * set the sizes as 0 if they are found which results in the
1667 * GIF being the maximum size of the frames.
1668 */
1669 if (((gif->info.width == 640) && (gif->info.height == 480)) ||
1670 ((gif->info.width == 640) && (gif->info.height == 512)) ||
1671 ((gif->info.width == 800) && (gif->info.height == 600)) ||
1672 ((gif->info.width == 1024) && (gif->info.height == 768)) ||
1673 ((gif->info.width == 1280) && (gif->info.height == 1024)) ||
1674 ((gif->info.width == 1600) && (gif->info.height == 1200)) ||
1675 ((gif->info.width == 0) || (gif->info.height == 0)) ||
1676 ((gif->info.width > 2048) || (gif->info.height > 2048))) {
1677 gif->info.width = 1;
1678 gif->info.height = 1;
1679 }
1680
1681 /* Set the first colour to a value that will never occur in
1682 * reality so we know if we've processed it
1683 */
1685
1686 /* Check if the GIF has no frame data (13-byte header + 1-byte
1687 * termination block) Although generally useless, the GIF
1688 * specification does not expressly prohibit this
1689 */
1690 if (gif->buf_len == gif->buf_pos + 1) {
1691 if (nsgif_data[0] == NSGIF_TRAILER) {
1692 return NSGIF_OK;
1693 }
1694 }
1695 }
1696
1697 /* Do the colour map if we haven't already. As the top byte is always
1698 * 0xff or 0x00 depending on the transparency we know if it's been
1699 * filled in.
1700 */
1702 /* Check for a global colour map signified by bit 7 */
1703 if (gif->info.global_palette) {
1704 fl::size remaining = gif->buf + gif->buf_len - nsgif_data;
1705 fl::size used;
1706
1709 &gif->colour_layout,
1710 gif->colour_table_size,
1711 nsgif_data, remaining, &used, true);
1712 if (ret != NSGIF_OK) {
1713 return ret;
1714 }
1715
1716 nsgif_data += used;
1717 gif->buf_pos = (nsgif_data - gif->buf);
1718 } else {
1719 /* Create a default colour table with the first two
1720 * colours as black and white. */
1721 fl::u8 *entry = (fl::u8 *)gif->global_colour_table;
1722
1723 /* Black */
1724 entry[gif->colour_layout.r] = 0x00;
1725 entry[gif->colour_layout.g] = 0x00;
1726 entry[gif->colour_layout.b] = 0x00;
1727 entry[gif->colour_layout.a] = 0xFF;
1728
1729 entry += sizeof(fl::u32);
1730
1731 /* White */
1732 entry[gif->colour_layout.r] = 0xFF;
1733 entry[gif->colour_layout.g] = 0xFF;
1734 entry[gif->colour_layout.b] = 0xFF;
1735 entry[gif->colour_layout.a] = 0xFF;
1736
1737 gif->colour_table_size = 2;
1738 }
1739
1740 if (gif->info.global_palette &&
1741 gif->bg_index < gif->colour_table_size) {
1742 fl::size bg_idx = gif->bg_index;
1743 gif->info.background = gif->global_colour_table[bg_idx];
1744 } else {
1745 gif->info.background = gif->global_colour_table[0];
1746 }
1747 }
1748
1749 if (gif->lzw_ctx == nullptr) {
1750 struct lzw_ctx *lzw_ctx_ptr = nullptr;
1751 lzw_result res = lzw_context_create(&lzw_ctx_ptr);
1752 gif->lzw_ctx = lzw_ctx_ptr;
1753 if (res != LZW_OK) {
1754 return nsgif__error_from_lzw(res);
1755 }
1756 }
1757
1758 /* Try to initialise all frames. */
1759 do {
1760 frames = gif->info.frame_count;
1761 ret = nsgif__process_frame(gif, frames, false);
1762 } while (gif->info.frame_count > frames);
1763
1764 if (ret == NSGIF_ERR_END_OF_DATA && gif->info.frame_count > 0) {
1765 ret = NSGIF_OK;
1766 }
1767
1768 return ret;
1769}
lzw_result lzw_context_create(struct lzw_ctx **ctx) FL_NOEXCEPT
Create an LZW decompression context.
Definition lzw.cpp.hpp:104
static nsgif_error nsgif__parse_logical_screen_descriptor(struct nsgif *gif, const fl::u8 **pos) FL_NOEXCEPT
Read Logical Screen Descriptor.
Definition gif.cpp.hpp:1592
static nsgif_error nsgif__parse_header(struct nsgif *gif, const fl::u8 **pos, bool strict) FL_NOEXCEPT
Read GIF header.
Definition gif.cpp.hpp:1544
static nsgif_error nsgif__process_frame(struct nsgif *gif, fl::u32 frame_idx, bool decode) FL_NOEXCEPT
Attempts to initialise the next frame.
Definition gif.cpp.hpp:1323
fl::u32 frame
current frame
Definition gif.cpp.hpp:81
#define NSGIF_PROCESS_COLOURS
Internal flag that the colour table needs to be processed.
Definition gif.cpp.hpp:159

References FL_NOEXCEPT, lzw_context_create(), LZW_OK, nsgif__colour_table_extract(), nsgif__error_from_lzw(), nsgif__parse_header(), nsgif__parse_logical_screen_descriptor(), nsgif__process_frame(), NSGIF_ERR_DATA_COMPLETE, NSGIF_ERR_END_OF_DATA, NSGIF_FRAME_INVALID, NSGIF_OK, NSGIF_PROCESS_COLOURS, and NSGIF_TRAILER.

Referenced by fl::third_party::SoftwareGifDecoder::loadMoreData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_destroy()

void fl::third_party::nsgif_destroy ( nsgif_t * gif)

Free a NSGIF object.

Parameters
[in]gifThe NSGIF to free.

Definition at line 1395 of file gif.cpp.hpp.

1396{
1397 if (gif == nullptr) {
1398 return;
1399 }
1400
1401 /* Release all our memory blocks */
1402 if (gif->frame_image) {
1403 FL_ASSERT(gif->bitmap.destroy, "GIF bitmap destroy function required");
1404 gif->bitmap.destroy(gif->frame_image);
1405 gif->frame_image = nullptr;
1406 }
1407
1408 fl::Free(gif->frames);
1409 gif->frames = nullptr;
1410
1411 fl::Free(gif->prev_frame);
1412 gif->prev_frame = nullptr;
1413
1414 lzw_context_destroy(static_cast<struct lzw_ctx*>(gif->lzw_ctx));
1415 gif->lzw_ctx = nullptr;
1416
1417 fl::Free(gif);
1418}
void lzw_context_destroy(struct lzw_ctx *ctx) FL_NOEXCEPT
Destroy an LZW decompression context.
Definition lzw.cpp.hpp:116
void(* destroy)(nsgif_bitmap_t *bitmap)
Callback to free a bitmap.
Definition nsgif.hpp:193

References FL_ASSERT, FL_NOEXCEPT, fl::Free(), and lzw_context_destroy().

Referenced by fl::third_party::SoftwareGifDecoder::cleanupDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_frame_decode()

nsgif_error fl::third_party::nsgif_frame_decode ( nsgif_t * gif,
fl::u32 frame,
nsgif_bitmap_t ** bitmap )

Decodes a GIF frame.

Parameters
[in]gifThe nsgif_t object.
[in]frameThe frame number to decode.
[out]bitmapOn success, returns pointer to the client-allocated, nsgif-owned client bitmap structure.
Returns
NSGIF_OK on success, or appropriate error otherwise.

Definition at line 1953 of file gif.cpp.hpp.

1957{
1958 fl::u32 start_frame;
1959 nsgif_error ret = NSGIF_OK;
1960
1961 if (frame >= gif->info.frame_count) {
1962 return NSGIF_ERR_BAD_FRAME;
1963 }
1964
1965 if (gif->decoded_frame == frame) {
1966 *bitmap = gif->frame_image;
1967 return NSGIF_OK;
1968
1969 } else if (gif->decoded_frame >= frame ||
1971 /* Can skip to first frame or restart. */
1972 start_frame = 0;
1973 } else {
1974 start_frame = nsgif__frame_next(
1975 gif, false, gif->decoded_frame);
1976 }
1977
1978 for (fl::u32 f = start_frame; f <= frame; f++) {
1979 ret = nsgif__process_frame(gif, f, true);
1980 if (ret != NSGIF_OK) {
1981 return ret;
1982 }
1983 }
1984
1985 *bitmap = gif->frame_image;
1986 return ret;
1987}

References FL_NOEXCEPT, nsgif__frame_next(), nsgif__process_frame(), NSGIF_ERR_BAD_FRAME, NSGIF_FRAME_INVALID, and NSGIF_OK.

Referenced by fl::third_party::SoftwareGifDecoder::decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nsgif_frame_prepare()

nsgif_error fl::third_party::nsgif_frame_prepare ( nsgif_t * gif,
nsgif_rect_t * area,
fl::u32 * delay_cs,
fl::u32 * frame_new )

Prepare to show a frame.

If this is the last frame of an animation with a finite loop count, the returned delay_cs will be NSGIF_INFINITE, indicating that the frame should be shown forever.

Note that if nsgif_data_complete has not been called on this gif, animated GIFs will not loop back to the start. Instead it will return NSGIF_ERR_END_OF_DATA.

Parameters
[in]gifThe nsgif_t object.
[out]areaThe area in pixels that must be redrawn.
[out]delay_csTime to wait after frame_new before next frame in cs.
[out]frame_newThe frame to decode.
Returns
NSGIF_OK on success, or appropriate error otherwise.

Definition at line 1882 of file gif.cpp.hpp.

1887{
1888 nsgif_error ret;
1889 nsgif_rect_t rect = {0, 0, 0, 0};
1890 fl::u32 delay = 0;
1891 fl::u32 frame = gif->frame;
1892
1893 if (gif->frame != NSGIF_FRAME_INVALID &&
1894 gif->frame < gif->info.frame_count &&
1895 gif->frames[gif->frame].info.display) {
1896 rect = gif->frames[gif->frame].info.rect;
1897 }
1898
1900 gif->loop_count,
1901 gif->info.loop_max)) {
1903 }
1904
1905 ret = nsgif__next_displayable_frame(gif, &frame, &delay);
1906 if (ret != NSGIF_OK) {
1907 return ret;
1908 }
1909
1910 if (gif->frame != NSGIF_FRAME_INVALID && frame < gif->frame) {
1911 gif->loop_count++;
1912 }
1913
1914 if (gif->data_complete) {
1915 /* Check for last frame, which has infinite delay. */
1916
1917 if (gif->info.frame_count == 1) {
1919 } else if (gif->info.loop_max != 0) {
1920 fl::u32 frame_next = frame;
1921
1923 &frame_next, nullptr);
1924 if (ret != NSGIF_OK) {
1925 return ret;
1926 }
1927
1928 if (gif->data_complete && frame_next < frame) {
1930 gif->loop_count + 1,
1931 gif->info.loop_max)) {
1933 }
1934 }
1935 }
1936 }
1937
1938 gif->frame = frame;
1939 nsgif__redraw_rect_extend(&gif->frames[frame].info.rect, &rect);
1940
1941 if (delay < gif->delay_min) {
1942 delay = gif->delay_default;
1943 }
1944
1945 *frame_new = gif->frame;
1946 *delay_cs = delay;
1947 *area = rect;
1948
1949 return NSGIF_OK;
1950}
struct fl::third_party::nsgif_rect nsgif_rect_t
LibNSGIF rectangle structure.
static bool nsgif__animation_complete(int count, int max) FL_NOEXCEPT
Definition gif.cpp.hpp:1863
static void nsgif__redraw_rect_extend(const nsgif_rect_t *frame, nsgif_rect_t *redraw) FL_NOEXCEPT
Definition gif.cpp.hpp:1797
static nsgif_error nsgif__next_displayable_frame(const nsgif_t *gif, fl::u32 *frame, fl::u32 *delay) FL_NOEXCEPT
Definition gif.cpp.hpp:1836
int loop_count
number of animation loops so far
Definition gif.cpp.hpp:97
#define NSGIF_INFINITE
Representation of infinity.
Definition nsgif.hpp:26

References fl::rect< T >::rect(), fl::delay(), FL_NOEXCEPT, nsgif__animation_complete(), nsgif__next_displayable_frame(), nsgif__redraw_rect_extend(), NSGIF_ERR_ANIMATION_END, NSGIF_FRAME_INVALID, NSGIF_INFINITE, and NSGIF_OK.

+ Here is the call graph for this function:

◆ nsgif_get_frame_info()

const nsgif_frame_info_t * fl::third_party::nsgif_get_frame_info ( const nsgif_t * gif,
fl::u32 frame )

Get information about a GIF from an nsgif_t object.

Parameters
[in]gifThe nsgif_t object to get frame info for.
[in]frameThe frame number to get info for.
Returns
The gif frame info, or NULL on error.

Definition at line 1996 of file gif.cpp.hpp.

1999{
2000 if (frame >= gif->info.frame_count) {
2001 return nullptr;
2002 }
2003
2004 return &gif->frames[frame].info;
2005}

References FL_NOEXCEPT.

◆ nsgif_get_info()

const nsgif_info_t * fl::third_party::nsgif_get_info ( const nsgif_t * gif)

Get information about a GIF from an nsgif_t object.

Parameters
[in]gifThe nsgif_t object to get info for.
Returns
The gif info, or NULL on error.

Definition at line 1990 of file gif.cpp.hpp.

1991{
1992 return &gif->info;
1993}

References FL_NOEXCEPT.

Referenced by fl::third_party::SoftwareGifDecoder::getFrameCount(), fl::third_party::SoftwareGifDecoder::getHeight(), fl::third_party::SoftwareGifDecoder::getLoopCount(), fl::third_party::SoftwareGifDecoder::getWidth(), fl::third_party::SoftwareGifDecoder::hasMoreFrames(), and fl::third_party::SoftwareGifDecoder::seek().

+ Here is the caller graph for this function:

◆ nsgif_global_palette()

void fl::third_party::nsgif_global_palette ( const nsgif_t * gif,
fl::u32 table[NSGIF_MAX_COLOURS],
fl::size * entries )

Get the global colour palette.

If the GIF has no global colour table, this will return the default colour palette.

Colours in same pixel format as nsgif_bitmap_t.

Parameters
[in]gifThe nsgif_t object.
[out]tableClient buffer to hold the colour table.
[out]entriesThe number of used entries in the colour table.

Definition at line 2008 of file gif.cpp.hpp.

2012{
2013 fl::size len = sizeof(*table) * NSGIF_MAX_COLOURS;
2014
2015 fl::memcpy(table, gif->global_colour_table, len);
2016 *entries = gif->colour_table_size;
2017}
#define NSGIF_MAX_COLOURS
Maximum colour table size.
Definition nsgif.hpp:29

References FL_NOEXCEPT, fl::memcpy(), and NSGIF_MAX_COLOURS.

+ Here is the call graph for this function:

◆ nsgif_local_palette()

bool fl::third_party::nsgif_local_palette ( const nsgif_t * gif,
fl::u32 frame,
fl::u32 table[NSGIF_MAX_COLOURS],
fl::size * entries )

Get the local colour palette for a frame.

Frames may have no local palette. In this case they use the global palette. This function returns false if the frame has no local palette.

Colours in same pixel format as nsgif_bitmap_t.

Parameters
[in]gifThe nsgif_t object.
[in]frameThe frame to get the palette for.
[out]tableClient buffer to hold the colour table.
[out]entriesThe number of used entries in the colour table.
Returns
true if a palette is returned, false otherwise.

Definition at line 2020 of file gif.cpp.hpp.

2025{
2026 const nsgif_frame *f;
2027
2028 if (frame >= gif->frame_count_partial) {
2029 return false;
2030 }
2031
2032 f = &gif->frames[frame];
2033 if (f->info.local_palette == false) {
2034 return false;
2035 }
2036
2037 *entries = 2 << (f->flags & NSGIF_COLOUR_TABLE_SIZE_MASK);
2039 *entries, gif->buf + f->colour_table_offset);
2040
2041 return true;
2042}

References fl::third_party::nsgif_frame::colour_table_offset, FL_NOEXCEPT, fl::third_party::nsgif_frame::flags, fl::third_party::nsgif_frame::info, fl::third_party::nsgif_frame_info::local_palette, nsgif__colour_table_decode(), NSGIF_COLOUR_TABLE_SIZE_MASK, and NSGIF_MAX_COLOURS.

+ Here is the call graph for this function:

◆ nsgif_reset()

nsgif_error fl::third_party::nsgif_reset ( nsgif_t * gif)

Reset a GIF animation.

Some animations are only meant to loop N times, and then show the final frame forever. This function resets the loop and frame counters, so that the animation can be replayed without the overhead of recreating the nsgif_t object and rescanning the raw data.

Parameters
[in]gifA nsgif_t object.
Returns
NSGIF_OK on success, or appropriate error otherwise.

Definition at line 1872 of file gif.cpp.hpp.

1874{
1875 gif->loop_count = 0;
1877
1878 return NSGIF_OK;
1879}

References FL_NOEXCEPT, NSGIF_FRAME_INVALID, and NSGIF_OK.

◆ nsgif_set_frame_delay_behaviour()

void fl::third_party::nsgif_set_frame_delay_behaviour ( nsgif_t * gif,
fl::u16 delay_min,
fl::u16 delay_default )

Configure handling of small frame delays.

Historically people created GIFs with a tiny frame delay, however the slow hardware of the time meant they actually played much slower. As computers sped up, to prevent animations playing faster than intended, decoders came to ignore overly small frame delays.

By default a nsgif_frame_prepare() managed animation will override frame delays of less than 2 centiseconds with a default frame delay of 10 centiseconds. This matches the behaviour of web browsers and other renderers.

Both the minimum and the default values can be overridden for a given GIF by the client. To get frame delays exactly as specified by the GIF file, set delay_min to zero.

Note that this does not affect the frame delay in the frame info (nsgif_frame_info_t) structure, which will always contain values specified by the GIF.

Parameters
[in]gifThe nsgif_t object to configure.
[in]delay_minThe minimum frame delay in centiseconds.
[in]delay_defaultThe delay to use if a frame delay is less than delay_min.

Definition at line 1522 of file gif.cpp.hpp.

1526{
1527 gif->delay_min = delay_min;
1528 gif->delay_default = delay_default;
1529}

References FL_NOEXCEPT.

◆ nsgif_str_disposal()

const char * fl::third_party::nsgif_str_disposal ( enum nsgif_disposal disposal)

Convert a disposal method to a string.

Parameters
[in]disposalThe disposal method to convert.
Returns
String representation of given disposal method.

Definition at line 2067 of file gif.cpp.hpp.

2068{
2069 static const char *const str[] = {
2070 "Unspecified", /* NSGIF_DISPOSAL_UNSPECIFIED */
2071 "None", /* NSGIF_DISPOSAL_NONE */
2072 "Restore background", /* NSGIF_DISPOSAL_RESTORE_BG */
2073 "Restore previous", /* NSGIF_DISPOSAL_RESTORE_PREV */
2074 "Restore quirk", /* NSGIF_DISPOSAL_RESTORE_QUIRK */
2075 };
2076
2077 if (disposal >= NSGIF_ARRAY_LEN(str) || str[disposal] == nullptr) {
2078 return "Unspecified";
2079 }
2080
2081 return str[disposal];
2082}
#define NSGIF_ARRAY_LEN(_a)
Helper macro to get number of elements in an array.
Definition gif.cpp.hpp:145

References FL_NOEXCEPT, and NSGIF_ARRAY_LEN.

◆ nsgif_strerror()

const char * fl::third_party::nsgif_strerror ( nsgif_error err)

Convert an error code to a string.

Parameters
[in]errThe error code to convert.
Returns
String representation of given error code.

Definition at line 2045 of file gif.cpp.hpp.

2046{
2047 static const char *const str[] = {
2048 "Success", /* NSGIF_OK */
2049 "Out of memory", /* NSGIF_ERR_OOM */
2050 "Invalid source data", /* NSGIF_ERR_DATA */
2051 "Requested frame does not exist", /* NSGIF_ERR_BAD_FRAME */
2052 "Invalid frame data", /* NSGIF_ERR_DATA_FRAME */
2053 "Unexpected end of GIF source data", /* NSGIF_ERR_END_OF_DATA */
2054 "Can't add data to completed GIF", /* NSGIF_ERR_DATA_COMPLETE */
2055 "Frame can't be displayed", /* NSGIF_ERR_FRAME_DISPLAY */
2056 "Animation complete", /* NSGIF_ERR_ANIMATION_END */
2057 };
2058
2059 if (err >= NSGIF_ARRAY_LEN(str) || str[err] == nullptr) {
2060 return "Unknown error";
2061 }
2062
2063 return str[err];
2064}

References FL_NOEXCEPT, and NSGIF_ARRAY_LEN.

Referenced by fl::third_party::SoftwareGifDecoder::decode(), fl::third_party::SoftwareGifDecoder::initializeDecoder(), and fl::third_party::SoftwareGifDecoder::loadMoreData().

+ Here is the caller graph for this function:

◆ plm_audio_create_with_buffer()

plm_audio_t * fl::third_party::plm_audio_create_with_buffer ( plm_buffer_t * buffer,
int destroy_when_done )

Definition at line 3235 of file pl_mpeg.hpp.

3235 {
3236 plm_audio_t *self = (plm_audio_t *)PLM_MALLOC(sizeof(plm_audio_t));
3237 fl::memset(self, 0, sizeof(plm_audio_t));
3238
3240 self->buffer = buffer;
3241 self->destroy_buffer_when_done = destroy_when_done;
3242 self->samplerate_index = 3; // Indicates 0
3243
3244 fl::memcopy(self->D, PLM_AUDIO_SYNTHESIS_WINDOW, 512 * sizeof(float));
3245 fl::memcopy(self->D + 512, PLM_AUDIO_SYNTHESIS_WINDOW, 512 * sizeof(float));
3246
3247 // Attempt to decode first header
3249
3250 return self;
3251}
static const float PLM_AUDIO_SYNTHESIS_WINDOW[]
Definition pl_mpeg.hpp:3031
int plm_audio_decode_header(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3339
#define PLM_AUDIO_SAMPLES_PER_FRAME
Definition pl_mpeg.h:223
#define PLM_MALLOC(sz)
Definition pl_mpeg.hpp:179

References fl::third_party::plm_audio_t::buffer, fl::third_party::plm_samples_t::count, fl::third_party::plm_audio_t::D, fl::third_party::plm_audio_t::destroy_buffer_when_done, FL_NOEXCEPT, fl::memcopy(), fl::memset(), fl::third_party::plm_audio_t::next_frame_data_size, plm_audio_decode_header(), PLM_AUDIO_SAMPLES_PER_FRAME, PLM_AUDIO_SYNTHESIS_WINDOW, PLM_MALLOC, fl::third_party::plm_audio_t::samplerate_index, and fl::third_party::plm_audio_t::samples.

Referenced by plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_decode()

plm_samples_t * fl::third_party::plm_audio_decode ( plm_audio_t * self)

Definition at line 3296 of file pl_mpeg.hpp.

3296 {
3297 // Do we have at least enough information to decode the frame header?
3298 if (!self->next_frame_data_size) {
3299 if (!plm_buffer_has(self->buffer, 48)) {
3300 return NULL;
3301 }
3303 }
3304
3305 if (
3306 self->next_frame_data_size == 0 ||
3307 !plm_buffer_has(self->buffer, self->next_frame_data_size << 3)
3308 ) {
3309 return NULL;
3310 }
3311
3313 self->next_frame_data_size = 0;
3314
3315 self->samples.time = self->time;
3316
3318 self->time = (double)self->samples_decoded /
3320
3321 return &self->samples;
3322}
#define NULL
int plm_buffer_has(plm_buffer_t *self, size_t count) FL_NOEXCEPT
Definition pl_mpeg.hpp:998
static const unsigned short PLM_AUDIO_SAMPLE_RATE[]
Definition pl_mpeg.hpp:3017
void plm_audio_decode_frame(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3424

References FL_NOEXCEPT, NULL, plm_audio_decode_frame(), plm_audio_decode_header(), PLM_AUDIO_SAMPLE_RATE, PLM_AUDIO_SAMPLES_PER_FRAME, and plm_buffer_has().

Referenced by plm_decode(), and plm_decode_audio().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_decode_frame()

void fl::third_party::plm_audio_decode_frame ( plm_audio_t * self)

Definition at line 3424 of file pl_mpeg.hpp.

3424 {
3425 // Prepare the quantizer table lookups
3426 int tab3 = 0;
3427 int sblimit = 0;
3428
3429 int tab1 = (self->mode == PLM_AUDIO_MODE_MONO) ? 0 : 1;
3430 int tab2 = PLM_AUDIO_QUANT_LUT_STEP_1[tab1][self->bitrate_index];
3431 tab3 = QUANT_LUT_STEP_2[tab2][self->samplerate_index];
3432 sblimit = tab3 & 63;
3433 tab3 >>= 6;
3434
3435 if (self->bound > sblimit) {
3436 self->bound = sblimit;
3437 }
3438
3439 // Read the allocation information
3440 for (int sb = 0; sb < self->bound; sb++) {
3441 self->allocation[0][sb] = plm_audio_read_allocation(self, sb, tab3);
3442 self->allocation[1][sb] = plm_audio_read_allocation(self, sb, tab3);
3443 }
3444
3445 for (int sb = self->bound; sb < sblimit; sb++) {
3446 self->allocation[0][sb] =
3447 self->allocation[1][sb] =
3448 plm_audio_read_allocation(self, sb, tab3);
3449 }
3450
3451 // Read scale factor selector information
3452 int channels = (self->mode == PLM_AUDIO_MODE_MONO) ? 1 : 2;
3453 for (int sb = 0; sb < sblimit; sb++) {
3454 for (int ch = 0; ch < channels; ch++) {
3455 if (self->allocation[ch][sb]) {
3456 self->scale_factor_info[ch][sb] = plm_buffer_read(self->buffer, 2);
3457 }
3458 }
3459 if (self->mode == PLM_AUDIO_MODE_MONO) {
3460 self->scale_factor_info[1][sb] = self->scale_factor_info[0][sb];
3461 }
3462 }
3463
3464 // Read scale factors
3465 for (int sb = 0; sb < sblimit; sb++) {
3466 for (int ch = 0; ch < channels; ch++) {
3467 if (self->allocation[ch][sb]) {
3468 int *sf = self->scale_factor[ch][sb];
3469 switch (self->scale_factor_info[ch][sb]) {
3470 case 0:
3471 sf[0] = plm_buffer_read(self->buffer, 6);
3472 sf[1] = plm_buffer_read(self->buffer, 6);
3473 sf[2] = plm_buffer_read(self->buffer, 6);
3474 break;
3475 case 1:
3476 sf[0] =
3477 sf[1] = plm_buffer_read(self->buffer, 6);
3478 sf[2] = plm_buffer_read(self->buffer, 6);
3479 break;
3480 case 2:
3481 sf[0] =
3482 sf[1] =
3483 sf[2] = plm_buffer_read(self->buffer, 6);
3484 break;
3485 case 3:
3486 sf[0] = plm_buffer_read(self->buffer, 6);
3487 sf[1] =
3488 sf[2] = plm_buffer_read(self->buffer, 6);
3489 break;
3490 }
3491 }
3492 }
3493 if (self->mode == PLM_AUDIO_MODE_MONO) {
3494 self->scale_factor[1][sb][0] = self->scale_factor[0][sb][0];
3495 self->scale_factor[1][sb][1] = self->scale_factor[0][sb][1];
3496 self->scale_factor[1][sb][2] = self->scale_factor[0][sb][2];
3497 }
3498 }
3499
3500 // Coefficient input and reconstruction
3501 int out_pos = 0;
3502 for (int part = 0; part < 3; part++) {
3503 for (int granule = 0; granule < 4; granule++) {
3504
3505 // Read the samples
3506 for (int sb = 0; sb < self->bound; sb++) {
3507 plm_audio_read_samples(self, 0, sb, part);
3508 plm_audio_read_samples(self, 1, sb, part);
3509 }
3510 for (int sb = self->bound; sb < sblimit; sb++) {
3511 plm_audio_read_samples(self, 0, sb, part);
3512 self->sample[1][sb][0] = self->sample[0][sb][0];
3513 self->sample[1][sb][1] = self->sample[0][sb][1];
3514 self->sample[1][sb][2] = self->sample[0][sb][2];
3515 }
3516 for (int sb = sblimit; sb < 32; sb++) {
3517 self->sample[0][sb][0] = 0;
3518 self->sample[0][sb][1] = 0;
3519 self->sample[0][sb][2] = 0;
3520 self->sample[1][sb][0] = 0;
3521 self->sample[1][sb][1] = 0;
3522 self->sample[1][sb][2] = 0;
3523 }
3524
3525 // Synthesis loop
3526 for (int p = 0; p < 3; p++) {
3527 // Shifting step
3528 self->v_pos = (self->v_pos - 64) & 1023;
3529
3530 for (int ch = 0; ch < 2; ch++) {
3531 plm_audio_idct36(self->sample[ch], p, self->V[ch], self->v_pos);
3532
3533 // Build U, windowing, calculate output
3534 fl::memset(self->U, 0, sizeof(self->U));
3535
3536 int d_index = 512 - (self->v_pos >> 1);
3537 int v_index = (self->v_pos % 128) >> 1;
3538 while (v_index < 1024) {
3539 for (int i = 0; i < 32; ++i) {
3540 self->U[i] += self->D[d_index++] * self->V[ch][v_index++];
3541 }
3542
3543 v_index += 128 - 32;
3544 d_index += 64 - 32;
3545 }
3546
3547 d_index -= (512 - 32);
3548 v_index = (128 - 32 + 1024) - v_index;
3549 while (v_index < 1024) {
3550 for (int i = 0; i < 32; ++i) {
3551 self->U[i] += self->D[d_index++] * self->V[ch][v_index++];
3552 }
3553
3554 v_index += 128 - 32;
3555 d_index += 64 - 32;
3556 }
3557
3558 // Output samples
3559 #ifdef PLM_AUDIO_SEPARATE_CHANNELS
3560 float *out_channel = ch == 0
3561 ? self->samples.left
3562 : self->samples.right;
3563 for (int j = 0; j < 32; j++) {
3564 out_channel[out_pos + j] = self->U[j] / -1090519040.0f;
3565 }
3566 #else
3567 for (int j = 0; j < 32; j++) {
3568 self->samples.interleaved[((out_pos + j) << 1) + ch] =
3569 self->U[j] / -1090519040.0f;
3570 }
3571 #endif
3572 } // End of synthesis channel loop
3573 out_pos += 32;
3574 } // End of synthesis sub-block loop
3575
3576 } // Decoding of the granule finished
3577 }
3578
3579 plm_buffer_align(self->buffer);
3580}
void plm_audio_idct36(int s[32][3], int ss, float *d, int dp) FL_NOEXCEPT
Definition pl_mpeg.hpp:3640
int plm_buffer_read(plm_buffer_t *self, int count) FL_NOEXCEPT
Definition pl_mpeg.hpp:1017
static const int PLM_AUDIO_MODE_MONO
Definition pl_mpeg.hpp:3015
static const uint8_t QUANT_LUT_STEP_2[3][3]
Definition pl_mpeg.hpp:3134
void plm_audio_read_samples(plm_audio_t *self, int ch, int sb, int part) FL_NOEXCEPT
Definition pl_mpeg.hpp:3588
void plm_buffer_align(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1040
const plm_quantizer_spec_t * plm_audio_read_allocation(plm_audio_t *self, int sb, int tab3) FL_NOEXCEPT
Definition pl_mpeg.hpp:3582
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_1[2][16]
Definition pl_mpeg.hpp:3121
float interleaved[PLM_AUDIO_SAMPLES_PER_FRAME *2]
Definition pl_mpeg.h:232
const plm_quantizer_spec_t * allocation[2][32]
Definition pl_mpeg.hpp:3217
uint8_t scale_factor_info[2][32]
Definition pl_mpeg.hpp:3218

References FL_NOEXCEPT, fl::memset(), plm_audio_idct36(), PLM_AUDIO_MODE_MONO, PLM_AUDIO_QUANT_LUT_STEP_1, plm_audio_read_allocation(), plm_audio_read_samples(), plm_buffer_align(), plm_buffer_read(), and QUANT_LUT_STEP_2.

Referenced by plm_audio_decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_decode_header()

int fl::third_party::plm_audio_decode_header ( plm_audio_t * self)

Definition at line 3339 of file pl_mpeg.hpp.

3339 {
3340 if (!plm_buffer_has(self->buffer, 48)) {
3341 return 0;
3342 }
3343
3344 plm_buffer_skip_bytes(self->buffer, 0x00);
3345 int sync = plm_buffer_read(self->buffer, 11);
3346
3347
3348 // Attempt to resync if no syncword was found. This sucks balls. The MP2
3349 // stream contains a syncword just before every frame (11 bits set to 1).
3350 // However, this syncword is not guaranteed to not occur elsewhere in the
3351 // stream. So, if we have to resync, we also have to check if the header
3352 // (samplerate, bitrate) differs from the one we had before. This all
3353 // may still lead to garbage data being decoded :/
3354
3355 if (sync != PLM_AUDIO_FRAME_SYNC && !plm_audio_find_frame_sync(self)) {
3356 return 0;
3357 }
3358
3359 self->version = plm_buffer_read(self->buffer, 2);
3360 self->layer = plm_buffer_read(self->buffer, 2);
3361 int hasCRC = !plm_buffer_read(self->buffer, 1);
3362
3363 if (
3364 self->version != PLM_AUDIO_MPEG_1 ||
3365 self->layer != PLM_AUDIO_LAYER_II
3366 ) {
3367 return 0;
3368 }
3369
3370 int bitrate_index = plm_buffer_read(self->buffer, 4) - 1;
3371 if (bitrate_index > 13) {
3372 return 0;
3373 }
3374
3375 int samplerate_index = plm_buffer_read(self->buffer, 2);
3376 if (samplerate_index == 3) {
3377 return 0;
3378 }
3379
3380 int padding = plm_buffer_read(self->buffer, 1);
3381 plm_buffer_skip(self->buffer, 1); // f_private
3382 int mode = plm_buffer_read(self->buffer, 2);
3383
3384 // If we already have a header, make sure the samplerate, bitrate and mode
3385 // are still the same, otherwise we might have missed sync.
3386 if (
3387 self->has_header && (
3388 self->bitrate_index != bitrate_index ||
3389 self->samplerate_index != samplerate_index ||
3390 self->mode != mode
3391 )
3392 ) {
3393 return 0;
3394 }
3395
3396 self->bitrate_index = bitrate_index;
3397 self->samplerate_index = samplerate_index;
3398 self->mode = mode;
3399 self->has_header = TRUE;
3400
3401 // Parse the mode_extension, set up the stereo bound
3402 if (mode == PLM_AUDIO_MODE_JOINT_STEREO) {
3403 self->bound = (plm_buffer_read(self->buffer, 2) + 1) << 2;
3404 }
3405 else {
3406 plm_buffer_skip(self->buffer, 2);
3407 self->bound = (mode == PLM_AUDIO_MODE_MONO) ? 0 : 32;
3408 }
3409
3410 // Discard the last 4 bits of the header and the CRC value, if present
3411 plm_buffer_skip(self->buffer, 4); // copyright(1), original(1), emphasis(2)
3412 if (hasCRC) {
3413 plm_buffer_skip(self->buffer, 16);
3414 }
3415
3416 // Compute frame size, check if we have enough data to decode the whole
3417 // frame.
3418 int bitrate = PLM_AUDIO_BIT_RATE[self->bitrate_index];
3419 int samplerate = PLM_AUDIO_SAMPLE_RATE[self->samplerate_index];
3420 int frame_size = (144000 * bitrate / samplerate) + padding;
3421 return frame_size - (hasCRC ? 6 : 4);
3422}
static const int PLM_AUDIO_FRAME_SYNC
Definition pl_mpeg.hpp:3002
int plm_buffer_skip_bytes(plm_buffer_t *self, uint8_t v) FL_NOEXCEPT
Definition pl_mpeg.hpp:1050
static const int PLM_AUDIO_MODE_JOINT_STEREO
Definition pl_mpeg.hpp:3013
static const short PLM_AUDIO_BIT_RATE[]
Definition pl_mpeg.hpp:3022
static const int PLM_AUDIO_LAYER_II
Definition pl_mpeg.hpp:3009
static const int PLM_AUDIO_MPEG_1
Definition pl_mpeg.hpp:3006
int plm_audio_find_frame_sync(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3324
void plm_buffer_skip(plm_buffer_t *self, size_t count) FL_NOEXCEPT
Definition pl_mpeg.hpp:1044
#define TRUE
Definition pl_mpeg.hpp:174

References FL_NOEXCEPT, PLM_AUDIO_BIT_RATE, plm_audio_find_frame_sync(), PLM_AUDIO_FRAME_SYNC, PLM_AUDIO_LAYER_II, PLM_AUDIO_MODE_JOINT_STEREO, PLM_AUDIO_MODE_MONO, PLM_AUDIO_MPEG_1, PLM_AUDIO_SAMPLE_RATE, plm_buffer_has(), plm_buffer_read(), plm_buffer_skip(), plm_buffer_skip_bytes(), and TRUE.

Referenced by plm_audio_create_with_buffer(), plm_audio_decode(), and plm_audio_has_header().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_destroy()

void fl::third_party::plm_audio_destroy ( plm_audio_t * self)

Definition at line 3253 of file pl_mpeg.hpp.

3253 {
3254 if (self->destroy_buffer_when_done) {
3256 }
3257 PLM_FREE(self);
3258}
void plm_buffer_destroy(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:855
#define PLM_FREE(p)
Definition pl_mpeg.hpp:180

References FL_NOEXCEPT, plm_buffer_destroy(), and PLM_FREE.

Referenced by plm_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_find_frame_sync()

int fl::third_party::plm_audio_find_frame_sync ( plm_audio_t * self)

Definition at line 3324 of file pl_mpeg.hpp.

3324 {
3325 size_t i;
3326 for (i = self->buffer->bit_index >> 3; i < self->buffer->length-1; i++) {
3327 if (
3328 self->buffer->bytes[i] == 0xFF &&
3329 (self->buffer->bytes[i+1] & 0xFE) == 0xFC
3330 ) {
3331 self->buffer->bit_index = ((i+1) << 3) + 3;
3332 return TRUE;
3333 }
3334 }
3335 self->buffer->bit_index = (i + 1) << 3;
3336 return FALSE;
3337}
#define FALSE
Definition pl_mpeg.hpp:175

References FALSE, FL_NOEXCEPT, and TRUE.

Referenced by plm_audio_decode_header().

+ Here is the caller graph for this function:

◆ plm_audio_get_samplerate()

int fl::third_party::plm_audio_get_samplerate ( plm_audio_t * self)

Definition at line 3269 of file pl_mpeg.hpp.

3269 {
3270 return plm_audio_has_header(self)
3272 : 0;
3273}
int plm_audio_has_header(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3260

References FL_NOEXCEPT, plm_audio_has_header(), and PLM_AUDIO_SAMPLE_RATE.

Referenced by plm_get_samplerate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_get_time()

double fl::third_party::plm_audio_get_time ( plm_audio_t * self)

Definition at line 3275 of file pl_mpeg.hpp.

3275 {
3276 return self->time;
3277}

References FL_NOEXCEPT.

Referenced by plm_decode().

+ Here is the caller graph for this function:

◆ plm_audio_has_ended()

int fl::third_party::plm_audio_has_ended ( plm_audio_t * self)

Definition at line 3292 of file pl_mpeg.hpp.

3292 {
3293 return plm_buffer_has_ended(self->buffer);
3294}
int plm_buffer_has_ended(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:994

References FL_NOEXCEPT, and plm_buffer_has_ended().

+ Here is the call graph for this function:

◆ plm_audio_has_header()

int fl::third_party::plm_audio_has_header ( plm_audio_t * self)

Definition at line 3260 of file pl_mpeg.hpp.

3260 {
3261 if (self->has_header) {
3262 return TRUE;
3263 }
3264
3266 return self->has_header;
3267}

References FL_NOEXCEPT, plm_audio_decode_header(), and TRUE.

Referenced by plm_audio_get_samplerate(), and plm_has_headers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_idct36()

void fl::third_party::plm_audio_idct36 ( int s[32][3],
int ss,
float * d,
int dp )

Definition at line 3640 of file pl_mpeg.hpp.

3640 {
3641 float t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12,
3642 t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24,
3643 t25, t26, t27, t28, t29, t30, t31, t32, t33;
3644
3645 t01 = (float)(s[0][ss] + s[31][ss]); t02 = (float)(s[0][ss] - s[31][ss]) * 0.500602998235f;
3646 t03 = (float)(s[1][ss] + s[30][ss]); t04 = (float)(s[1][ss] - s[30][ss]) * 0.505470959898f;
3647 t05 = (float)(s[2][ss] + s[29][ss]); t06 = (float)(s[2][ss] - s[29][ss]) * 0.515447309923f;
3648 t07 = (float)(s[3][ss] + s[28][ss]); t08 = (float)(s[3][ss] - s[28][ss]) * 0.53104259109f;
3649 t09 = (float)(s[4][ss] + s[27][ss]); t10 = (float)(s[4][ss] - s[27][ss]) * 0.553103896034f;
3650 t11 = (float)(s[5][ss] + s[26][ss]); t12 = (float)(s[5][ss] - s[26][ss]) * 0.582934968206f;
3651 t13 = (float)(s[6][ss] + s[25][ss]); t14 = (float)(s[6][ss] - s[25][ss]) * 0.622504123036f;
3652 t15 = (float)(s[7][ss] + s[24][ss]); t16 = (float)(s[7][ss] - s[24][ss]) * 0.674808341455f;
3653 t17 = (float)(s[8][ss] + s[23][ss]); t18 = (float)(s[8][ss] - s[23][ss]) * 0.744536271002f;
3654 t19 = (float)(s[9][ss] + s[22][ss]); t20 = (float)(s[9][ss] - s[22][ss]) * 0.839349645416f;
3655 t21 = (float)(s[10][ss] + s[21][ss]); t22 = (float)(s[10][ss] - s[21][ss]) * 0.972568237862f;
3656 t23 = (float)(s[11][ss] + s[20][ss]); t24 = (float)(s[11][ss] - s[20][ss]) * 1.16943993343f;
3657 t25 = (float)(s[12][ss] + s[19][ss]); t26 = (float)(s[12][ss] - s[19][ss]) * 1.48416461631f;
3658 t27 = (float)(s[13][ss] + s[18][ss]); t28 = (float)(s[13][ss] - s[18][ss]) * 2.05778100995f;
3659 t29 = (float)(s[14][ss] + s[17][ss]); t30 = (float)(s[14][ss] - s[17][ss]) * 3.40760841847f;
3660 t31 = (float)(s[15][ss] + s[16][ss]); t32 = (float)(s[15][ss] - s[16][ss]) * 10.1900081235f;
3661
3662 t33 = t01 + t31; t31 = (t01 - t31) * 0.502419286188f;
3663 t01 = t03 + t29; t29 = (t03 - t29) * 0.52249861494f;
3664 t03 = t05 + t27; t27 = (t05 - t27) * 0.566944034816f;
3665 t05 = t07 + t25; t25 = (t07 - t25) * 0.64682178336f;
3666 t07 = t09 + t23; t23 = (t09 - t23) * 0.788154623451f;
3667 t09 = t11 + t21; t21 = (t11 - t21) * 1.06067768599f;
3668 t11 = t13 + t19; t19 = (t13 - t19) * 1.72244709824f;
3669 t13 = t15 + t17; t17 = (t15 - t17) * 5.10114861869f;
3670 t15 = t33 + t13; t13 = (t33 - t13) * 0.509795579104f;
3671 t33 = t01 + t11; t01 = (t01 - t11) * 0.601344886935f;
3672 t11 = t03 + t09; t09 = (t03 - t09) * 0.899976223136f;
3673 t03 = t05 + t07; t07 = (t05 - t07) * 2.56291544774f;
3674 t05 = t15 + t03; t15 = (t15 - t03) * 0.541196100146f;
3675 t03 = t33 + t11; t11 = (t33 - t11) * 1.30656296488f;
3676 t33 = t05 + t03; t05 = (t05 - t03) * 0.707106781187f;
3677 t03 = t15 + t11; t15 = (t15 - t11) * 0.707106781187f;
3678 t03 += t15;
3679 t11 = t13 + t07; t13 = (t13 - t07) * 0.541196100146f;
3680 t07 = t01 + t09; t09 = (t01 - t09) * 1.30656296488f;
3681 t01 = t11 + t07; t07 = (t11 - t07) * 0.707106781187f;
3682 t11 = t13 + t09; t13 = (t13 - t09) * 0.707106781187f;
3683 t11 += t13; t01 += t11;
3684 t11 += t07; t07 += t13;
3685 t09 = t31 + t17; t31 = (t31 - t17) * 0.509795579104f;
3686 t17 = t29 + t19; t29 = (t29 - t19) * 0.601344886935f;
3687 t19 = t27 + t21; t21 = (t27 - t21) * 0.899976223136f;
3688 t27 = t25 + t23; t23 = (t25 - t23) * 2.56291544774f;
3689 t25 = t09 + t27; t09 = (t09 - t27) * 0.541196100146f;
3690 t27 = t17 + t19; t19 = (t17 - t19) * 1.30656296488f;
3691 t17 = t25 + t27; t27 = (t25 - t27) * 0.707106781187f;
3692 t25 = t09 + t19; t19 = (t09 - t19) * 0.707106781187f;
3693 t25 += t19;
3694 t09 = t31 + t23; t31 = (t31 - t23) * 0.541196100146f;
3695 t23 = t29 + t21; t21 = (t29 - t21) * 1.30656296488f;
3696 t29 = t09 + t23; t23 = (t09 - t23) * 0.707106781187f;
3697 t09 = t31 + t21; t31 = (t31 - t21) * 0.707106781187f;
3698 t09 += t31; t29 += t09; t09 += t23; t23 += t31;
3699 t17 += t29; t29 += t25; t25 += t09; t09 += t27;
3700 t27 += t23; t23 += t19; t19 += t31;
3701 t21 = t02 + t32; t02 = (t02 - t32) * 0.502419286188f;
3702 t32 = t04 + t30; t04 = (t04 - t30) * 0.52249861494f;
3703 t30 = t06 + t28; t28 = (t06 - t28) * 0.566944034816f;
3704 t06 = t08 + t26; t08 = (t08 - t26) * 0.64682178336f;
3705 t26 = t10 + t24; t10 = (t10 - t24) * 0.788154623451f;
3706 t24 = t12 + t22; t22 = (t12 - t22) * 1.06067768599f;
3707 t12 = t14 + t20; t20 = (t14 - t20) * 1.72244709824f;
3708 t14 = t16 + t18; t16 = (t16 - t18) * 5.10114861869f;
3709 t18 = t21 + t14; t14 = (t21 - t14) * 0.509795579104f;
3710 t21 = t32 + t12; t32 = (t32 - t12) * 0.601344886935f;
3711 t12 = t30 + t24; t24 = (t30 - t24) * 0.899976223136f;
3712 t30 = t06 + t26; t26 = (t06 - t26) * 2.56291544774f;
3713 t06 = t18 + t30; t18 = (t18 - t30) * 0.541196100146f;
3714 t30 = t21 + t12; t12 = (t21 - t12) * 1.30656296488f;
3715 t21 = t06 + t30; t30 = (t06 - t30) * 0.707106781187f;
3716 t06 = t18 + t12; t12 = (t18 - t12) * 0.707106781187f;
3717 t06 += t12;
3718 t18 = t14 + t26; t26 = (t14 - t26) * 0.541196100146f;
3719 t14 = t32 + t24; t24 = (t32 - t24) * 1.30656296488f;
3720 t32 = t18 + t14; t14 = (t18 - t14) * 0.707106781187f;
3721 t18 = t26 + t24; t24 = (t26 - t24) * 0.707106781187f;
3722 t18 += t24; t32 += t18;
3723 t18 += t14; t26 = t14 + t24;
3724 t14 = t02 + t16; t02 = (t02 - t16) * 0.509795579104f;
3725 t16 = t04 + t20; t04 = (t04 - t20) * 0.601344886935f;
3726 t20 = t28 + t22; t22 = (t28 - t22) * 0.899976223136f;
3727 t28 = t08 + t10; t10 = (t08 - t10) * 2.56291544774f;
3728 t08 = t14 + t28; t14 = (t14 - t28) * 0.541196100146f;
3729 t28 = t16 + t20; t20 = (t16 - t20) * 1.30656296488f;
3730 t16 = t08 + t28; t28 = (t08 - t28) * 0.707106781187f;
3731 t08 = t14 + t20; t20 = (t14 - t20) * 0.707106781187f;
3732 t08 += t20;
3733 t14 = t02 + t10; t02 = (t02 - t10) * 0.541196100146f;
3734 t10 = t04 + t22; t22 = (t04 - t22) * 1.30656296488f;
3735 t04 = t14 + t10; t10 = (t14 - t10) * 0.707106781187f;
3736 t14 = t02 + t22; t02 = (t02 - t22) * 0.707106781187f;
3737 t14 += t02; t04 += t14; t14 += t10; t10 += t02;
3738 t16 += t04; t04 += t08; t08 += t14; t14 += t28;
3739 t28 += t10; t10 += t20; t20 += t02; t21 += t16;
3740 t16 += t32; t32 += t04; t04 += t06; t06 += t08;
3741 t08 += t18; t18 += t14; t14 += t30; t30 += t28;
3742 t28 += t26; t26 += t10; t10 += t12; t12 += t20;
3743 t20 += t24; t24 += t02;
3744
3745 d[dp + 48] = -t33;
3746 d[dp + 49] = d[dp + 47] = -t21;
3747 d[dp + 50] = d[dp + 46] = -t17;
3748 d[dp + 51] = d[dp + 45] = -t16;
3749 d[dp + 52] = d[dp + 44] = -t01;
3750 d[dp + 53] = d[dp + 43] = -t32;
3751 d[dp + 54] = d[dp + 42] = -t29;
3752 d[dp + 55] = d[dp + 41] = -t04;
3753 d[dp + 56] = d[dp + 40] = -t03;
3754 d[dp + 57] = d[dp + 39] = -t06;
3755 d[dp + 58] = d[dp + 38] = -t25;
3756 d[dp + 59] = d[dp + 37] = -t08;
3757 d[dp + 60] = d[dp + 36] = -t11;
3758 d[dp + 61] = d[dp + 35] = -t18;
3759 d[dp + 62] = d[dp + 34] = -t09;
3760 d[dp + 63] = d[dp + 33] = -t14;
3761 d[dp + 32] = -t05;
3762 d[dp + 0] = t05; d[dp + 31] = -t30;
3763 d[dp + 1] = t30; d[dp + 30] = -t27;
3764 d[dp + 2] = t27; d[dp + 29] = -t28;
3765 d[dp + 3] = t28; d[dp + 28] = -t07;
3766 d[dp + 4] = t07; d[dp + 27] = -t26;
3767 d[dp + 5] = t26; d[dp + 26] = -t23;
3768 d[dp + 6] = t23; d[dp + 25] = -t10;
3769 d[dp + 7] = t10; d[dp + 24] = -t15;
3770 d[dp + 8] = t15; d[dp + 23] = -t12;
3771 d[dp + 9] = t12; d[dp + 22] = -t19;
3772 d[dp + 10] = t19; d[dp + 21] = -t20;
3773 d[dp + 11] = t20; d[dp + 20] = -t13;
3774 d[dp + 12] = t13; d[dp + 19] = -t24;
3775 d[dp + 13] = t24; d[dp + 18] = -t31;
3776 d[dp + 14] = t31; d[dp + 17] = -t02;
3777 d[dp + 15] = t02; d[dp + 16] = 0.0;
3778}

References FL_NOEXCEPT.

Referenced by plm_audio_decode_frame().

+ Here is the caller graph for this function:

◆ plm_audio_read_allocation()

const plm_quantizer_spec_t * fl::third_party::plm_audio_read_allocation ( plm_audio_t * self,
int sb,
int tab3 )

Definition at line 3582 of file pl_mpeg.hpp.

3582 {
3583 int tab4 = PLM_AUDIO_QUANT_LUT_STEP_3[tab3][sb];
3584 int qtab = PLM_AUDIO_QUANT_LUT_STEP_4[tab4 & 15][plm_buffer_read(self->buffer, tab4 >> 4)];
3585 return qtab ? (&PLM_AUDIO_QUANT_TAB[qtab - 1]) : 0;
3586}
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_3[3][32]
Definition pl_mpeg.hpp:3143
static const plm_quantizer_spec_t PLM_AUDIO_QUANT_TAB[]
Definition pl_mpeg.hpp:3181
static const uint8_t PLM_AUDIO_QUANT_LUT_STEP_4[6][16]
Definition pl_mpeg.hpp:3166

References FL_NOEXCEPT, PLM_AUDIO_QUANT_LUT_STEP_3, PLM_AUDIO_QUANT_LUT_STEP_4, PLM_AUDIO_QUANT_TAB, and plm_buffer_read().

Referenced by plm_audio_decode_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_read_samples()

void fl::third_party::plm_audio_read_samples ( plm_audio_t * self,
int ch,
int sb,
int part )

Definition at line 3588 of file pl_mpeg.hpp.

3588 {
3589 const plm_quantizer_spec_t *q = self->allocation[ch][sb];
3590 int sf = self->scale_factor[ch][sb][part];
3591 int *sample = self->sample[ch][sb];
3592 int val = 0;
3593
3594 if (!q) {
3595 // No bits allocated for this subband
3596 sample[0] = sample[1] = sample[2] = 0;
3597 return;
3598 }
3599
3600 // Resolve scalefactor
3601 if (sf == 63) {
3602 sf = 0;
3603 }
3604 else {
3605 int shift = (sf / 3) | 0;
3606 sf = (PLM_AUDIO_SCALEFACTOR_BASE[sf % 3] + ((1 << shift) >> 1)) >> shift;
3607 }
3608
3609 // Decode samples
3610 int adj = q->levels;
3611 if (q->group) {
3612 // Decode grouped samples
3613 val = plm_buffer_read(self->buffer, q->bits);
3614 sample[0] = val % adj;
3615 val /= adj;
3616 sample[1] = val % adj;
3617 sample[2] = val / adj;
3618 }
3619 else {
3620 // Decode direct samples
3621 sample[0] = plm_buffer_read(self->buffer, q->bits);
3622 sample[1] = plm_buffer_read(self->buffer, q->bits);
3623 sample[2] = plm_buffer_read(self->buffer, q->bits);
3624 }
3625
3626 // Postmultiply samples
3627 int scale = 65536 / (adj + 1);
3628 adj = ((adj + 1) >> 1) - 1;
3629
3630 val = (adj - sample[0]) * scale;
3631 sample[0] = (val * (sf >> 12) + ((val * (sf & 4095) + 2048) >> 12)) >> 12;
3632
3633 val = (adj - sample[1]) * scale;
3634 sample[1] = (val * (sf >> 12) + ((val * (sf & 4095) + 2048) >> 12)) >> 12;
3635
3636 val = (adj - sample[2]) * scale;
3637 sample[2] = (val * (sf >> 12) + ((val * (sf & 4095) + 2048) >> 12)) >> 12;
3638}
static const int32_t PLM_AUDIO_SCALEFACTOR_BASE[]
Definition pl_mpeg.hpp:3027
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Definition sample.cpp.hpp:9

References fl::third_party::plm_quantizer_spec_t::bits, FL_NOEXCEPT, fl::third_party::plm_quantizer_spec_t::group, fl::third_party::plm_quantizer_spec_t::levels, PLM_AUDIO_SCALEFACTOR_BASE, plm_buffer_read(), fl::sample(), and scale.

Referenced by plm_audio_decode_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_rewind()

void fl::third_party::plm_audio_rewind ( plm_audio_t * self)

Definition at line 3285 of file pl_mpeg.hpp.

3285 {
3287 self->time = 0;
3288 self->samples_decoded = 0;
3289 self->next_frame_data_size = 0;
3290}
void plm_buffer_rewind(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:919

References FL_NOEXCEPT, and plm_buffer_rewind().

Referenced by plm_rewind(), and plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_audio_set_time()

void fl::third_party::plm_audio_set_time ( plm_audio_t * self,
double time )

Definition at line 3279 of file pl_mpeg.hpp.

3279 {
3280 self->samples_decoded = time *
3282 self->time = time;
3283}

References FL_NOEXCEPT, PLM_AUDIO_SAMPLE_RATE, and fl::time().

Referenced by plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_align()

void fl::third_party::plm_buffer_align ( plm_buffer_t * self)

Definition at line 1040 of file pl_mpeg.hpp.

1040 {
1041 self->bit_index = ((self->bit_index + 7) >> 3) << 3; // Align to next byte
1042}

References FL_NOEXCEPT.

Referenced by plm_audio_decode_frame(), plm_buffer_next_start_code(), and plm_buffer_skip_bytes().

+ Here is the caller graph for this function:

◆ plm_buffer_create_for_appending()

plm_buffer_t * fl::third_party::plm_buffer_create_for_appending ( size_t initial_capacity)

Definition at line 848 of file pl_mpeg.hpp.

848 {
849 plm_buffer_t *self = plm_buffer_create_with_capacity(initial_capacity);
852 return self;
853}
plm_buffer_t * plm_buffer_create_with_capacity(size_t capacity) FL_NOEXCEPT
Definition pl_mpeg.hpp:837
enum plm_buffer_mode mode
Definition pl_mpeg.hpp:743

References fl::third_party::plm_buffer_t::discard_read_bytes, FALSE, FL_NOEXCEPT, fl::third_party::plm_buffer_t::mode, plm_buffer_create_with_capacity(), and PLM_BUFFER_MODE_APPEND.

+ Here is the call graph for this function:

◆ plm_buffer_create_with_callbacks()

plm_buffer_t * fl::third_party::plm_buffer_create_with_callbacks ( plm_buffer_load_callback load_callback,
plm_buffer_seek_callback seek_callback,
plm_buffer_tell_callback tell_callback,
size_t length,
void * user )

Definition at line 807 of file pl_mpeg.hpp.

813 {
816 self->total_size = length;
817 self->load_callback = load_callback;
818 self->seek_callback = seek_callback;
819 self->tell_callback = tell_callback;
820 self->load_callback_user_data = user;
821 return self;
822}
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
plm_buffer_tell_callback tell_callback
Definition pl_mpeg.hpp:740
plm_buffer_load_callback load_callback
Definition pl_mpeg.hpp:738
plm_buffer_seek_callback seek_callback
Definition pl_mpeg.hpp:739
#define PLM_BUFFER_DEFAULT_SIZE
Definition pl_mpeg.h:475

References FL_NOEXCEPT, length(), fl::third_party::plm_buffer_t::load_callback, fl::third_party::plm_buffer_t::load_callback_user_data, fl::third_party::plm_buffer_t::mode, plm_buffer_create_with_capacity(), PLM_BUFFER_DEFAULT_SIZE, PLM_BUFFER_MODE_FILE, fl::third_party::plm_buffer_t::seek_callback, fl::third_party::plm_buffer_t::tell_callback, and fl::third_party::plm_buffer_t::total_size.

+ Here is the call graph for this function:

◆ plm_buffer_create_with_capacity()

plm_buffer_t * fl::third_party::plm_buffer_create_with_capacity ( size_t capacity)

Definition at line 837 of file pl_mpeg.hpp.

837 {
839 fl::memset(self, 0, sizeof(plm_buffer_t));
840 self->capacity = capacity;
841 self->free_when_done = TRUE;
842 self->bytes = (uint8_t *)PLM_MALLOC(capacity);
844 self->discard_read_bytes = TRUE;
845 return self;
846}

References fl::third_party::plm_buffer_t::bytes, fl::third_party::plm_buffer_t::capacity, fl::third_party::plm_buffer_t::discard_read_bytes, FL_NOEXCEPT, fl::third_party::plm_buffer_t::free_when_done, fl::memset(), fl::third_party::plm_buffer_t::mode, PLM_BUFFER_MODE_RING, PLM_MALLOC, and TRUE.

Referenced by plm_buffer_create_for_appending(), plm_buffer_create_with_callbacks(), and plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_create_with_memory()

plm_buffer_t * fl::third_party::plm_buffer_create_with_memory ( uint8_t * bytes,
size_t length,
int free_when_done )

Definition at line 824 of file pl_mpeg.hpp.

824 {
826 fl::memset(self, 0, sizeof(plm_buffer_t));
827 self->capacity = length;
828 self->length = length;
829 self->total_size = length;
830 self->free_when_done = free_when_done;
831 self->bytes = bytes;
834 return self;
835}

References fl::third_party::plm_buffer_t::bytes, fl::third_party::plm_buffer_t::capacity, fl::third_party::plm_buffer_t::discard_read_bytes, FALSE, FL_NOEXCEPT, fl::third_party::plm_buffer_t::free_when_done, fl::third_party::plm_buffer_t::length, length(), fl::memset(), fl::third_party::plm_buffer_t::mode, PLM_BUFFER_MODE_FIXED_MEM, PLM_MALLOC, and fl::third_party::plm_buffer_t::total_size.

Referenced by plm_create_with_memory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_destroy()

void fl::third_party::plm_buffer_destroy ( plm_buffer_t * self)

Definition at line 855 of file pl_mpeg.hpp.

855 {
856#ifndef PLM_NO_STDIO
857 if (self->fh && self->close_when_done) {
858 fclose(self->fh);
859 }
860#endif
861 if (self->free_when_done) {
862 PLM_FREE(self->bytes);
863 }
864 PLM_FREE(self);
865}
int fclose(FILE *file)
Close a file.
Definition file_io.h:250

References fl::fclose(), FL_NOEXCEPT, and PLM_FREE.

Referenced by plm_audio_destroy(), plm_demux_destroy(), and plm_video_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_discard_read_bytes()

void fl::third_party::plm_buffer_discard_read_bytes ( plm_buffer_t * self)

Definition at line 951 of file pl_mpeg.hpp.

951 {
952 size_t byte_pos = self->bit_index >> 3;
953 if (byte_pos == self->length) {
954 self->bit_index = 0;
955 self->length = 0;
956 }
957 else if (byte_pos > 0) {
958 memmove(self->bytes, self->bytes + byte_pos, self->length - byte_pos);
959 self->bit_index -= byte_pos << 3;
960 self->length -= byte_pos;
961 }
962}

References FL_NOEXCEPT, and fl::memmove().

Referenced by plm_buffer_write(), and plm_video_decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_find_start_code()

int fl::third_party::plm_buffer_find_start_code ( plm_buffer_t * self,
int code )

Definition at line 1078 of file pl_mpeg.hpp.

1078 {
1079 int current = 0;
1080 while (TRUE) {
1081 current = plm_buffer_next_start_code(self);
1082 if (current == code || current == -1) {
1083 return current;
1084 }
1085 }
1086 return -1;
1087}
int plm_buffer_next_start_code(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1060

References FL_NOEXCEPT, plm_buffer_next_start_code(), and TRUE.

Referenced by plm_buffer_has_start_code(), plm_demux_has_headers(), plm_demux_seek(), plm_video_create_with_buffer(), plm_video_decode(), and plm_video_has_header().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_get_remaining()

size_t fl::third_party::plm_buffer_get_remaining ( plm_buffer_t * self)

Definition at line 873 of file pl_mpeg.hpp.

873 {
874 return self->length - (self->bit_index >> 3);
875}

References FL_NOEXCEPT.

◆ plm_buffer_get_size()

size_t fl::third_party::plm_buffer_get_size ( plm_buffer_t * self)

Definition at line 867 of file pl_mpeg.hpp.

867 {
868 return (self->mode == PLM_BUFFER_MODE_FILE)
869 ? self->total_size
870 : self->length;
871}

References FL_NOEXCEPT, and PLM_BUFFER_MODE_FILE.

Referenced by plm_demux_get_duration(), and plm_demux_seek().

+ Here is the caller graph for this function:

◆ plm_buffer_has()

int fl::third_party::plm_buffer_has ( plm_buffer_t * self,
size_t count )

Definition at line 998 of file pl_mpeg.hpp.

998 {
999 if (((self->length << 3) - self->bit_index) >= count) {
1000 return TRUE;
1001 }
1002
1003 if (self->load_callback) {
1004 self->load_callback(self, self->load_callback_user_data);
1005
1006 if (((self->length << 3) - self->bit_index) >= count) {
1007 return TRUE;
1008 }
1009 }
1010
1011 if (self->total_size != 0 && self->length == self->total_size) {
1012 self->has_ended = TRUE;
1013 }
1014 return FALSE;
1015}

References FALSE, FL_NOEXCEPT, and TRUE.

Referenced by plm_audio_decode(), plm_audio_decode_header(), plm_buffer_next_start_code(), plm_buffer_peek_non_zero(), plm_buffer_read(), plm_buffer_skip(), plm_buffer_skip_bytes(), plm_demux_decode(), plm_demux_decode_packet(), plm_demux_get_packet(), plm_demux_has_headers(), and plm_video_decode_sequence_header().

+ Here is the caller graph for this function:

◆ plm_buffer_has_ended()

int fl::third_party::plm_buffer_has_ended ( plm_buffer_t * self)

Definition at line 994 of file pl_mpeg.hpp.

994 {
995 return self->has_ended;
996}

References FL_NOEXCEPT.

Referenced by plm_audio_has_ended(), plm_demux_has_ended(), plm_video_decode(), and plm_video_has_ended().

+ Here is the caller graph for this function:

◆ plm_buffer_has_start_code()

int fl::third_party::plm_buffer_has_start_code ( plm_buffer_t * self,
int code )

Definition at line 1089 of file pl_mpeg.hpp.

1089 {
1090 size_t previous_bit_index = self->bit_index;
1091 int previous_discard_read_bytes = self->discard_read_bytes;
1092
1093 self->discard_read_bytes = FALSE;
1094 int current = plm_buffer_find_start_code(self, code);
1095
1096 self->bit_index = previous_bit_index;
1097 self->discard_read_bytes = previous_discard_read_bytes;
1098 return current;
1099}
int plm_buffer_find_start_code(plm_buffer_t *self, int code) FL_NOEXCEPT
Definition pl_mpeg.hpp:1078

References FALSE, FL_NOEXCEPT, and plm_buffer_find_start_code().

Referenced by plm_video_decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_next_start_code()

int fl::third_party::plm_buffer_next_start_code ( plm_buffer_t * self)

Definition at line 1060 of file pl_mpeg.hpp.

1060 {
1061 plm_buffer_align(self);
1062
1063 while (plm_buffer_has(self, (5 << 3))) {
1064 size_t byte_index = (self->bit_index) >> 3;
1065 if (
1066 self->bytes[byte_index] == 0x00 &&
1067 self->bytes[byte_index + 1] == 0x00 &&
1068 self->bytes[byte_index + 2] == 0x01
1069 ) {
1070 self->bit_index = (byte_index + 4) << 3;
1071 return self->bytes[byte_index + 3];
1072 }
1073 self->bit_index += 8;
1074 }
1075 return -1;
1076}

References FL_NOEXCEPT, plm_buffer_align(), and plm_buffer_has().

Referenced by plm_buffer_find_start_code(), plm_demux_decode(), plm_demux_probe(), and plm_video_decode_picture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_no_start_code()

int fl::third_party::plm_buffer_no_start_code ( plm_buffer_t * self)

References FL_NOEXCEPT, fl::fopen(), NULL, and TRUE.

+ Here is the call graph for this function:

◆ plm_buffer_peek_non_zero()

int fl::third_party::plm_buffer_peek_non_zero ( plm_buffer_t * self,
int bit_count )

Definition at line 1101 of file pl_mpeg.hpp.

1101 {
1102 if (!plm_buffer_has(self, bit_count)) {
1103 return FALSE;
1104 }
1105
1106 int val = plm_buffer_read(self, bit_count);
1107 self->bit_index -= bit_count;
1108 return val != 0;
1109}

References FALSE, FL_NOEXCEPT, plm_buffer_has(), and plm_buffer_read().

Referenced by plm_video_decode_slice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_read()

int fl::third_party::plm_buffer_read ( plm_buffer_t * self,
int count )

Definition at line 1017 of file pl_mpeg.hpp.

1017 {
1018 if (!plm_buffer_has(self, count)) {
1019 return 0;
1020 }
1021
1022 int value = 0;
1023 while (count) {
1024 int current_byte = self->bytes[self->bit_index >> 3];
1025
1026 int remaining = 8 - (self->bit_index & 7); // Remaining bits in byte
1027 int read = remaining < count ? remaining : count; // Bits in self run
1028 int shift = remaining - read;
1029 int mask = (0xff >> (8 - read));
1030
1031 value = (value << read) | ((current_byte & (mask << shift)) >> shift);
1032
1033 self->bit_index += read;
1034 count -= read;
1035 }
1036
1037 return value;
1038}
constexpr int type_rank< T >::value
int read()

References FL_NOEXCEPT, plm_buffer_has(), fl::read(), and fl::type_rank< T >::value.

Referenced by plm_audio_decode_frame(), plm_audio_decode_header(), plm_audio_read_allocation(), plm_audio_read_samples(), plm_buffer_peek_non_zero(), plm_buffer_read_vlc(), plm_demux_decode_packet(), plm_demux_decode_time(), plm_demux_has_headers(), plm_video_decode_block(), plm_video_decode_macroblock(), plm_video_decode_motion_vector(), plm_video_decode_picture(), plm_video_decode_sequence_header(), and plm_video_decode_slice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_read_vlc()

int16_t fl::third_party::plm_buffer_read_vlc ( plm_buffer_t * self,
const plm_vlc_t * table )

Definition at line 1111 of file pl_mpeg.hpp.

1111 {
1112 plm_vlc_t state = {0, 0};
1113 do {
1114 state = table[state.index + plm_buffer_read(self, 1)];
1115 } while (state.index > 0);
1116 return state.value;
1117}
TestState state

References FL_NOEXCEPT, plm_buffer_read(), and state.

Referenced by plm_buffer_read_vlc_uint(), plm_video_decode_block(), plm_video_decode_macroblock(), and plm_video_decode_motion_vector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_read_vlc_uint()

uint16_t fl::third_party::plm_buffer_read_vlc_uint ( plm_buffer_t * self,
const plm_vlc_uint_t * table )

Definition at line 1119 of file pl_mpeg.hpp.

1119 {
1120 return (uint16_t)plm_buffer_read_vlc(self, (const plm_vlc_t *)table);
1121}
int16_t plm_buffer_read_vlc(plm_buffer_t *self, const plm_vlc_t *table) FL_NOEXCEPT
Definition pl_mpeg.hpp:1111

References FL_NOEXCEPT, and plm_buffer_read_vlc().

Referenced by plm_video_decode_block().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_rewind()

void fl::third_party::plm_buffer_rewind ( plm_buffer_t * self)

Definition at line 919 of file pl_mpeg.hpp.

919 {
920 plm_buffer_seek(self, 0);
921}
void plm_buffer_seek(plm_buffer_t *self, size_t pos) FL_NOEXCEPT
Definition pl_mpeg.hpp:923

References FL_NOEXCEPT, and plm_buffer_seek().

Referenced by plm_audio_rewind(), plm_demux_rewind(), and plm_video_rewind().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_seek()

void fl::third_party::plm_buffer_seek ( plm_buffer_t * self,
size_t pos )

Definition at line 923 of file pl_mpeg.hpp.

923 {
924 self->has_ended = FALSE;
925
926 if (self->seek_callback) {
927 self->seek_callback(self, pos, self->load_callback_user_data);
928 self->bit_index = 0;
929 self->length = 0;
930 }
931 else if (self->mode == PLM_BUFFER_MODE_RING) {
932 if (pos != 0) {
933 // Seeking to non-0 is forbidden for dynamic-mem buffers
934 return;
935 }
936 self->bit_index = 0;
937 self->length = 0;
938 self->total_size = 0;
939 }
940 else if (pos < self->length) {
941 self->bit_index = pos << 3;
942 }
943}

References FALSE, FL_NOEXCEPT, length(), PLM_BUFFER_MODE_RING, and pos.

Referenced by plm_buffer_rewind(), and plm_demux_buffer_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_set_load_callback()

void fl::third_party::plm_buffer_set_load_callback ( plm_buffer_t * self,
plm_buffer_load_callback fp,
void * user )

Definition at line 914 of file pl_mpeg.hpp.

914 {
915 self->load_callback = fp;
916 self->load_callback_user_data = user;
917}

References FL_NOEXCEPT.

Referenced by plm_init_decoders().

+ Here is the caller graph for this function:

◆ plm_buffer_signal_end()

void fl::third_party::plm_buffer_signal_end ( plm_buffer_t * self)

Definition at line 910 of file pl_mpeg.hpp.

910 {
911 self->total_size = self->length;
912}

References FL_NOEXCEPT.

Referenced by plm_read_packets().

+ Here is the caller graph for this function:

◆ plm_buffer_skip()

void fl::third_party::plm_buffer_skip ( plm_buffer_t * self,
size_t count )

Definition at line 1044 of file pl_mpeg.hpp.

1044 {
1045 if (plm_buffer_has(self, count)) {
1046 self->bit_index += count;
1047 }
1048}

References FL_NOEXCEPT, and plm_buffer_has().

Referenced by plm_audio_decode_header(), plm_demux_decode(), plm_demux_decode_packet(), plm_demux_decode_time(), plm_demux_has_headers(), plm_video_decode_picture(), plm_video_decode_sequence_header(), and plm_video_decode_slice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_skip_bytes()

int fl::third_party::plm_buffer_skip_bytes ( plm_buffer_t * self,
uint8_t v )

Definition at line 1050 of file pl_mpeg.hpp.

1050 {
1051 plm_buffer_align(self);
1052 int skipped = 0;
1053 while (plm_buffer_has(self, 8) && self->bytes[self->bit_index >> 3] == v) {
1054 self->bit_index += 8;
1055 skipped++;
1056 }
1057 return skipped;
1058}

References FL_NOEXCEPT, plm_buffer_align(), and plm_buffer_has().

Referenced by plm_audio_decode_header(), and plm_demux_decode_packet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_buffer_tell()

size_t fl::third_party::plm_buffer_tell ( plm_buffer_t * self)

Definition at line 945 of file pl_mpeg.hpp.

945 {
946 return self->tell_callback
947 ? self->tell_callback(self, self->load_callback_user_data) + (self->bit_index >> 3) - self->length
948 : self->bit_index >> 3;
949}

References FL_NOEXCEPT.

Referenced by plm_demux_get_duration(), plm_demux_get_start_time(), plm_demux_probe(), and plm_demux_seek().

+ Here is the caller graph for this function:

◆ plm_buffer_write()

size_t fl::third_party::plm_buffer_write ( plm_buffer_t * self,
uint8_t * bytes,
size_t length )

Definition at line 877 of file pl_mpeg.hpp.

877 {
878 if (self->mode == PLM_BUFFER_MODE_FIXED_MEM) {
879 return 0;
880 }
881
882 if (self->discard_read_bytes) {
883 // This should be a ring buffer, but instead it just shifts all unread
884 // data to the beginning of the buffer and appends new data at the end.
885 // Seems to be good enough.
886
888 if (self->mode == PLM_BUFFER_MODE_RING) {
889 self->total_size = 0;
890 }
891 }
892
893 // Do we have to resize to fit the new data?
894 size_t bytes_available = self->capacity - self->length;
895 if (bytes_available < length) {
896 size_t new_size = self->capacity;
897 do {
898 new_size *= 2;
899 } while (new_size - self->length < length);
900 self->bytes = (uint8_t *)PLM_REALLOC(self->bytes, new_size);
901 self->capacity = new_size;
902 }
903
904 fl::memcopy(self->bytes + self->length, bytes, length);
905 self->length += length;
906 self->has_ended = FALSE;
907 return length;
908}
void plm_buffer_discard_read_bytes(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:951
#define PLM_REALLOC(p, sz)
Definition pl_mpeg.hpp:181

References FALSE, FL_NOEXCEPT, length(), fl::memcopy(), plm_buffer_discard_read_bytes(), PLM_BUFFER_MODE_FIXED_MEM, PLM_BUFFER_MODE_RING, and PLM_REALLOC.

Referenced by plm_read_packets(), plm_seek(), and plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_clamp()

static uint8_t fl::third_party::plm_clamp ( int n)
inlinestatic

Definition at line 2097 of file pl_mpeg.hpp.

2097 {
2098 if (n > 255) {
2099 n = 255;
2100 }
2101 else if (n < 0) {
2102 n = 0;
2103 }
2104 return n;
2105}

References FL_NOEXCEPT.

Referenced by plm_video_decode_block().

+ Here is the caller graph for this function:

◆ plm_create_with_buffer()

plm_t * fl::third_party::plm_create_with_buffer ( plm_buffer_t * buffer,
int destroy_when_done )

Definition at line 249 of file pl_mpeg.hpp.

249 {
250 plm_t *self = (plm_t *)PLM_MALLOC(sizeof(plm_t));
251 fl::memset(self, 0, sizeof(plm_t));
252
253 self->demux = plm_demux_create(buffer, destroy_when_done);
254 self->video_enabled = TRUE;
255 self->audio_enabled = TRUE;
256 plm_init_decoders(self);
257
258 return self;
259}
plm_demux_t * plm_demux_create(plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
Definition pl_mpeg.hpp:1159
int plm_init_decoders(plm_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:261
plm_demux_t * demux
Definition pl_mpeg.hpp:196

References fl::third_party::plm_t::audio_enabled, fl::third_party::plm_t::demux, FL_NOEXCEPT, fl::memset(), plm_demux_create(), plm_init_decoders(), PLM_MALLOC, TRUE, and fl::third_party::plm_t::video_enabled.

Referenced by plm_create_with_memory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_create_with_memory()

plm_t * fl::third_party::plm_create_with_memory ( uint8_t * bytes,
size_t length,
int free_when_done )

Definition at line 244 of file pl_mpeg.hpp.

244 {
245 plm_buffer_t *buffer = plm_buffer_create_with_memory(bytes, length, free_when_done);
246 return plm_create_with_buffer(buffer, TRUE);
247}
plm_buffer_t * plm_buffer_create_with_memory(uint8_t *bytes, size_t length, int free_when_done) FL_NOEXCEPT
Definition pl_mpeg.hpp:824
plm_t * plm_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
Definition pl_mpeg.hpp:249

References FL_NOEXCEPT, length(), plm_buffer_create_with_memory(), plm_create_with_buffer(), and TRUE.

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_decode()

void fl::third_party::plm_decode ( plm_t * self,
double seconds )

Definition at line 474 of file pl_mpeg.hpp.

474 {
475 if (!plm_init_decoders(self)) {
476 return;
477 }
478
479 int decode_video = (self->video_decode_callback && self->video_packet_type);
480 int decode_audio = (self->audio_decode_callback && self->audio_packet_type);
481
482 if (!decode_video && !decode_audio) {
483 // Nothing to do here
484 return;
485 }
486
487 int did_decode = FALSE;
488 int decode_video_failed = FALSE;
489 int decode_audio_failed = FALSE;
490
491 double video_target_time = self->time + tick;
492 double audio_target_time = self->time + tick + self->audio_lead_time;
493
494 do {
495 did_decode = FALSE;
496
497 if (decode_video && plm_video_get_time(self->video_decoder) < video_target_time) {
498 plm_frame_t *frame = plm_video_decode(self->video_decoder);
499 if (frame) {
501 did_decode = TRUE;
502 }
503 else {
504 decode_video_failed = TRUE;
505 }
506 }
507
508 if (decode_audio && plm_audio_get_time(self->audio_decoder) < audio_target_time) {
510 if (samples) {
511 self->audio_decode_callback(self, samples, self->audio_decode_callback_user_data);
512 did_decode = TRUE;
513 }
514 else {
515 decode_audio_failed = TRUE;
516 }
517 }
518 } while (did_decode);
519
520 // Did all sources we wanted to decode fail and the demuxer is at the end?
521 if (
522 (!decode_video || decode_video_failed) &&
523 (!decode_audio || decode_audio_failed) &&
525 ) {
526 plm_handle_end(self);
527 return;
528 }
529
530 self->time += tick;
531}
double plm_audio_get_time(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3275
void plm_handle_end(plm_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:571
plm_samples_t * plm_audio_decode(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3296
double plm_video_get_time(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2176
plm_frame_t * plm_video_decode(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2197
int plm_demux_has_ended(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1293
void * audio_decode_callback_user_data
Definition pl_mpeg.hpp:218
void * video_decode_callback_user_data
Definition pl_mpeg.hpp:215
plm_video_decode_callback video_decode_callback
Definition pl_mpeg.hpp:214
plm_video_t * video_decoder
Definition pl_mpeg.hpp:205
plm_audio_decode_callback audio_decode_callback
Definition pl_mpeg.hpp:217
plm_audio_t * audio_decoder
Definition pl_mpeg.hpp:212

References FALSE, FL_NOEXCEPT, plm_audio_decode(), plm_audio_get_time(), plm_demux_has_ended(), plm_handle_end(), plm_init_decoders(), plm_video_decode(), plm_video_get_time(), and TRUE.

Referenced by fl::third_party::SoftwareMpeg1Decoder::decodeNextFrame(), fl::third_party::SoftwareMpeg1Decoder::initializeDecoder(), and plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_decode_audio()

plm_samples_t * fl::third_party::plm_decode_audio ( plm_t * self)

Definition at line 552 of file pl_mpeg.hpp.

552 {
553 if (!plm_init_decoders(self)) {
554 return NULL;
555 }
556
557 if (!self->audio_packet_type) {
558 return NULL;
559 }
560
561 plm_samples_t *samples = plm_audio_decode(self->audio_decoder);
562 if (samples) {
563 self->time = samples->time;
564 }
565 else if (plm_demux_has_ended(self->demux)) {
566 plm_handle_end(self);
567 }
568 return samples;
569}

References FL_NOEXCEPT, NULL, plm_audio_decode(), plm_demux_has_ended(), plm_handle_end(), plm_init_decoders(), and fl::third_party::plm_samples_t::time.

+ Here is the call graph for this function:

◆ plm_decode_video()

plm_frame_t * fl::third_party::plm_decode_video ( plm_t * self)

Definition at line 533 of file pl_mpeg.hpp.

533 {
534 if (!plm_init_decoders(self)) {
535 return NULL;
536 }
537
538 if (!self->video_packet_type) {
539 return NULL;
540 }
541
542 plm_frame_t *frame = plm_video_decode(self->video_decoder);
543 if (frame) {
544 self->time = frame->time;
545 }
546 else if (plm_demux_has_ended(self->demux)) {
547 plm_handle_end(self);
548 }
549 return frame;
550}

References FL_NOEXCEPT, NULL, plm_demux_has_ended(), plm_handle_end(), plm_init_decoders(), plm_video_decode(), and fl::third_party::plm_frame_t::time.

+ Here is the call graph for this function:

◆ PLM_DEFINE_FRAME_CONVERT_FUNCTION() [1/3]

fl::third_party::PLM_DEFINE_FRAME_CONVERT_FUNCTION ( plm_frame_to_argb ,
4 ,
1 ,
2 ,
3  )

References PLM_DEFINE_FRAME_CONVERT_FUNCTION(), plm_frame_to_abgr(), and plm_frame_to_argb().

+ Here is the call graph for this function:

◆ PLM_DEFINE_FRAME_CONVERT_FUNCTION() [2/3]

fl::third_party::PLM_DEFINE_FRAME_CONVERT_FUNCTION ( plm_frame_to_rgb ,
3 ,
0 ,
1 ,
2  )

References PLM_DEFINE_FRAME_CONVERT_FUNCTION(), plm_frame_to_bgr(), and plm_frame_to_rgb().

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION(), PLM_DEFINE_FRAME_CONVERT_FUNCTION(), and PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PLM_DEFINE_FRAME_CONVERT_FUNCTION() [3/3]

fl::third_party::PLM_DEFINE_FRAME_CONVERT_FUNCTION ( plm_frame_to_rgba ,
4 ,
0 ,
1 ,
2  )

References PLM_DEFINE_FRAME_CONVERT_FUNCTION(), plm_frame_to_bgra(), and plm_frame_to_rgba().

+ Here is the call graph for this function:

◆ plm_demux_buffer_seek()

void fl::third_party::plm_demux_buffer_seek ( plm_demux_t * self,
size_t pos )

Definition at line 1297 of file pl_mpeg.hpp.

1297 {
1298 plm_buffer_seek(self->buffer, pos);
1299 self->current_packet.length = 0;
1300 self->next_packet.length = 0;
1301 self->start_code = -1;
1302}

References FL_NOEXCEPT, plm_buffer_seek(), and pos.

Referenced by plm_demux_get_duration(), plm_demux_get_start_time(), plm_demux_probe(), and plm_demux_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_create()

plm_demux_t * fl::third_party::plm_demux_create ( plm_buffer_t * buffer,
int destroy_when_done )

Definition at line 1159 of file pl_mpeg.hpp.

1159 {
1160 plm_demux_t *self = (plm_demux_t *)PLM_MALLOC(sizeof(plm_demux_t));
1161 fl::memset(self, 0, sizeof(plm_demux_t));
1162
1163 self->buffer = buffer;
1164 self->destroy_buffer_when_done = destroy_when_done;
1165
1168 self->start_code = -1;
1169
1171 return self;
1172}
int plm_demux_has_headers(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1181
#define PLM_PACKET_INVALID_TS
Definition pl_mpeg.h:171

References fl::third_party::plm_demux_t::buffer, fl::third_party::plm_demux_t::destroy_buffer_when_done, fl::third_party::plm_demux_t::duration, FL_NOEXCEPT, fl::memset(), plm_demux_has_headers(), PLM_MALLOC, PLM_PACKET_INVALID_TS, fl::third_party::plm_demux_t::start_code, and fl::third_party::plm_demux_t::start_time.

Referenced by plm_create_with_buffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_decode()

plm_packet_t * fl::third_party::plm_demux_decode ( plm_demux_t * self)

Definition at line 1517 of file pl_mpeg.hpp.

1517 {
1518 if (!plm_demux_has_headers(self)) {
1519 return NULL;
1520 }
1521
1522 if (self->current_packet.length) {
1523 size_t bits_till_next_packet = self->current_packet.length << 3;
1524 if (!plm_buffer_has(self->buffer, bits_till_next_packet)) {
1525 return NULL;
1526 }
1527 plm_buffer_skip(self->buffer, bits_till_next_packet);
1528 self->current_packet.length = 0;
1529 }
1530
1531 // Pending packet waiting for data?
1532 if (self->next_packet.length) {
1533 return plm_demux_get_packet(self);
1534 }
1535
1536 // Pending packet waiting for header?
1537 if (self->start_code != -1) {
1538 return plm_demux_decode_packet(self, self->start_code);
1539 }
1540
1541 do {
1543 if (
1548 )
1549 ) {
1550 return plm_demux_decode_packet(self, self->start_code);
1551 }
1552 } while (self->start_code != -1);
1553
1554 return NULL;
1555}
static const int PLM_DEMUX_PACKET_PRIVATE
Definition pl_mpeg.h:589
static const int PLM_DEMUX_PACKET_AUDIO_1
Definition pl_mpeg.h:590
plm_packet_t * plm_demux_get_packet(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1608
static const int PLM_DEMUX_PACKET_VIDEO_1
Definition pl_mpeg.h:594
plm_packet_t * plm_demux_decode_packet(plm_demux_t *self, int type) FL_NOEXCEPT
Definition pl_mpeg.hpp:1567
static const int PLM_DEMUX_PACKET_AUDIO_4
Definition pl_mpeg.h:593

References FL_NOEXCEPT, NULL, plm_buffer_has(), plm_buffer_next_start_code(), plm_buffer_skip(), plm_demux_decode_packet(), plm_demux_get_packet(), plm_demux_has_headers(), PLM_DEMUX_PACKET_AUDIO_1, PLM_DEMUX_PACKET_AUDIO_4, PLM_DEMUX_PACKET_PRIVATE, and PLM_DEMUX_PACKET_VIDEO_1.

Referenced by plm_demux_get_duration(), plm_demux_get_start_time(), plm_read_packets(), and plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_decode_packet()

plm_packet_t * fl::third_party::plm_demux_decode_packet ( plm_demux_t * self,
int type )

Definition at line 1567 of file pl_mpeg.hpp.

1567 {
1568 if (!plm_buffer_has(self->buffer, 16 << 3)) {
1569 return NULL;
1570 }
1571
1572 self->start_code = -1;
1573
1574 self->next_packet.type = type;
1575 self->next_packet.length = plm_buffer_read(self->buffer, 16);
1576 self->next_packet.length -= plm_buffer_skip_bytes(self->buffer, 0xff); // stuffing
1577
1578 // skip P-STD
1579 if (plm_buffer_read(self->buffer, 2) == 0x01) {
1580 plm_buffer_skip(self->buffer, 16);
1581 self->next_packet.length -= 2;
1582 }
1583
1584 int pts_dts_marker = plm_buffer_read(self->buffer, 2);
1585 if (pts_dts_marker == 0x03) {
1587 self->last_decoded_pts = self->next_packet.pts;
1588 plm_buffer_skip(self->buffer, 40); // skip dts
1589 self->next_packet.length -= 10;
1590 }
1591 else if (pts_dts_marker == 0x02) {
1593 self->last_decoded_pts = self->next_packet.pts;
1594 self->next_packet.length -= 5;
1595 }
1596 else if (pts_dts_marker == 0x00) {
1598 plm_buffer_skip(self->buffer, 4);
1599 self->next_packet.length -= 1;
1600 }
1601 else {
1602 return NULL; // invalid
1603 }
1604
1605 return plm_demux_get_packet(self);
1606}
double plm_demux_decode_time(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1557

References FL_NOEXCEPT, NULL, plm_buffer_has(), plm_buffer_read(), plm_buffer_skip(), plm_buffer_skip_bytes(), plm_demux_decode_time(), plm_demux_get_packet(), and PLM_PACKET_INVALID_TS.

Referenced by plm_demux_decode(), and plm_demux_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_decode_time()

double fl::third_party::plm_demux_decode_time ( plm_demux_t * self)

Definition at line 1557 of file pl_mpeg.hpp.

1557 {
1558 i64 clock = (i64)plm_buffer_read(self->buffer, 3) << 30;
1559 plm_buffer_skip(self->buffer, 1);
1560 clock |= (i64)plm_buffer_read(self->buffer, 15) << 15;
1561 plm_buffer_skip(self->buffer, 1);
1562 clock |= (i64)plm_buffer_read(self->buffer, 15);
1563 plm_buffer_skip(self->buffer, 1);
1564 return (double)clock / 90000.0;
1565}
fl::i64 i64
Definition coder.h:222

References FL_NOEXCEPT, plm_buffer_read(), and plm_buffer_skip().

Referenced by plm_demux_decode_packet(), and plm_demux_has_headers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_destroy()

void fl::third_party::plm_demux_destroy ( plm_demux_t * self)

Definition at line 1174 of file pl_mpeg.hpp.

1174 {
1175 if (self->destroy_buffer_when_done) {
1177 }
1178 PLM_FREE(self);
1179}

References FL_NOEXCEPT, plm_buffer_destroy(), and PLM_FREE.

Referenced by plm_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_get_duration()

double fl::third_party::plm_demux_get_duration ( plm_demux_t * self,
int type )

Definition at line 1329 of file pl_mpeg.hpp.

1329 {
1330 size_t file_size = plm_buffer_get_size(self->buffer);
1331
1332 if (
1334 self->last_file_size == file_size
1335 ) {
1336 return self->duration;
1337 }
1338
1339 size_t previous_pos = plm_buffer_tell(self->buffer);
1340 int previous_start_code = self->start_code;
1341
1342 // Find last video PTS. Start searching 64kb from the end and go further
1343 // back if needed.
1344 long start_range = 64L * 1024L;
1345 long max_range = 4096L * 1024L;
1346 for (long range = start_range; range <= max_range; range *= 2) {
1347 long seek_pos = file_size - range;
1348 if (seek_pos < 0) {
1349 seek_pos = 0;
1350 range = max_range; // Make sure to bail after this round
1351 }
1352 plm_demux_buffer_seek(self, seek_pos);
1353 self->current_packet.length = 0;
1354
1355 double last_pts = PLM_PACKET_INVALID_TS;
1356 plm_packet_t *packet = NULL;
1357 while ((packet = plm_demux_decode(self))) {
1358 if (packet->pts != PLM_PACKET_INVALID_TS && packet->type == type) {
1359 last_pts = packet->pts;
1360 }
1361 }
1362 if (last_pts != PLM_PACKET_INVALID_TS) {
1363 self->duration = last_pts - plm_demux_get_start_time(self, type);
1364 break;
1365 }
1366 }
1367
1368 plm_demux_buffer_seek(self, previous_pos);
1369 self->start_code = previous_start_code;
1370 self->last_file_size = file_size;
1371 return self->duration;
1372}
void plm_demux_buffer_seek(plm_demux_t *self, size_t pos) FL_NOEXCEPT
Definition pl_mpeg.hpp:1297
plm_packet_t * plm_demux_decode(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1517
size_t plm_buffer_get_size(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:867
double plm_demux_get_start_time(plm_demux_t *self, int type) FL_NOEXCEPT
Definition pl_mpeg.hpp:1304
size_t plm_buffer_tell(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:945

References FL_NOEXCEPT, NULL, plm_buffer_get_size(), plm_buffer_tell(), plm_demux_buffer_seek(), plm_demux_decode(), plm_demux_get_start_time(), PLM_PACKET_INVALID_TS, fl::third_party::plm_packet_t::pts, and fl::third_party::plm_packet_t::type.

Referenced by plm_demux_seek(), plm_get_duration(), and plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_get_num_audio_streams()

int fl::third_party::plm_demux_get_num_audio_streams ( plm_demux_t * self)

Definition at line 1280 of file pl_mpeg.hpp.

1280 {
1281 return plm_demux_has_headers(self)
1282 ? self->num_audio_streams
1283 : 0;
1284}

References FL_NOEXCEPT, and plm_demux_has_headers().

Referenced by plm_get_num_audio_streams(), and plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_get_num_video_streams()

int fl::third_party::plm_demux_get_num_video_streams ( plm_demux_t * self)

Definition at line 1274 of file pl_mpeg.hpp.

1274 {
1275 return plm_demux_has_headers(self)
1276 ? self->num_video_streams
1277 : 0;
1278}

References FL_NOEXCEPT, and plm_demux_has_headers().

Referenced by plm_get_num_video_streams(), and plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_get_packet()

plm_packet_t * fl::third_party::plm_demux_get_packet ( plm_demux_t * self)

Definition at line 1608 of file pl_mpeg.hpp.

1608 {
1609 if (!plm_buffer_has(self->buffer, self->next_packet.length << 3)) {
1610 return NULL;
1611 }
1612
1613 self->current_packet.data = self->buffer->bytes + (self->buffer->bit_index >> 3);
1615 self->current_packet.type = self->next_packet.type;
1616 self->current_packet.pts = self->next_packet.pts;
1617
1618 self->next_packet.length = 0;
1619 return &self->current_packet;
1620}

References FL_NOEXCEPT, NULL, and plm_buffer_has().

Referenced by plm_demux_decode(), and plm_demux_decode_packet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_get_start_time()

double fl::third_party::plm_demux_get_start_time ( plm_demux_t * self,
int type )

Definition at line 1304 of file pl_mpeg.hpp.

1304 {
1305 if (self->start_time != PLM_PACKET_INVALID_TS) {
1306 return self->start_time;
1307 }
1308
1309 int previous_pos = plm_buffer_tell(self->buffer);
1310 int previous_start_code = self->start_code;
1311
1312 // Find first video PTS
1313 plm_demux_rewind(self);
1314 do {
1315 plm_packet_t *packet = plm_demux_decode(self);
1316 if (!packet) {
1317 break;
1318 }
1319 if (packet->type == type) {
1320 self->start_time = packet->pts;
1321 }
1322 } while (self->start_time == PLM_PACKET_INVALID_TS);
1323
1324 plm_demux_buffer_seek(self, previous_pos);
1325 self->start_code = previous_start_code;
1326 return self->start_time;
1327}
void plm_demux_rewind(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1286

References FL_NOEXCEPT, plm_buffer_tell(), plm_demux_buffer_seek(), plm_demux_decode(), plm_demux_rewind(), PLM_PACKET_INVALID_TS, fl::third_party::plm_packet_t::pts, and fl::third_party::plm_packet_t::type.

Referenced by plm_demux_get_duration(), plm_seek(), and plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_has_ended()

int fl::third_party::plm_demux_has_ended ( plm_demux_t * self)

Definition at line 1293 of file pl_mpeg.hpp.

1293 {
1294 return plm_buffer_has_ended(self->buffer);
1295}

References FL_NOEXCEPT, and plm_buffer_has_ended().

Referenced by plm_decode(), plm_decode_audio(), plm_decode_video(), and plm_read_packets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_has_headers()

int fl::third_party::plm_demux_has_headers ( plm_demux_t * self)

Definition at line 1181 of file pl_mpeg.hpp.

1181 {
1182 if (self->has_headers) {
1183 return TRUE;
1184 }
1185
1186 // Decode pack header
1187 if (!self->has_pack_header) {
1188 if (
1189 self->start_code != PLM_START_PACK &&
1191 ) {
1192 return FALSE;
1193 }
1194
1195 self->start_code = PLM_START_PACK;
1196 if (!plm_buffer_has(self->buffer, 64)) {
1197 return FALSE;
1198 }
1199 self->start_code = -1;
1200
1201 if (plm_buffer_read(self->buffer, 4) != 0x02) {
1202 return FALSE;
1203 }
1204
1206 plm_buffer_skip(self->buffer, 1);
1207 plm_buffer_skip(self->buffer, 22); // mux_rate * 50
1208 plm_buffer_skip(self->buffer, 1);
1209
1210 self->has_pack_header = TRUE;
1211 }
1212
1213 // Decode system header
1214 if (!self->has_system_header) {
1215 if (
1216 self->start_code != PLM_START_SYSTEM &&
1218 ) {
1219 return FALSE;
1220 }
1221
1223 if (!plm_buffer_has(self->buffer, 56)) {
1224 return FALSE;
1225 }
1226 self->start_code = -1;
1227
1228 plm_buffer_skip(self->buffer, 16); // header_length
1229 plm_buffer_skip(self->buffer, 24); // rate bound
1230 self->num_audio_streams = plm_buffer_read(self->buffer, 6);
1231 plm_buffer_skip(self->buffer, 5); // misc flags
1232 self->num_video_streams = plm_buffer_read(self->buffer, 5);
1233
1234 self->has_system_header = TRUE;
1235 }
1236
1237 self->has_headers = TRUE;
1238 return TRUE;
1239}
static const int PLM_START_PACK
Definition pl_mpeg.hpp:1128
static const int PLM_START_SYSTEM
Definition pl_mpeg.hpp:1130

References FALSE, FL_NOEXCEPT, plm_buffer_find_start_code(), plm_buffer_has(), plm_buffer_read(), plm_buffer_skip(), plm_demux_decode_time(), PLM_START_PACK, PLM_START_SYSTEM, and TRUE.

Referenced by plm_demux_create(), plm_demux_decode(), plm_demux_get_num_audio_streams(), plm_demux_get_num_video_streams(), plm_demux_seek(), plm_has_headers(), and plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_probe()

int fl::third_party::plm_demux_probe ( plm_demux_t * self,
size_t probesize )

Definition at line 1241 of file pl_mpeg.hpp.

1241 {
1242 int previous_pos = plm_buffer_tell(self->buffer);
1243
1244 int video_stream = FALSE;
1245 int audio_streams[4] = {FALSE, FALSE, FALSE, FALSE};
1246 do {
1248 if (self->start_code == PLM_DEMUX_PACKET_VIDEO_1) {
1249 video_stream = TRUE;
1250 }
1251 else if (
1254 ) {
1255 audio_streams[self->start_code - PLM_DEMUX_PACKET_AUDIO_1] = TRUE;
1256 }
1257 } while (
1258 self->start_code != -1 &&
1259 plm_buffer_tell(self->buffer) - previous_pos < probesize
1260 );
1261
1262 self->num_video_streams = video_stream ? 1 : 0;
1263 self->num_audio_streams = 0;
1264 for (int i = 0; i < 4; i++) {
1265 if (audio_streams[i]) {
1266 self->num_audio_streams++;
1267 }
1268 }
1269
1270 plm_demux_buffer_seek(self, previous_pos);
1271 return (self->num_video_streams || self->num_audio_streams);
1272}

References FALSE, FL_NOEXCEPT, plm_buffer_next_start_code(), plm_buffer_tell(), plm_demux_buffer_seek(), PLM_DEMUX_PACKET_AUDIO_1, PLM_DEMUX_PACKET_AUDIO_4, PLM_DEMUX_PACKET_VIDEO_1, and TRUE.

Referenced by plm_probe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_rewind()

void fl::third_party::plm_demux_rewind ( plm_demux_t * self)

Definition at line 1286 of file pl_mpeg.hpp.

1286 {
1288 self->current_packet.length = 0;
1289 self->next_packet.length = 0;
1290 self->start_code = -1;
1291}

References FL_NOEXCEPT, and plm_buffer_rewind().

Referenced by plm_demux_get_start_time(), and plm_rewind().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_demux_seek()

plm_packet_t * fl::third_party::plm_demux_seek ( plm_demux_t * self,
double time,
int type,
int force_intra )

Definition at line 1374 of file pl_mpeg.hpp.

1374 {
1375 if (!plm_demux_has_headers(self)) {
1376 return NULL;
1377 }
1378
1379 // Using the current time, current byte position and the average bytes per
1380 // second for this file, try to jump to a byte position that hopefully has
1381 // packets containing timestamps within one second before to the desired
1382 // seek_time.
1383
1384 // If we hit close to the seek_time scan through all packets to find the
1385 // last one (just before the seek_time) containing an intra frame.
1386 // Otherwise we should at least be closer than before. Calculate the bytes
1387 // per second for the jumped range and jump again.
1388
1389 // The number of retries here is hard-limited to a generous amount. Usually
1390 // the correct range is found after 1--5 jumps, even for files with very
1391 // variable bitrates. If significantly more jumps are needed, there's
1392 // probably something wrong with the file and we just avoid getting into an
1393 // infinite loop. 32 retries should be enough for anybody.
1394
1395 double duration = plm_demux_get_duration(self, type);
1396 long file_size = plm_buffer_get_size(self->buffer);
1397 long byterate = file_size / duration;
1398
1399 double cur_time = self->last_decoded_pts;
1400 double scan_span = 1;
1401
1402 if (seek_time > duration) {
1403 seek_time = duration;
1404 }
1405 else if (seek_time < 0) {
1406 seek_time = 0;
1407 }
1408 seek_time += self->start_time;
1409
1410 for (int retry = 0; retry < 32; retry++) {
1411 int found_packet_with_pts = FALSE;
1412 int found_packet_in_range = FALSE;
1413 long last_valid_packet_start = -1;
1414 double first_packet_time = PLM_PACKET_INVALID_TS;
1415
1416 long cur_pos = plm_buffer_tell(self->buffer);
1417
1418 // Estimate byte offset and jump to it.
1419 long offset = (seek_time - cur_time - scan_span) * byterate;
1420 long seek_pos = cur_pos + offset;
1421 if (seek_pos < 0) {
1422 seek_pos = 0;
1423 }
1424 else if (seek_pos > file_size - 256) {
1425 seek_pos = file_size - 256;
1426 }
1427
1428 plm_demux_buffer_seek(self, seek_pos);
1429
1430 // Scan through all packets up to the seek_time to find the last packet
1431 // containing an intra frame.
1432 while (plm_buffer_find_start_code(self->buffer, type) != -1) {
1433 long packet_start = plm_buffer_tell(self->buffer);
1434 plm_packet_t *packet = plm_demux_decode_packet(self, type);
1435
1436 // Skip packet if it has no PTS
1437 if (!packet || packet->pts == PLM_PACKET_INVALID_TS) {
1438 continue;
1439 }
1440
1441 // Bail scanning through packets if we hit one that is outside
1442 // seek_time - scan_span.
1443 // We also adjust the cur_time and byterate values here so the next
1444 // iteration can be a bit more precise.
1445 if (packet->pts > seek_time || packet->pts < seek_time - scan_span) {
1446 found_packet_with_pts = TRUE;
1447 byterate = (seek_pos - cur_pos) / (packet->pts - cur_time);
1448 cur_time = packet->pts;
1449 break;
1450 }
1451
1452 // If we are still here, it means this packet is in close range to
1453 // the seek_time. If this is the first packet for this jump position
1454 // record the PTS. If we later have to back off, when there was no
1455 // intra frame in this range, we can lower the seek_time to not scan
1456 // this range again.
1457 if (!found_packet_in_range) {
1458 found_packet_in_range = TRUE;
1459 first_packet_time = packet->pts;
1460 }
1461
1462 // Check if this is an intra frame packet. If so, record the buffer
1463 // position of the start of this packet. We want to jump back to it
1464 // later, when we know it's the last intra frame before desired
1465 // seek time.
1466 if (force_intra) {
1467 for (size_t i = 0; i < packet->length - 6; i++) {
1468 // Find the START_PICTURE code
1469 if (
1470 packet->data[i] == 0x00 &&
1471 packet->data[i + 1] == 0x00 &&
1472 packet->data[i + 2] == 0x01 &&
1473 packet->data[i + 3] == 0x00
1474 ) {
1475 // Bits 11--13 in the picture header contain the frame
1476 // type, where 1=Intra
1477 if ((packet->data[i + 5] & 0x38) == 8) {
1478 last_valid_packet_start = packet_start;
1479 }
1480 break;
1481 }
1482 }
1483 }
1484
1485 // If we don't want intra frames, just use the last PTS found.
1486 else {
1487 last_valid_packet_start = packet_start;
1488 }
1489 }
1490
1491 // If there was at least one intra frame in the range scanned above,
1492 // our search is over. Jump back to the packet and decode it again.
1493 if (last_valid_packet_start != -1) {
1494 plm_demux_buffer_seek(self, last_valid_packet_start);
1495 return plm_demux_decode_packet(self, type);
1496 }
1497
1498 // If we hit the right range, but still found no intra frame, we have
1499 // to increases the scan_span. This is done exponentially to also handle
1500 // video files with very few intra frames.
1501 else if (found_packet_in_range) {
1502 scan_span *= 2;
1503 seek_time = first_packet_time;
1504 }
1505
1506 // If we didn't find any packet with a PTS, it probably means we reached
1507 // the end of the file. Estimate byterate and cur_time accordingly.
1508 else if (!found_packet_with_pts) {
1509 byterate = (seek_pos - cur_pos) / (duration - cur_time);
1510 cur_time = duration;
1511 }
1512 }
1513
1514 return NULL;
1515}
double plm_demux_get_duration(plm_demux_t *self, int type) FL_NOEXCEPT
Definition pl_mpeg.hpp:1329

References fl::third_party::plm_packet_t::data, FALSE, FL_NOEXCEPT, fl::third_party::plm_packet_t::length, NULL, offset(), plm_buffer_find_start_code(), plm_buffer_get_size(), plm_buffer_tell(), plm_demux_buffer_seek(), plm_demux_decode_packet(), plm_demux_get_duration(), plm_demux_has_headers(), PLM_PACKET_INVALID_TS, fl::third_party::plm_packet_t::pts, and TRUE.

Referenced by plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_destroy()

void fl::third_party::plm_destroy ( plm_t * self)

Definition at line 296 of file pl_mpeg.hpp.

296 {
297 if (self->video_decoder) {
299 }
300 if (self->audio_decoder) {
302 }
303
305 PLM_FREE(self);
306}
void plm_audio_destroy(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3253
void plm_video_destroy(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2136
void plm_demux_destroy(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1174

References FL_NOEXCEPT, plm_audio_destroy(), plm_demux_destroy(), PLM_FREE, and plm_video_destroy().

Referenced by fl::third_party::SoftwareMpeg1Decoder::cleanupDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_frame_to_abgr()

void fl::third_party::plm_frame_to_abgr ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT, and fl::time().

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_frame_to_argb()

void fl::third_party::plm_frame_to_argb ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT.

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the caller graph for this function:

◆ plm_frame_to_bgr()

void fl::third_party::plm_frame_to_bgr ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT.

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the caller graph for this function:

◆ plm_frame_to_bgra()

void fl::third_party::plm_frame_to_bgra ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT.

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the caller graph for this function:

◆ plm_frame_to_rgb()

void fl::third_party::plm_frame_to_rgb ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT.

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the caller graph for this function:

◆ plm_frame_to_rgba()

void fl::third_party::plm_frame_to_rgba ( plm_frame_t * frame,
uint8_t * dest,
int stride )

References FL_NOEXCEPT.

Referenced by PLM_DEFINE_FRAME_CONVERT_FUNCTION().

+ Here is the caller graph for this function:

◆ plm_get_audio_enabled()

int fl::third_party::plm_get_audio_enabled ( plm_t * self)

Definition at line 308 of file pl_mpeg.hpp.

308 {
309 return self->audio_enabled;
310}

References FL_NOEXCEPT.

◆ plm_get_audio_lead_time()

double fl::third_party::plm_get_audio_lead_time ( plm_t * self)

Definition at line 422 of file pl_mpeg.hpp.

422 {
423 return self->audio_lead_time;
424}

References FL_NOEXCEPT.

◆ plm_get_duration()

double fl::third_party::plm_get_duration ( plm_t * self)

Definition at line 434 of file pl_mpeg.hpp.

434 {
436}

References FL_NOEXCEPT, plm_demux_get_duration(), and PLM_DEMUX_PACKET_VIDEO_1.

+ Here is the call graph for this function:

◆ plm_get_framerate()

double fl::third_party::plm_get_framerate ( plm_t * self)

Definition at line 400 of file pl_mpeg.hpp.

400 {
401 return (plm_init_decoders(self) && self->video_decoder)
403 : 0;
404}
double plm_video_get_framerate(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2148

References FL_NOEXCEPT, plm_init_decoders(), and plm_video_get_framerate().

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_get_height()

int fl::third_party::plm_get_height ( plm_t * self)

Definition at line 394 of file pl_mpeg.hpp.

394 {
395 return (plm_init_decoders(self) && self->video_decoder)
397 : 0;
398}
int plm_video_get_height(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2166

References FL_NOEXCEPT, plm_init_decoders(), and plm_video_get_height().

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_get_loop()

int fl::third_party::plm_get_loop ( plm_t * self)

Definition at line 452 of file pl_mpeg.hpp.

452 {
453 return self->loop;
454}

References FL_NOEXCEPT.

◆ plm_get_num_audio_streams()

int fl::third_party::plm_get_num_audio_streams ( plm_t * self)

Definition at line 412 of file pl_mpeg.hpp.

412 {
414}
int plm_demux_get_num_audio_streams(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1280

References FL_NOEXCEPT, and plm_demux_get_num_audio_streams().

Referenced by fl::third_party::SoftwareMpeg1Decoder::hasAudio().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_get_num_video_streams()

int fl::third_party::plm_get_num_video_streams ( plm_t * self)

Definition at line 384 of file pl_mpeg.hpp.

384 {
386}
int plm_demux_get_num_video_streams(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1274

References FL_NOEXCEPT, and plm_demux_get_num_video_streams().

+ Here is the call graph for this function:

◆ plm_get_pixel_aspect_ratio()

double fl::third_party::plm_get_pixel_aspect_ratio ( plm_t * self)

Definition at line 406 of file pl_mpeg.hpp.

406 {
407 return (plm_init_decoders(self) && self->video_decoder)
409 : 0;
410}
double plm_video_get_pixel_aspect_ratio(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2154

References FL_NOEXCEPT, plm_init_decoders(), and plm_video_get_pixel_aspect_ratio().

+ Here is the call graph for this function:

◆ plm_get_samplerate()

int fl::third_party::plm_get_samplerate ( plm_t * self)

Definition at line 416 of file pl_mpeg.hpp.

416 {
417 return (plm_init_decoders(self) && self->audio_decoder)
419 : 0;
420}
int plm_audio_get_samplerate(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3269

References FL_NOEXCEPT, plm_audio_get_samplerate(), and plm_init_decoders().

Referenced by fl::third_party::SoftwareMpeg1Decoder::getAudioSampleRate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_get_time()

double fl::third_party::plm_get_time ( plm_t * self)

Definition at line 430 of file pl_mpeg.hpp.

430 {
431 return self->time;
432}

References FL_NOEXCEPT.

◆ plm_get_video_enabled()

int fl::third_party::plm_get_video_enabled ( plm_t * self)

Definition at line 367 of file pl_mpeg.hpp.

367 {
368 return self->video_enabled;
369}

References FL_NOEXCEPT.

◆ plm_get_width()

int fl::third_party::plm_get_width ( plm_t * self)

Definition at line 388 of file pl_mpeg.hpp.

388 {
389 return (plm_init_decoders(self) && self->video_decoder)
391 : 0;
392}
int plm_video_get_width(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2160

References FL_NOEXCEPT, plm_init_decoders(), and plm_video_get_width().

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_handle_end()

void fl::third_party::plm_handle_end ( plm_t * self)

Definition at line 571 of file pl_mpeg.hpp.

571 {
572 if (self->loop) {
573 plm_rewind(self);
574 }
575 else {
576 self->has_ended = TRUE;
577 }
578}
void plm_rewind(plm_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:438

References FL_NOEXCEPT, plm_rewind(), and TRUE.

Referenced by plm_decode(), plm_decode_audio(), and plm_decode_video().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_has_ended()

int fl::third_party::plm_has_ended ( plm_t * self)

Definition at line 460 of file pl_mpeg.hpp.

460 {
461 return self->has_ended;
462}

References FL_NOEXCEPT.

Referenced by fl::third_party::SoftwareMpeg1Decoder::decodeNextFrame().

+ Here is the caller graph for this function:

◆ plm_has_headers()

int fl::third_party::plm_has_headers ( plm_t * self)

Definition at line 312 of file pl_mpeg.hpp.

312 {
313 if (!plm_demux_has_headers(self->demux)) {
314 return FALSE;
315 }
316
317 if (!plm_init_decoders(self)) {
318 return FALSE;
319 }
320
321 if (
324 ) {
325 return FALSE;
326 }
327
328 return TRUE;
329}
int plm_video_has_header(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2263

References FALSE, FL_NOEXCEPT, plm_audio_has_header(), plm_demux_has_headers(), plm_init_decoders(), plm_video_has_header(), and TRUE.

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_init_decoders()

int fl::third_party::plm_init_decoders ( plm_t * self)

Definition at line 261 of file pl_mpeg.hpp.

261 {
262 if (self->has_decoders) {
263 return TRUE;
264 }
265
266 if (!plm_demux_has_headers(self->demux)) {
267 return FALSE;
268 }
269
270 if (plm_demux_get_num_video_streams(self->demux) > 0) {
271 if (self->video_enabled) {
273 }
274 if (!self->video_decoder) {
278 }
279 }
280
281 if (plm_demux_get_num_audio_streams(self->demux) > 0) {
282 if (self->audio_enabled) {
284 }
285 if (!self->audio_decoder) {
289 }
290 }
291
292 self->has_decoders = TRUE;
293 return TRUE;
294}
plm_video_t * plm_video_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
Definition pl_mpeg.hpp:2121
void plm_buffer_set_load_callback(plm_buffer_t *self, plm_buffer_load_callback fp, void *user) FL_NOEXCEPT
Definition pl_mpeg.hpp:914
void plm_read_video_packet(plm_buffer_t *buffer, void *user) FL_NOEXCEPT
Definition pl_mpeg.hpp:580
void plm_read_audio_packet(plm_buffer_t *buffer, void *user) FL_NOEXCEPT
Definition pl_mpeg.hpp:586
plm_audio_t * plm_audio_create_with_buffer(plm_buffer_t *buffer, int destroy_when_done) FL_NOEXCEPT
Definition pl_mpeg.hpp:3235
plm_buffer_t * audio_buffer
Definition pl_mpeg.hpp:211
plm_buffer_t * video_buffer
Definition pl_mpeg.hpp:204

References FALSE, FL_NOEXCEPT, plm_audio_create_with_buffer(), plm_buffer_create_with_capacity(), PLM_BUFFER_DEFAULT_SIZE, plm_buffer_set_load_callback(), plm_demux_get_num_audio_streams(), plm_demux_get_num_video_streams(), plm_demux_has_headers(), PLM_DEMUX_PACKET_AUDIO_1, PLM_DEMUX_PACKET_VIDEO_1, plm_read_audio_packet(), plm_read_video_packet(), plm_video_create_with_buffer(), and TRUE.

Referenced by plm_create_with_buffer(), plm_decode(), plm_decode_audio(), plm_decode_video(), plm_get_framerate(), plm_get_height(), plm_get_pixel_aspect_ratio(), plm_get_samplerate(), plm_get_width(), plm_has_headers(), plm_probe(), plm_seek_frame(), plm_set_audio_enabled(), and plm_set_video_enabled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_probe()

int fl::third_party::plm_probe ( plm_t * self,
size_t probesize )

Definition at line 331 of file pl_mpeg.hpp.

331 {
332 int found_streams = plm_demux_probe(self->demux, probesize);
333 if (!found_streams) {
334 return FALSE;
335 }
336
337 // Re-init decoders
338 self->has_decoders = FALSE;
339 self->video_packet_type = 0;
340 self->audio_packet_type = 0;
341 return plm_init_decoders(self);
342}
int plm_demux_probe(plm_demux_t *self, size_t probesize) FL_NOEXCEPT
Definition pl_mpeg.hpp:1241

References FALSE, FL_NOEXCEPT, plm_demux_probe(), and plm_init_decoders().

+ Here is the call graph for this function:

◆ plm_read_audio_packet()

void fl::third_party::plm_read_audio_packet ( plm_buffer_t * buffer,
void * user )

Definition at line 586 of file pl_mpeg.hpp.

586 {
587 PLM_UNUSED(buffer);
588 plm_t *self = (plm_t *)user;
590}
void plm_read_packets(plm_t *self, int requested_type) FL_NOEXCEPT
Definition pl_mpeg.hpp:592
#define PLM_UNUSED(expr)
Definition pl_mpeg.hpp:184

References fl::third_party::plm_t::audio_packet_type, FL_NOEXCEPT, plm_read_packets(), and PLM_UNUSED.

Referenced by plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_read_packets()

void fl::third_party::plm_read_packets ( plm_t * self,
int requested_type )

Definition at line 592 of file pl_mpeg.hpp.

592 {
593 plm_packet_t *packet;
594 while ((packet = plm_demux_decode(self->demux))) {
595 if (packet->type == self->video_packet_type) {
596 plm_buffer_write(self->video_buffer, packet->data, packet->length);
597 }
598 else if (packet->type == self->audio_packet_type) {
599 plm_buffer_write(self->audio_buffer, packet->data, packet->length);
600 }
601
602 if (packet->type == requested_type) {
603 return;
604 }
605 }
606
607 if (plm_demux_has_ended(self->demux)) {
608 if (self->video_buffer) {
610 }
611 if (self->audio_buffer) {
613 }
614 }
615}
void plm_buffer_signal_end(plm_buffer_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:910
size_t plm_buffer_write(plm_buffer_t *self, uint8_t *bytes, size_t length) FL_NOEXCEPT
Definition pl_mpeg.hpp:877

References fl::third_party::plm_packet_t::data, FL_NOEXCEPT, fl::third_party::plm_packet_t::length, plm_buffer_signal_end(), plm_buffer_write(), plm_demux_decode(), plm_demux_has_ended(), and fl::third_party::plm_packet_t::type.

Referenced by plm_read_audio_packet(), and plm_read_video_packet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_read_video_packet()

void fl::third_party::plm_read_video_packet ( plm_buffer_t * buffer,
void * user )

Definition at line 580 of file pl_mpeg.hpp.

580 {
581 PLM_UNUSED(buffer);
582 plm_t *self = (plm_t *)user;
584}

References FL_NOEXCEPT, plm_read_packets(), PLM_UNUSED, and fl::third_party::plm_t::video_packet_type.

Referenced by plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_rewind()

void fl::third_party::plm_rewind ( plm_t * self)

Definition at line 438 of file pl_mpeg.hpp.

438 {
439 if (self->video_decoder) {
441 }
442
443 if (self->audio_decoder) {
445 }
446
447 plm_demux_rewind(self->demux);
448 self->time = 0;
449 self->has_ended = FALSE;
450}
void plm_audio_rewind(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3285
void plm_video_rewind(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2185

References FALSE, FL_NOEXCEPT, plm_audio_rewind(), plm_demux_rewind(), and plm_video_rewind().

Referenced by plm_handle_end().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_seek()

int fl::third_party::plm_seek ( plm_t * self,
double time,
int seek_exact )

Definition at line 672 of file pl_mpeg.hpp.

672 {
673 plm_frame_t *frame = plm_seek_frame(self, time, seek_exact);
674
675 if (!frame) {
676 return FALSE;
677 }
678
679 if (self->video_decode_callback) {
681 }
682
683 // If audio is not enabled we are done here.
684 if (!self->audio_packet_type) {
685 return TRUE;
686 }
687
688 // Sync up Audio. This demuxes more packets until the first audio packet
689 // with a PTS greater than the current time is found. plm_decode() is then
690 // called to decode enough audio data to satisfy the audio_lead_time.
691
692 double start_time = plm_demux_get_start_time(self->demux, self->video_packet_type);
694
695 plm_packet_t *packet = NULL;
696 while ((packet = plm_demux_decode(self->demux))) {
697 if (packet->type == self->video_packet_type) {
698 plm_buffer_write(self->video_buffer, packet->data, packet->length);
699 }
700 else if (
701 packet->type == self->audio_packet_type &&
702 packet->pts - start_time > self->time
703 ) {
704 plm_audio_set_time(self->audio_decoder, packet->pts - start_time);
705 plm_buffer_write(self->audio_buffer, packet->data, packet->length);
706 plm_decode(self, 0);
707 break;
708 }
709 }
710
711 return TRUE;
712}
void plm_decode(plm_t *self, double seconds) FL_NOEXCEPT
Definition pl_mpeg.hpp:474
void plm_audio_set_time(plm_audio_t *self, double time) FL_NOEXCEPT
Definition pl_mpeg.hpp:3279
plm_frame_t * plm_seek_frame(plm_t *self, double time, int seek_exact) FL_NOEXCEPT
Definition pl_mpeg.hpp:617

References fl::third_party::plm_packet_t::data, FALSE, FL_NOEXCEPT, fl::third_party::plm_packet_t::length, NULL, plm_audio_rewind(), plm_audio_set_time(), plm_buffer_write(), plm_decode(), plm_demux_decode(), plm_demux_get_start_time(), plm_seek_frame(), fl::third_party::plm_packet_t::pts, fl::time(), TRUE, and fl::third_party::plm_packet_t::type.

+ Here is the call graph for this function:

◆ plm_seek_frame()

plm_frame_t * fl::third_party::plm_seek_frame ( plm_t * self,
double time,
int seek_exact )

Definition at line 617 of file pl_mpeg.hpp.

617 {
618 if (!plm_init_decoders(self)) {
619 return NULL;
620 }
621
622 if (!self->video_packet_type) {
623 return NULL;
624 }
625
626 int type = self->video_packet_type;
627
628 double start_time = plm_demux_get_start_time(self->demux, type);
629 double duration = plm_demux_get_duration(self->demux, type);
630
631 if (time < 0) {
632 time = 0;
633 }
634 else if (time > duration) {
635 time = duration;
636 }
637
638 plm_packet_t *packet = plm_demux_seek(self->demux, time, type, TRUE);
639 if (!packet) {
640 return NULL;
641 }
642
643 // Disable writing to the audio buffer while decoding video
644 int previous_audio_packet_type = self->audio_packet_type;
645 self->audio_packet_type = 0;
646
647 // Clear video buffer and decode the found packet
649 plm_video_set_time(self->video_decoder, packet->pts - start_time);
650 plm_buffer_write(self->video_buffer, packet->data, packet->length);
652
653 // If we want to seek to an exact frame, we have to decode all frames
654 // on top of the intra frame we just jumped to.
655 if (seek_exact) {
656 while (frame && frame->time < time) {
657 frame = plm_video_decode(self->video_decoder);
658 }
659 }
660
661 // Enable writing to the audio buffer again?
662 self->audio_packet_type = previous_audio_packet_type;
663
664 if (frame) {
665 self->time = frame->time;
666 }
667
668 self->has_ended = FALSE;
669 return frame;
670}
plm_packet_t * plm_demux_seek(plm_demux_t *self, double time, int type, int force_intra) FL_NOEXCEPT
Definition pl_mpeg.hpp:1374
void plm_video_set_time(plm_video_t *self, double time) FL_NOEXCEPT
Definition pl_mpeg.hpp:2180

References fl::third_party::plm_packet_t::data, FALSE, FL_NOEXCEPT, fl::third_party::plm_packet_t::length, NULL, plm_buffer_write(), plm_demux_get_duration(), plm_demux_get_start_time(), plm_demux_seek(), plm_init_decoders(), plm_video_decode(), plm_video_rewind(), plm_video_set_time(), fl::third_party::plm_packet_t::pts, fl::third_party::plm_frame_t::time, fl::time(), and TRUE.

Referenced by plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_set_audio_decode_callback()

void fl::third_party::plm_set_audio_decode_callback ( plm_t * self,
plm_audio_decode_callback fp,
void * user )

Definition at line 469 of file pl_mpeg.hpp.

469 {
470 self->audio_decode_callback = fp;
472}

References FL_NOEXCEPT.

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder(), and fl::third_party::SoftwareMpeg1Decoder::setAudioCallback().

+ Here is the caller graph for this function:

◆ plm_set_audio_enabled()

void fl::third_party::plm_set_audio_enabled ( plm_t * self,
int enabled )

Definition at line 344 of file pl_mpeg.hpp.

344 {
345 self->audio_enabled = enabled;
346
347 if (!enabled) {
348 self->audio_packet_type = 0;
349 return;
350 }
351
352 self->audio_packet_type = (plm_init_decoders(self) && self->audio_decoder)
354 : 0;
355}

References FL_NOEXCEPT, PLM_DEMUX_PACKET_AUDIO_1, and plm_init_decoders().

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder(), plm_set_audio_stream(), and fl::third_party::SoftwareMpeg1Decoder::setAudioCallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_set_audio_lead_time()

void fl::third_party::plm_set_audio_lead_time ( plm_t * self,
double lead_time )

Definition at line 426 of file pl_mpeg.hpp.

426 {
427 self->audio_lead_time = lead_time;
428}

References FL_NOEXCEPT.

◆ plm_set_audio_stream()

void fl::third_party::plm_set_audio_stream ( plm_t * self,
int stream_index )

Definition at line 357 of file pl_mpeg.hpp.

357 {
358 if (stream_index < 0 || stream_index > 3) {
359 return;
360 }
361 self->audio_stream_index = stream_index;
362
363 // Set the correct audio_packet_type
365}
void plm_set_audio_enabled(plm_t *self, int enabled) FL_NOEXCEPT
Definition pl_mpeg.hpp:344

References FL_NOEXCEPT, and plm_set_audio_enabled().

+ Here is the call graph for this function:

◆ plm_set_loop()

void fl::third_party::plm_set_loop ( plm_t * self,
int loop )

Definition at line 456 of file pl_mpeg.hpp.

456 {
457 self->loop = loop;
458}
void loop()

References FL_NOEXCEPT, and loop().

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_set_video_decode_callback()

void fl::third_party::plm_set_video_decode_callback ( plm_t * self,
plm_video_decode_callback fp,
void * user )

Definition at line 464 of file pl_mpeg.hpp.

464 {
465 self->video_decode_callback = fp;
467}

References FL_NOEXCEPT.

Referenced by fl::third_party::SoftwareMpeg1Decoder::initializeDecoder().

+ Here is the caller graph for this function:

◆ plm_set_video_enabled()

void fl::third_party::plm_set_video_enabled ( plm_t * self,
int enabled )

Definition at line 371 of file pl_mpeg.hpp.

371 {
372 self->video_enabled = enabled;
373
374 if (!enabled) {
375 self->video_packet_type = 0;
376 return;
377 }
378
379 self->video_packet_type = (plm_init_decoders(self) && self->video_decoder)
381 : 0;
382}

References FL_NOEXCEPT, PLM_DEMUX_PACKET_VIDEO_1, and plm_init_decoders().

+ Here is the call graph for this function:

◆ plm_video_copy_macroblock()

void fl::third_party::plm_video_copy_macroblock ( plm_video_t * self,
plm_frame_t * s,
int motion_h,
int motion_v )

Definition at line 2661 of file pl_mpeg.hpp.

2661 {
2662 plm_frame_t *d = &self->frame_current;
2663 plm_video_process_macroblock(self, s->y.data, d->y.data, motion_h, motion_v, 16, FALSE);
2664 plm_video_process_macroblock(self, s->cr.data, d->cr.data, motion_h / 2, motion_v / 2, 8, FALSE);
2665 plm_video_process_macroblock(self, s->cb.data, d->cb.data, motion_h / 2, motion_v / 2, 8, FALSE);
2666}
void plm_video_process_macroblock(plm_video_t *self, uint8_t *s, uint8_t *d, int mh, int mb, int bs, int interp) FL_NOEXCEPT
Definition pl_mpeg.hpp:2687

References fl::third_party::plm_frame_t::cb, fl::third_party::plm_frame_t::cr, fl::third_party::plm_plane_t::data, FALSE, FL_NOEXCEPT, plm_video_process_macroblock(), and fl::third_party::plm_frame_t::y.

Referenced by plm_video_predict_macroblock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_create_with_buffer()

plm_video_t * fl::third_party::plm_video_create_with_buffer ( plm_buffer_t * buffer,
int destroy_when_done )

Definition at line 2121 of file pl_mpeg.hpp.

2121 {
2122 plm_video_t *self = (plm_video_t *)PLM_MALLOC(sizeof(plm_video_t));
2123 fl::memset(self, 0, sizeof(plm_video_t));
2124
2125 self->buffer = buffer;
2126 self->destroy_buffer_when_done = destroy_when_done;
2127
2128 // Attempt to decode the sequence header
2130 if (self->start_code != -1) {
2132 }
2133 return self;
2134}
int plm_video_decode_sequence_header(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2282
static const int PLM_START_SEQUENCE
Definition pl_mpeg.hpp:1634

References fl::third_party::plm_video_t::buffer, fl::third_party::plm_video_t::destroy_buffer_when_done, FL_NOEXCEPT, fl::memset(), plm_buffer_find_start_code(), PLM_MALLOC, PLM_START_SEQUENCE, plm_video_decode_sequence_header(), and fl::third_party::plm_video_t::start_code.

Referenced by plm_init_decoders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode()

plm_frame_t * fl::third_party::plm_video_decode ( plm_video_t * self)

Definition at line 2197 of file pl_mpeg.hpp.

2197 {
2198 if (!plm_video_has_header(self)) {
2199 return NULL;
2200 }
2201
2202 plm_frame_t *frame = NULL;
2203 do {
2204 if (self->start_code != PLM_START_PICTURE) {
2206
2207 if (self->start_code == -1) {
2208 // If we reached the end of the file and the previously decoded
2209 // frame was a reference frame, we still have to return it.
2210 if (
2211 self->has_reference_frame &&
2212 !self->assume_no_b_frames &&
2213 plm_buffer_has_ended(self->buffer) && (
2216 )
2217 ) {
2218 self->has_reference_frame = FALSE;
2219 frame = &self->frame_backward;
2220 break;
2221 }
2222
2223 return NULL;
2224 }
2225 }
2226
2227 // Make sure we have a full picture in the buffer before attempting to
2228 // decode it. Sadly, this can only be done by seeking for the start code
2229 // of the next picture. Also, if we didn't find the start code for the
2230 // next picture, but the source has ended, we assume that this last
2231 // picture is in the buffer.
2232 if (
2235 ) {
2236 return NULL;
2237 }
2239
2241
2242 if (self->assume_no_b_frames) {
2243 frame = &self->frame_backward;
2244 }
2245 else if (self->picture_type == PLM_VIDEO_PICTURE_TYPE_B) {
2246 frame = &self->frame_current;
2247 }
2248 else if (self->has_reference_frame) {
2249 frame = &self->frame_forward;
2250 }
2251 else {
2252 self->has_reference_frame = TRUE;
2253 }
2254 } while (!frame);
2255
2256 frame->time = self->time;
2257 self->frames_decoded++;
2258 self->time = (double)self->frames_decoded / self->framerate;
2259
2260 return frame;
2261}
void plm_video_decode_picture(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2382
static const int PLM_VIDEO_PICTURE_TYPE_B
Definition pl_mpeg.hpp:1632
static const int PLM_VIDEO_PICTURE_TYPE_PREDICTIVE
Definition pl_mpeg.hpp:1631
int plm_buffer_has_start_code(plm_buffer_t *self, int code) FL_NOEXCEPT
Definition pl_mpeg.hpp:1089
static const int PLM_VIDEO_PICTURE_TYPE_INTRA
Definition pl_mpeg.hpp:1630
static const int PLM_START_PICTURE
Definition pl_mpeg.hpp:1637

References FALSE, FL_NOEXCEPT, NULL, plm_buffer_discard_read_bytes(), plm_buffer_find_start_code(), plm_buffer_has_ended(), plm_buffer_has_start_code(), PLM_START_PICTURE, plm_video_decode_picture(), plm_video_has_header(), PLM_VIDEO_PICTURE_TYPE_B, PLM_VIDEO_PICTURE_TYPE_INTRA, PLM_VIDEO_PICTURE_TYPE_PREDICTIVE, fl::third_party::plm_frame_t::time, and TRUE.

Referenced by plm_decode(), plm_decode_video(), and plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_block()

void fl::third_party::plm_video_decode_block ( plm_video_t * self,
int block )

Definition at line 2726 of file pl_mpeg.hpp.

2726 {
2727
2728 int n = 0;
2729 uint8_t *quant_matrix;
2730
2731 // Decode DC coefficient of intra-coded blocks
2732 if (self->macroblock_intra) {
2733 int predictor;
2734 int dct_size;
2735
2736 // DC prediction
2737 int plane_index = block > 3 ? block - 3 : 0;
2738 predictor = self->dc_predictor[plane_index];
2739 dct_size = plm_buffer_read_vlc(self->buffer, PLM_VIDEO_DCT_SIZE[plane_index]);
2740
2741 // Read DC coeff
2742 if (dct_size > 0) {
2743 int differential = plm_buffer_read(self->buffer, dct_size);
2744 if ((differential & (1 << (dct_size - 1))) != 0) {
2745 self->block_data[0] = predictor + differential;
2746 }
2747 else {
2748 self->block_data[0] = predictor + (-(1 << dct_size) | (differential + 1));
2749 }
2750 }
2751 else {
2752 self->block_data[0] = predictor;
2753 }
2754
2755 // Save predictor value
2756 self->dc_predictor[plane_index] = self->block_data[0];
2757
2758 // Dequantize + premultiply
2759 self->block_data[0] <<= (3 + 5);
2760
2761 quant_matrix = self->intra_quant_matrix;
2762 n = 1;
2763 }
2764 else {
2765 quant_matrix = self->non_intra_quant_matrix;
2766 }
2767
2768 // Decode AC coefficients (+DC for non-intra)
2769 int level = 0;
2770 while (TRUE) {
2771 int run = 0;
2773
2774 if ((coeff == 0x0001) && (n > 0) && (plm_buffer_read(self->buffer, 1) == 0)) {
2775 // end_of_block
2776 break;
2777 }
2778 if (coeff == 0xffff) {
2779 // escape
2780 run = plm_buffer_read(self->buffer, 6);
2781 level = plm_buffer_read(self->buffer, 8);
2782 if (level == 0) {
2783 level = plm_buffer_read(self->buffer, 8);
2784 }
2785 else if (level == 128) {
2786 level = plm_buffer_read(self->buffer, 8) - 256;
2787 }
2788 else if (level > 128) {
2789 level = level - 256;
2790 }
2791 }
2792 else {
2793 run = coeff >> 8;
2794 level = coeff & 0xff;
2795 if (plm_buffer_read(self->buffer, 1)) {
2796 level = -level;
2797 }
2798 }
2799
2800 n += run;
2801 if (n < 0 || n >= 64) {
2802 return; // invalid
2803 }
2804
2805 int de_zig_zagged = PLM_VIDEO_ZIG_ZAG[n];
2806 n++;
2807
2808 // Dequantize, oddify, clip
2809 level = (unsigned)level << 1;
2810 if (!self->macroblock_intra) {
2811 level += (level < 0 ? -1 : 1);
2812 }
2813 level = (level * self->quantizer_scale * quant_matrix[de_zig_zagged]) >> 4;
2814 if ((level & 1) == 0) {
2815 level -= level > 0 ? 1 : -1;
2816 }
2817 if (level > 2047) {
2818 level = 2047;
2819 }
2820 else if (level < -2048) {
2821 level = -2048;
2822 }
2823
2824 // Save premultiplied coefficient
2825 self->block_data[de_zig_zagged] = level * PLM_VIDEO_PREMULTIPLIER_MATRIX[de_zig_zagged];
2826 }
2827
2828 // Move block to its place
2829 uint8_t *d;
2830 int dw;
2831 int di;
2832
2833 if (block < 4) {
2834 d = self->frame_current.y.data;
2835 dw = self->luma_width;
2836 di = (self->mb_row * self->luma_width + self->mb_col) << 4;
2837 if ((block & 1) != 0) {
2838 di += 8;
2839 }
2840 if ((block & 2) != 0) {
2841 di += self->luma_width << 3;
2842 }
2843 }
2844 else {
2845 d = (block == 4) ? self->frame_current.cb.data : self->frame_current.cr.data;
2846 dw = self->chroma_width;
2847 di = ((self->mb_row * self->luma_width) << 2) + (self->mb_col << 3);
2848 }
2849
2850 int *s = self->block_data;
2851 int si = 0;
2852 if (self->macroblock_intra) {
2853 // Overwrite (no prediction)
2854 if (n == 1) {
2855 int clamped = plm_clamp((s[0] + 128) >> 8);
2856 PLM_BLOCK_SET(d, di, dw, si, 8, 8, clamped);
2857 s[0] = 0;
2858 }
2859 else {
2860 plm_video_idct(s);
2861 PLM_BLOCK_SET(d, di, dw, si, 8, 8, plm_clamp(s[si]));
2862 fl::memset(self->block_data, 0, sizeof(self->block_data));
2863 }
2864 }
2865 else {
2866 // Add data to the predicted macroblock
2867 if (n == 1) {
2868 int value = (s[0] + 128) >> 8;
2869 PLM_BLOCK_SET(d, di, dw, si, 8, 8, plm_clamp(d[di] + value));
2870 s[0] = 0;
2871 }
2872 else {
2873 plm_video_idct(s);
2874 PLM_BLOCK_SET(d, di, dw, si, 8, 8, plm_clamp(d[di] + s[si]));
2875 fl::memset(self->block_data, 0, sizeof(self->block_data));
2876 }
2877 }
2878}
void run(fl::u32 microseconds, ExecFlags flags)
Run selected task subsystems.
static const uint8_t PLM_VIDEO_PREMULTIPLIER_MATRIX[]
Definition pl_mpeg.hpp:1690
static const plm_vlc_uint_t PLM_VIDEO_DCT_COEFF[]
Definition pl_mpeg.hpp:1920
static uint8_t plm_clamp(int n) FL_NOEXCEPT
Definition pl_mpeg.hpp:2097
static const plm_vlc_t * PLM_VIDEO_DCT_SIZE[]
Definition pl_mpeg.hpp:1907
uint16_t plm_buffer_read_vlc_uint(plm_buffer_t *self, const plm_vlc_uint_t *table) FL_NOEXCEPT
Definition pl_mpeg.hpp:1119
static const uint8_t PLM_VIDEO_ZIG_ZAG[]
Definition pl_mpeg.hpp:1657
void plm_video_idct(int *block) FL_NOEXCEPT
Definition pl_mpeg.hpp:2880
#define PLM_BLOCK_SET(DEST, DEST_INDEX, DEST_WIDTH, SOURCE_INDEX, SOURCE_WIDTH, BLOCK_SIZE, OP)
Definition pl_mpeg.hpp:2675

References FL_NOEXCEPT, fl::memset(), PLM_BLOCK_SET, plm_buffer_read(), plm_buffer_read_vlc(), plm_buffer_read_vlc_uint(), plm_clamp(), PLM_VIDEO_DCT_COEFF, PLM_VIDEO_DCT_SIZE, plm_video_idct(), PLM_VIDEO_PREMULTIPLIER_MATRIX, PLM_VIDEO_ZIG_ZAG, TRUE, and fl::type_rank< T >::value.

Referenced by plm_video_decode_macroblock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_macroblock()

void fl::third_party::plm_video_decode_macroblock ( plm_video_t * self)

Definition at line 2479 of file pl_mpeg.hpp.

2479 {
2480 // Decode increment
2481 int increment = 0;
2483
2484 while (t == 34) {
2485 // macroblock_stuffing
2487 }
2488 while (t == 35) {
2489 // macroblock_escape
2490 increment += 33;
2492 }
2493 increment += t;
2494
2495 // Process any skipped macroblocks
2496 if (self->slice_begin) {
2497 // The first increment of each slice is relative to beginning of the
2498 // previous row, not the previous macroblock
2499 self->slice_begin = FALSE;
2500 self->macroblock_address += increment;
2501 }
2502 else {
2503 if (self->macroblock_address + increment >= self->mb_size) {
2504 return; // invalid
2505 }
2506 if (increment > 1) {
2507 // Skipped macroblocks reset DC predictors
2508 self->dc_predictor[0] = 128;
2509 self->dc_predictor[1] = 128;
2510 self->dc_predictor[2] = 128;
2511
2512 // Skipped macroblocks in P-pictures reset motion vectors
2514 self->motion_forward.h = 0;
2515 self->motion_forward.v = 0;
2516 }
2517 }
2518
2519 // Predict skipped macroblocks
2520 while (increment > 1) {
2521 self->macroblock_address++;
2522 self->mb_row = self->macroblock_address / self->mb_width;
2523 self->mb_col = self->macroblock_address % self->mb_width;
2524
2526 increment--;
2527 }
2528 self->macroblock_address++;
2529 }
2530
2531 self->mb_row = self->macroblock_address / self->mb_width;
2532 self->mb_col = self->macroblock_address % self->mb_width;
2533
2534 if (self->mb_col >= self->mb_width || self->mb_row >= self->mb_height) {
2535 return; // corrupt stream;
2536 }
2537
2538 // Process the current macroblock
2539 const plm_vlc_t *table = PLM_VIDEO_MACROBLOCK_TYPE[self->picture_type];
2540 self->macroblock_type = plm_buffer_read_vlc(self->buffer, table);
2541
2542 self->macroblock_intra = (self->macroblock_type & 0x01);
2543 self->motion_forward.is_set = (self->macroblock_type & 0x08);
2544 self->motion_backward.is_set = (self->macroblock_type & 0x04);
2545
2546 // Quantizer scale
2547 if ((self->macroblock_type & 0x10) != 0) {
2548 self->quantizer_scale = plm_buffer_read(self->buffer, 5);
2549 }
2550
2551 if (self->macroblock_intra) {
2552 // Intra-coded macroblocks reset motion vectors
2553 self->motion_backward.h = self->motion_forward.h = 0;
2554 self->motion_backward.v = self->motion_forward.v = 0;
2555 }
2556 else {
2557 // Non-intra macroblocks reset DC predictors
2558 self->dc_predictor[0] = 128;
2559 self->dc_predictor[1] = 128;
2560 self->dc_predictor[2] = 128;
2561
2564 }
2565
2566 // Decode blocks
2567 int cbp = ((self->macroblock_type & 0x02) != 0)
2569 : (self->macroblock_intra ? 0x3f : 0);
2570
2571 for (int block = 0, mask = 0x20; block < 6; block++) {
2572 if ((cbp & mask) != 0) {
2573 plm_video_decode_block(self, block);
2574 }
2575 mask >>= 1;
2576 }
2577}
static uint32_t t
Definition Luminova.h:55
static const plm_vlc_t PLM_VIDEO_CODE_BLOCK_PATTERN[]
Definition pl_mpeg.hpp:1780
void plm_video_predict_macroblock(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2628
void plm_video_decode_block(plm_video_t *self, int block) FL_NOEXCEPT
Definition pl_mpeg.hpp:2726
static const plm_vlc_t * PLM_VIDEO_MACROBLOCK_TYPE[]
Definition pl_mpeg.hpp:1773
void plm_video_decode_motion_vectors(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2579
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_ADDRESS_INCREMENT[]
Definition pl_mpeg.hpp:1701
plm_video_motion_t motion_backward
Definition pl_mpeg.hpp:2064
plm_video_motion_t motion_forward
Definition pl_mpeg.hpp:2063

References FALSE, FL_NOEXCEPT, plm_buffer_read(), plm_buffer_read_vlc(), PLM_VIDEO_CODE_BLOCK_PATTERN, plm_video_decode_block(), plm_video_decode_motion_vectors(), PLM_VIDEO_MACROBLOCK_ADDRESS_INCREMENT, PLM_VIDEO_MACROBLOCK_TYPE, PLM_VIDEO_PICTURE_TYPE_PREDICTIVE, plm_video_predict_macroblock(), and fl::t.

Referenced by plm_video_decode_slice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_motion_vector()

int fl::third_party::plm_video_decode_motion_vector ( plm_video_t * self,
int r_size,
int motion )

Definition at line 2600 of file pl_mpeg.hpp.

2600 {
2601 int fscale = 1 << r_size;
2602 int m_code = plm_buffer_read_vlc(self->buffer, PLM_VIDEO_MOTION);
2603 int r = 0;
2604 int d;
2605
2606 if ((m_code != 0) && (fscale != 1)) {
2607 r = plm_buffer_read(self->buffer, r_size);
2608 d = ((fl::abs(m_code) - 1) << r_size) + r + 1;
2609 if (m_code < 0) {
2610 d = -d;
2611 }
2612 }
2613 else {
2614 d = m_code;
2615 }
2616
2617 motion += d;
2618 if (motion > (fscale << 4) - 1) {
2619 motion -= fscale << 5;
2620 }
2621 else if (motion < (int)((unsigned)(-fscale) << 4)) {
2622 motion += fscale << 5;
2623 }
2624
2625 return motion;
2626}
static const plm_vlc_t PLM_VIDEO_MOTION[]
Definition pl_mpeg.hpp:1846
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT

References fl::abs(), FL_NOEXCEPT, plm_buffer_read(), plm_buffer_read_vlc(), and PLM_VIDEO_MOTION.

Referenced by plm_video_decode_motion_vectors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_motion_vectors()

void fl::third_party::plm_video_decode_motion_vectors ( plm_video_t * self)

Definition at line 2579 of file pl_mpeg.hpp.

2579 {
2580
2581 // Forward
2582 if (self->motion_forward.is_set) {
2583 int r_size = self->motion_forward.r_size;
2584 self->motion_forward.h = plm_video_decode_motion_vector(self, r_size, self->motion_forward.h);
2585 self->motion_forward.v = plm_video_decode_motion_vector(self, r_size, self->motion_forward.v);
2586 }
2588 // No motion information in P-picture, reset vectors
2589 self->motion_forward.h = 0;
2590 self->motion_forward.v = 0;
2591 }
2592
2593 if (self->motion_backward.is_set) {
2594 int r_size = self->motion_backward.r_size;
2597 }
2598}
int plm_video_decode_motion_vector(plm_video_t *self, int r_size, int motion) FL_NOEXCEPT
Definition pl_mpeg.hpp:2600

References FL_NOEXCEPT, plm_video_decode_motion_vector(), and PLM_VIDEO_PICTURE_TYPE_PREDICTIVE.

Referenced by plm_video_decode_macroblock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_picture()

void fl::third_party::plm_video_decode_picture ( plm_video_t * self)

Definition at line 2382 of file pl_mpeg.hpp.

2382 {
2383 plm_buffer_skip(self->buffer, 10); // skip temporalReference
2384 self->picture_type = plm_buffer_read(self->buffer, 3);
2385 plm_buffer_skip(self->buffer, 16); // skip vbv_delay
2386
2387 // D frames or unknown coding type
2388 if (self->picture_type <= 0 || self->picture_type > PLM_VIDEO_PICTURE_TYPE_B) {
2389 return;
2390 }
2391
2392 // Forward full_px, f_code
2393 if (
2396 ) {
2397 self->motion_forward.full_px = plm_buffer_read(self->buffer, 1);
2398 int f_code = plm_buffer_read(self->buffer, 3);
2399 if (f_code == 0) {
2400 // Ignore picture with zero f_code
2401 return;
2402 }
2403 self->motion_forward.r_size = f_code - 1;
2404 }
2405
2406 // Backward full_px, f_code
2409 int f_code = plm_buffer_read(self->buffer, 3);
2410 if (f_code == 0) {
2411 // Ignore picture with zero f_code
2412 return;
2413 }
2414 self->motion_backward.r_size = f_code - 1;
2415 }
2416
2417 plm_frame_t frame_temp = self->frame_forward;
2418 if (
2421 ) {
2422 self->frame_forward = self->frame_backward;
2423 }
2424
2425
2426 // Find first slice start code; skip extension and user data
2427 do {
2429 } while (
2430 self->start_code == PLM_START_EXTENSION ||
2432 );
2433
2434 // Decode all slices
2435 while (PLM_START_IS_SLICE(self->start_code)) {
2436 plm_video_decode_slice(self, self->start_code & 0x000000FF);
2437 if (self->macroblock_address >= self->mb_size - 2) {
2438 break;
2439 }
2441 }
2442
2443 // If this is a reference picture rotate the prediction pointers
2444 if (
2447 ) {
2448 self->frame_backward = self->frame_current;
2449 self->frame_current = frame_temp;
2450 }
2451}
static const int PLM_START_USER_DATA
Definition pl_mpeg.hpp:1639
void plm_video_decode_slice(plm_video_t *self, int slice) FL_NOEXCEPT
Definition pl_mpeg.hpp:2453
static const int PLM_START_EXTENSION
Definition pl_mpeg.hpp:1638
#define PLM_START_IS_SLICE(c)
Definition pl_mpeg.hpp:1641

References FL_NOEXCEPT, plm_buffer_next_start_code(), plm_buffer_read(), plm_buffer_skip(), PLM_START_EXTENSION, PLM_START_IS_SLICE, PLM_START_USER_DATA, plm_video_decode_slice(), PLM_VIDEO_PICTURE_TYPE_B, PLM_VIDEO_PICTURE_TYPE_INTRA, and PLM_VIDEO_PICTURE_TYPE_PREDICTIVE.

Referenced by plm_video_decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_sequence_header()

int fl::third_party::plm_video_decode_sequence_header ( plm_video_t * self)

Definition at line 2282 of file pl_mpeg.hpp.

2282 {
2283 int max_header_size = 64 + 2 * 64 * 8; // 64 bit header + 2x 64 byte matrix
2284 if (!plm_buffer_has(self->buffer, max_header_size)) {
2285 return FALSE;
2286 }
2287
2288 self->width = plm_buffer_read(self->buffer, 12);
2289 self->height = plm_buffer_read(self->buffer, 12);
2290
2291 if (self->width <= 0 || self->height <= 0) {
2292 return FALSE;
2293 }
2294
2295 // Get pixel aspect ratio
2296 int pixel_aspect_ratio_code;
2297 pixel_aspect_ratio_code = plm_buffer_read(self->buffer, 4);
2298 pixel_aspect_ratio_code -= 1;
2299 if (pixel_aspect_ratio_code < 0) {
2300 pixel_aspect_ratio_code = 0;
2301 }
2302 int par_last = (sizeof(PLM_VIDEO_PIXEL_ASPECT_RATIO) /
2303 sizeof(PLM_VIDEO_PIXEL_ASPECT_RATIO[0]) - 1);
2304 if (pixel_aspect_ratio_code > par_last) {
2305 pixel_aspect_ratio_code = par_last;
2306 }
2307 self->pixel_aspect_ratio =
2308 PLM_VIDEO_PIXEL_ASPECT_RATIO[pixel_aspect_ratio_code];
2309
2310 // Get frame rate
2312
2313 // Skip bit_rate, marker, buffer_size and constrained bit
2314 plm_buffer_skip(self->buffer, 18 + 1 + 10 + 1);
2315
2316 // Load custom intra quant matrix?
2317 if (plm_buffer_read(self->buffer, 1)) {
2318 for (int i = 0; i < 64; i++) {
2319 int idx = PLM_VIDEO_ZIG_ZAG[i];
2320 self->intra_quant_matrix[idx] = plm_buffer_read(self->buffer, 8);
2321 }
2322 }
2323 else {
2325 }
2326
2327 // Load custom non intra quant matrix?
2328 if (plm_buffer_read(self->buffer, 1)) {
2329 for (int i = 0; i < 64; i++) {
2330 int idx = PLM_VIDEO_ZIG_ZAG[i];
2331 self->non_intra_quant_matrix[idx] = plm_buffer_read(self->buffer, 8);
2332 }
2333 }
2334 else {
2336 }
2337
2338 self->mb_width = (self->width + 15) >> 4;
2339 self->mb_height = (self->height + 15) >> 4;
2340 self->mb_size = self->mb_width * self->mb_height;
2341
2342 self->luma_width = self->mb_width << 4;
2343 self->luma_height = self->mb_height << 4;
2344
2345 self->chroma_width = self->mb_width << 3;
2346 self->chroma_height = self->mb_height << 3;
2347
2348
2349 // Allocate one big chunk of data for all 3 frames = 9 planes
2350 size_t luma_plane_size = self->luma_width * self->luma_height;
2351 size_t chroma_plane_size = self->chroma_width * self->chroma_height;
2352 size_t frame_data_size = (luma_plane_size + 2 * chroma_plane_size);
2353
2354 self->frames_data = (uint8_t*)PLM_MALLOC(frame_data_size * 3);
2355 plm_video_init_frame(self, &self->frame_current, self->frames_data + frame_data_size * 0);
2356 plm_video_init_frame(self, &self->frame_forward, self->frames_data + frame_data_size * 1);
2357 plm_video_init_frame(self, &self->frame_backward, self->frames_data + frame_data_size * 2);
2358
2359 self->has_sequence_header = TRUE;
2360 return TRUE;
2361}
static const float PLM_VIDEO_PIXEL_ASPECT_RATIO[]
Definition pl_mpeg.hpp:1644
void plm_video_init_frame(plm_video_t *self, plm_frame_t *frame, uint8_t *base) FL_NOEXCEPT
Definition pl_mpeg.hpp:2363
static const uint8_t PLM_VIDEO_NON_INTRA_QUANT_MATRIX[]
Definition pl_mpeg.hpp:1679
static const double PLM_VIDEO_PICTURE_RATE[]
Definition pl_mpeg.hpp:1652
static const uint8_t PLM_VIDEO_INTRA_QUANT_MATRIX[]
Definition pl_mpeg.hpp:1668

References FALSE, FL_NOEXCEPT, fl::memcopy(), plm_buffer_has(), plm_buffer_read(), plm_buffer_skip(), PLM_MALLOC, plm_video_init_frame(), PLM_VIDEO_INTRA_QUANT_MATRIX, PLM_VIDEO_NON_INTRA_QUANT_MATRIX, PLM_VIDEO_PICTURE_RATE, PLM_VIDEO_PIXEL_ASPECT_RATIO, PLM_VIDEO_ZIG_ZAG, and TRUE.

Referenced by plm_video_create_with_buffer(), and plm_video_has_header().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_decode_slice()

void fl::third_party::plm_video_decode_slice ( plm_video_t * self,
int slice )

Definition at line 2453 of file pl_mpeg.hpp.

2453 {
2454 self->slice_begin = TRUE;
2455 self->macroblock_address = (slice - 1) * self->mb_width - 1;
2456
2457 // Reset motion vectors and DC predictors
2458 self->motion_backward.h = self->motion_forward.h = 0;
2459 self->motion_backward.v = self->motion_forward.v = 0;
2460 self->dc_predictor[0] = 128;
2461 self->dc_predictor[1] = 128;
2462 self->dc_predictor[2] = 128;
2463
2464 self->quantizer_scale = plm_buffer_read(self->buffer, 5);
2465
2466 // Skip extra
2467 while (plm_buffer_read(self->buffer, 1)) {
2468 plm_buffer_skip(self->buffer, 8);
2469 }
2470
2471 do {
2473 } while (
2474 self->macroblock_address < self->mb_size - 1 &&
2476 );
2477}
int plm_buffer_peek_non_zero(plm_buffer_t *self, int bit_count) FL_NOEXCEPT
Definition pl_mpeg.hpp:1101
void plm_video_decode_macroblock(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2479

References FL_NOEXCEPT, plm_buffer_peek_non_zero(), plm_buffer_read(), plm_buffer_skip(), plm_video_decode_macroblock(), and TRUE.

Referenced by plm_video_decode_picture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_destroy()

void fl::third_party::plm_video_destroy ( plm_video_t * self)

Definition at line 2136 of file pl_mpeg.hpp.

2136 {
2137 if (self->destroy_buffer_when_done) {
2139 }
2140
2141 if (self->has_sequence_header) {
2142 PLM_FREE(self->frames_data);
2143 }
2144
2145 PLM_FREE(self);
2146}

References FL_NOEXCEPT, plm_buffer_destroy(), and PLM_FREE.

Referenced by plm_destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_get_framerate()

double fl::third_party::plm_video_get_framerate ( plm_video_t * self)

Definition at line 2148 of file pl_mpeg.hpp.

2148 {
2149 return plm_video_has_header(self)
2150 ? self->framerate
2151 : 0;
2152}

References FL_NOEXCEPT, and plm_video_has_header().

Referenced by plm_get_framerate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_get_height()

int fl::third_party::plm_video_get_height ( plm_video_t * self)

Definition at line 2166 of file pl_mpeg.hpp.

2166 {
2167 return plm_video_has_header(self)
2168 ? self->height
2169 : 0;
2170}

References FL_NOEXCEPT, and plm_video_has_header().

Referenced by plm_get_height().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_get_pixel_aspect_ratio()

double fl::third_party::plm_video_get_pixel_aspect_ratio ( plm_video_t * self)

Definition at line 2154 of file pl_mpeg.hpp.

2154 {
2155 return plm_video_has_header(self)
2156 ? self->pixel_aspect_ratio
2157 : 0;
2158}

References FL_NOEXCEPT, and plm_video_has_header().

Referenced by plm_get_pixel_aspect_ratio().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_get_time()

double fl::third_party::plm_video_get_time ( plm_video_t * self)

Definition at line 2176 of file pl_mpeg.hpp.

2176 {
2177 return self->time;
2178}

References FL_NOEXCEPT.

Referenced by plm_decode().

+ Here is the caller graph for this function:

◆ plm_video_get_width()

int fl::third_party::plm_video_get_width ( plm_video_t * self)

Definition at line 2160 of file pl_mpeg.hpp.

2160 {
2161 return plm_video_has_header(self)
2162 ? self->width
2163 : 0;
2164}

References FL_NOEXCEPT, and plm_video_has_header().

Referenced by plm_get_width().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_has_ended()

int fl::third_party::plm_video_has_ended ( plm_video_t * self)

Definition at line 2193 of file pl_mpeg.hpp.

2193 {
2194 return plm_buffer_has_ended(self->buffer);
2195}

References FL_NOEXCEPT, and plm_buffer_has_ended().

+ Here is the call graph for this function:

◆ plm_video_has_header()

int fl::third_party::plm_video_has_header ( plm_video_t * self)

Definition at line 2263 of file pl_mpeg.hpp.

2263 {
2264 if (self->has_sequence_header) {
2265 return TRUE;
2266 }
2267
2268 if (self->start_code != PLM_START_SEQUENCE) {
2270 }
2271 if (self->start_code == -1) {
2272 return FALSE;
2273 }
2274
2276 return FALSE;
2277 }
2278
2279 return TRUE;
2280}

References FALSE, FL_NOEXCEPT, plm_buffer_find_start_code(), PLM_START_SEQUENCE, plm_video_decode_sequence_header(), and TRUE.

Referenced by plm_has_headers(), plm_video_decode(), plm_video_get_framerate(), plm_video_get_height(), plm_video_get_pixel_aspect_ratio(), and plm_video_get_width().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_idct()

void fl::third_party::plm_video_idct ( int * block)

Definition at line 2880 of file pl_mpeg.hpp.

2880 {
2881 int
2882 b1, b3, b4, b6, b7, tmp1, tmp2, m0,
2883 x0, x1, x2, x3, x4, y3, y4, y5, y6, y7;
2884
2885 // Transform columns
2886 for (int i = 0; i < 8; ++i) {
2887 b1 = block[4 * 8 + i];
2888 b3 = block[2 * 8 + i] + block[6 * 8 + i];
2889 b4 = block[5 * 8 + i] - block[3 * 8 + i];
2890 tmp1 = block[1 * 8 + i] + block[7 * 8 + i];
2891 tmp2 = block[3 * 8 + i] + block[5 * 8 + i];
2892 b6 = block[1 * 8 + i] - block[7 * 8 + i];
2893 b7 = tmp1 + tmp2;
2894 m0 = block[0 * 8 + i];
2895 x4 = ((b6 * 473 - b4 * 196 + 128) >> 8) - b7;
2896 x0 = x4 - (((tmp1 - tmp2) * 362 + 128) >> 8);
2897 x1 = m0 - b1;
2898 x2 = (((block[2 * 8 + i] - block[6 * 8 + i]) * 362 + 128) >> 8) - b3;
2899 x3 = m0 + b1;
2900 y3 = x1 + x2;
2901 y4 = x3 + b3;
2902 y5 = x1 - x2;
2903 y6 = x3 - b3;
2904 y7 = -x0 - ((b4 * 473 + b6 * 196 + 128) >> 8);
2905 block[0 * 8 + i] = b7 + y4;
2906 block[1 * 8 + i] = x4 + y3;
2907 block[2 * 8 + i] = y5 - x0;
2908 block[3 * 8 + i] = y6 - y7;
2909 block[4 * 8 + i] = y6 + y7;
2910 block[5 * 8 + i] = x0 + y5;
2911 block[6 * 8 + i] = y3 - x4;
2912 block[7 * 8 + i] = y4 - b7;
2913 }
2914
2915 // Transform rows
2916 for (int i = 0; i < 64; i += 8) {
2917 b1 = block[4 + i];
2918 b3 = block[2 + i] + block[6 + i];
2919 b4 = block[5 + i] - block[3 + i];
2920 tmp1 = block[1 + i] + block[7 + i];
2921 tmp2 = block[3 + i] + block[5 + i];
2922 b6 = block[1 + i] - block[7 + i];
2923 b7 = tmp1 + tmp2;
2924 m0 = block[0 + i];
2925 x4 = ((b6 * 473 - b4 * 196 + 128) >> 8) - b7;
2926 x0 = x4 - (((tmp1 - tmp2) * 362 + 128) >> 8);
2927 x1 = m0 - b1;
2928 x2 = (((block[2 + i] - block[6 + i]) * 362 + 128) >> 8) - b3;
2929 x3 = m0 + b1;
2930 y3 = x1 + x2;
2931 y4 = x3 + b3;
2932 y5 = x1 - x2;
2933 y6 = x3 - b3;
2934 y7 = -x0 - ((b4 * 473 + b6 * 196 + 128) >> 8);
2935 block[0 + i] = (b7 + y4 + 128) >> 8;
2936 block[1 + i] = (x4 + y3 + 128) >> 8;
2937 block[2 + i] = (y5 - x0 + 128) >> 8;
2938 block[3 + i] = (y6 - y7 + 128) >> 8;
2939 block[4 + i] = (y6 + y7 + 128) >> 8;
2940 block[5 + i] = (x0 + y5 + 128) >> 8;
2941 block[6 + i] = (y3 - x4 + 128) >> 8;
2942 block[7 + i] = (y4 - b7 + 128) >> 8;
2943 }
2944}

References FL_NOEXCEPT.

Referenced by plm_video_decode_block().

+ Here is the caller graph for this function:

◆ plm_video_init_frame()

void fl::third_party::plm_video_init_frame ( plm_video_t * self,
plm_frame_t * frame,
uint8_t * base )

Definition at line 2363 of file pl_mpeg.hpp.

2363 {
2364 size_t luma_plane_size = self->luma_width * self->luma_height;
2365 size_t chroma_plane_size = self->chroma_width * self->chroma_height;
2366
2367 frame->width = self->width;
2368 frame->height = self->height;
2369 frame->y.width = self->luma_width;
2370 frame->y.height = self->luma_height;
2371 frame->y.data = base;
2372
2373 frame->cr.width = self->chroma_width;
2374 frame->cr.height = self->chroma_height;
2375 frame->cr.data = base + luma_plane_size;
2376
2377 frame->cb.width = self->chroma_width;
2378 frame->cb.height = self->chroma_height;
2379 frame->cb.data = base + luma_plane_size + chroma_plane_size;
2380}

References FL_NOEXCEPT.

Referenced by plm_video_decode_sequence_header().

+ Here is the caller graph for this function:

◆ plm_video_interpolate_macroblock()

void fl::third_party::plm_video_interpolate_macroblock ( plm_video_t * self,
plm_frame_t * s,
int motion_h,
int motion_v )

Definition at line 2668 of file pl_mpeg.hpp.

2668 {
2669 plm_frame_t *d = &self->frame_current;
2670 plm_video_process_macroblock(self, s->y.data, d->y.data, motion_h, motion_v, 16, TRUE);
2671 plm_video_process_macroblock(self, s->cr.data, d->cr.data, motion_h / 2, motion_v / 2, 8, TRUE);
2672 plm_video_process_macroblock(self, s->cb.data, d->cb.data, motion_h / 2, motion_v / 2, 8, TRUE);
2673}

References fl::third_party::plm_frame_t::cb, fl::third_party::plm_frame_t::cr, fl::third_party::plm_plane_t::data, FL_NOEXCEPT, plm_video_process_macroblock(), TRUE, and fl::third_party::plm_frame_t::y.

Referenced by plm_video_predict_macroblock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_predict_macroblock()

void fl::third_party::plm_video_predict_macroblock ( plm_video_t * self)

Definition at line 2628 of file pl_mpeg.hpp.

2628 {
2629 int fw_h = self->motion_forward.h;
2630 int fw_v = self->motion_forward.v;
2631
2632 if (self->motion_forward.full_px) {
2633 fw_h <<= 1;
2634 fw_v <<= 1;
2635 }
2636
2638 int bw_h = self->motion_backward.h;
2639 int bw_v = self->motion_backward.v;
2640
2641 if (self->motion_backward.full_px) {
2642 bw_h <<= 1;
2643 bw_v <<= 1;
2644 }
2645
2646 if (self->motion_forward.is_set) {
2647 plm_video_copy_macroblock(self, &self->frame_forward, fw_h, fw_v);
2648 if (self->motion_backward.is_set) {
2649 plm_video_interpolate_macroblock(self, &self->frame_backward, bw_h, bw_v);
2650 }
2651 }
2652 else {
2653 plm_video_copy_macroblock(self, &self->frame_backward, bw_h, bw_v);
2654 }
2655 }
2656 else {
2657 plm_video_copy_macroblock(self, &self->frame_forward, fw_h, fw_v);
2658 }
2659}
void plm_video_copy_macroblock(plm_video_t *self, plm_frame_t *s, int motion_h, int motion_v) FL_NOEXCEPT
Definition pl_mpeg.hpp:2661
void plm_video_interpolate_macroblock(plm_video_t *self, plm_frame_t *s, int motion_h, int motion_v) FL_NOEXCEPT
Definition pl_mpeg.hpp:2668

References FL_NOEXCEPT, plm_video_copy_macroblock(), plm_video_interpolate_macroblock(), and PLM_VIDEO_PICTURE_TYPE_B.

Referenced by plm_video_decode_macroblock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_process_macroblock()

void fl::third_party::plm_video_process_macroblock ( plm_video_t * self,
uint8_t * s,
uint8_t * d,
int mh,
int mb,
int bs,
int interp )

Definition at line 2687 of file pl_mpeg.hpp.

2690 {
2691 int dw = self->mb_width * block_size;
2692
2693 int hp = motion_h >> 1;
2694 int vp = motion_v >> 1;
2695 int odd_h = (motion_h & 1) == 1;
2696 int odd_v = (motion_v & 1) == 1;
2697
2698 unsigned int si = ((self->mb_row * block_size) + vp) * dw + (self->mb_col * block_size) + hp;
2699 unsigned int di = (self->mb_row * dw + self->mb_col) * block_size;
2700
2701 unsigned int max_address = (dw * (self->mb_height * block_size - block_size + 1) - block_size);
2702 if (si > max_address || di > max_address) {
2703 return; // corrupt video
2704 }
2705
2706 #define PLM_MB_CASE(INTERPOLATE, ODD_H, ODD_V, OP) \
2707 case ((INTERPOLATE << 2) | (ODD_H << 1) | (ODD_V)): \
2708 PLM_BLOCK_SET(d, di, dw, si, dw, block_size, OP); \
2709 break
2710
2711 switch ((interpolate << 2) | (odd_h << 1) | (odd_v)) {
2712 PLM_MB_CASE(0, 0, 0, (s[si]));
2713 PLM_MB_CASE(0, 0, 1, (s[si] + s[si + dw] + 1) >> 1);
2714 PLM_MB_CASE(0, 1, 0, (s[si] + s[si + 1] + 1) >> 1);
2715 PLM_MB_CASE(0, 1, 1, (s[si] + s[si + 1] + s[si + dw] + s[si + dw + 1] + 2) >> 2);
2716
2717 PLM_MB_CASE(1, 0, 0, (d[di] + (s[si]) + 1) >> 1);
2718 PLM_MB_CASE(1, 0, 1, (d[di] + ((s[si] + s[si + dw] + 1) >> 1) + 1) >> 1);
2719 PLM_MB_CASE(1, 1, 0, (d[di] + ((s[si] + s[si + 1] + 1) >> 1) + 1) >> 1);
2720 PLM_MB_CASE(1, 1, 1, (d[di] + ((s[si] + s[si + 1] + s[si + dw] + s[si + dw + 1] + 2) >> 2) + 1) >> 1);
2721 }
2722
2723 #undef PLM_MB_CASE
2724}
#define PLM_MB_CASE(INTERPOLATE, ODD_H, ODD_V, OP)

References FL_NOEXCEPT, and PLM_MB_CASE.

Referenced by plm_video_copy_macroblock(), and plm_video_interpolate_macroblock().

+ Here is the caller graph for this function:

◆ plm_video_rewind()

void fl::third_party::plm_video_rewind ( plm_video_t * self)

Definition at line 2185 of file pl_mpeg.hpp.

2185 {
2187 self->time = 0;
2188 self->frames_decoded = 0;
2189 self->has_reference_frame = FALSE;
2190 self->start_code = -1;
2191}

References FALSE, FL_NOEXCEPT, and plm_buffer_rewind().

Referenced by plm_rewind(), and plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plm_video_set_no_delay()

void fl::third_party::plm_video_set_no_delay ( plm_video_t * self,
int no_delay )

Definition at line 2172 of file pl_mpeg.hpp.

2172 {
2173 self->assume_no_b_frames = no_delay;
2174}

References FL_NOEXCEPT.

◆ plm_video_set_time()

void fl::third_party::plm_video_set_time ( plm_video_t * self,
double time )

Definition at line 2180 of file pl_mpeg.hpp.

2180 {
2181 self->frames_decoded = self->framerate * time;
2182 self->time = time;
2183}

References FL_NOEXCEPT, and fl::time().

Referenced by plm_seek_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PolyphaseMono()

void fl::third_party::PolyphaseMono ( short * pcm,
int32_t * vbuf,
const int32_t * coefBase )

Definition at line 130 of file polyphase.hpp.

131{
132 int i;
133 const int32_t *coef;
134 int32_t *vb1;
135 int vLo, vHi, c1, c2;
136 Word64 sum1L, sum2L, rndVal;
137
138 rndVal = (Word64)( (i64)1 << (DEF_NFRACBITS - 1 + (32 - CSHIFT)) );
139
140 /* special case, output sample 0 */
141 coef = coefBase;
142 vb1 = vbuf;
143 sum1L = rndVal;
144
145 MC0M(0)
146 MC0M(1)
147 MC0M(2)
148 MC0M(3)
149 MC0M(4)
150 MC0M(5)
151 MC0M(6)
152 MC0M(7)
153
154 *(pcm + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
155
156 /* special case, output sample 16 */
157 coef = coefBase + 256;
158 vb1 = vbuf + 64*16;
159 sum1L = rndVal;
160
161 MC1M(0)
162 MC1M(1)
163 MC1M(2)
164 MC1M(3)
165 MC1M(4)
166 MC1M(5)
167 MC1M(6)
168 MC1M(7)
169
170 *(pcm + 16) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
171
172 /* main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17 */
173 coef = coefBase + 16;
174 vb1 = vbuf + 64;
175 pcm++;
176
177 /* right now, the compiler creates bad asm from this... */
178 for (i = 15; i > 0; i--) {
179 sum1L = sum2L = rndVal;
180
181 MC2M(0)
182 MC2M(1)
183 MC2M(2)
184 MC2M(3)
185 MC2M(4)
186 MC2M(5)
187 MC2M(6)
188 MC2M(7)
189
190 vb1 += 64;
191 *(pcm) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
192 *(pcm + 2*i) = ClipToShort((int)SAR64(sum2L, (32-CSHIFT)), DEF_NFRACBITS);
193 pcm++;
194 }
195}
static __inline short ClipToShort(int x, int fracBits) FL_NOEXCEPT
Definition polyphase.hpp:74
__inline Word64 SAR64(Word64 x, int n) FL_NOEXCEPT
Shift right.
Definition assembly.h:564
#define MC1M(x)
Definition polyphase.hpp:96
#define DEF_NFRACBITS
Definition polyphase.hpp:71
#define MC0M(x)
Definition polyphase.hpp:90
#define CSHIFT
Definition polyphase.hpp:72
#define MC2M(x)

References ClipToShort(), CSHIFT, DEF_NFRACBITS, FL_NOEXCEPT, MC0M, MC1M, MC2M, and SAR64().

Referenced by Subband().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PolyphaseStereo()

void fl::third_party::PolyphaseStereo ( short * pcm,
int32_t * vbuf,
const int32_t * coefBase )

Definition at line 243 of file polyphase.hpp.

244{
245 int i;
246 const int32_t *coef;
247 int32_t *vb1;
248 int vLo, vHi, c1, c2;
249 Word64 sum1L, sum2L, sum1R, sum2R, rndVal;
250
251 rndVal = (Word64)( (i64)1 << (DEF_NFRACBITS - 1 + (32 - CSHIFT)) );
252
253 /* special case, output sample 0 */
254 coef = coefBase;
255 vb1 = vbuf;
256 sum1L = sum1R = rndVal;
257
258 MC0S(0)
259 MC0S(1)
260 MC0S(2)
261 MC0S(3)
262 MC0S(4)
263 MC0S(5)
264 MC0S(6)
265 MC0S(7)
266
267 *(pcm + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
268 *(pcm + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
269
270 /* special case, output sample 16 */
271 coef = coefBase + 256;
272 vb1 = vbuf + 64*16;
273 sum1L = sum1R = rndVal;
274
275 MC1S(0)
276 MC1S(1)
277 MC1S(2)
278 MC1S(3)
279 MC1S(4)
280 MC1S(5)
281 MC1S(6)
282 MC1S(7)
283
284 *(pcm + 2*16 + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
285 *(pcm + 2*16 + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
286
287 /* main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17 */
288 coef = coefBase + 16;
289 vb1 = vbuf + 64;
290 pcm += 2;
291
292 /* right now, the compiler creates bad asm from this... */
293 for (i = 15; i > 0; i--) {
294 sum1L = sum2L = rndVal;
295 sum1R = sum2R = rndVal;
296
297 MC2S(0)
298 MC2S(1)
299 MC2S(2)
300 MC2S(3)
301 MC2S(4)
302 MC2S(5)
303 MC2S(6)
304 MC2S(7)
305
306 vb1 += 64;
307 *(pcm + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
308 *(pcm + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
309 *(pcm + 2*2*i + 0) = ClipToShort((int)SAR64(sum2L, (32-CSHIFT)), DEF_NFRACBITS);
310 *(pcm + 2*2*i + 1) = ClipToShort((int)SAR64(sum2R, (32-CSHIFT)), DEF_NFRACBITS);
311 pcm += 2;
312 }
313}
#define MC2S(x)
#define MC0S(x)
#define MC1S(x)

References ClipToShort(), CSHIFT, DEF_NFRACBITS, FL_NOEXCEPT, MC0S, MC1S, MC2S, and SAR64().

Referenced by Subband().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RefillBitstreamCache()

static __inline void fl::third_party::RefillBitstreamCache ( BitStreamInfo * bsi)
static

Definition at line 92 of file bitstream.hpp.

93{
94 int32_t nBytes = bsi->nBytes;
95
96 /* optimize for common case, independent of machine endian-ness */
97 if (nBytes >= 4) {
98 bsi->iCache = ((uint32_t)(*bsi->bytePtr++)) << 24;
99 bsi->iCache |= ((uint32_t)(*bsi->bytePtr++)) << 16;
100 bsi->iCache |= ((uint32_t)(*bsi->bytePtr++)) << 8;
101 bsi->iCache |= ((uint32_t)(*bsi->bytePtr++));
102 bsi->cachedBits = 32;
103 bsi->nBytes -= 4;
104 } else {
105 bsi->iCache = 0;
106 while (nBytes--) {
107 bsi->iCache |= (*bsi->bytePtr++);
108 bsi->iCache <<= 8;
109 }
110 bsi->iCache <<= ((3 - bsi->nBytes)*8);
111 bsi->cachedBits = 8*bsi->nBytes;
112 bsi->nBytes = 0;
113 }
114}

References FL_NOEXCEPT.

Referenced by GetBits().

+ Here is the caller graph for this function:

◆ restart()

static JRESULT fl::third_party::restart ( JDEC * jd,
uint16_t rstn )
static

Definition at line 517 of file tjpgd.cpp.hpp.

521{
522 unsigned int i;
523 uint8_t *dp = jd->dptr;
524 size_t dc = jd->dctr;
525
526#if JD_FASTDECODE == 0
527 uint16_t d = 0;
528
529 /* Get two bytes from the input stream */
530 for (i = 0; i < 2; i++) {
531 if (!dc) { /* No input data is available, re-fill input buffer */
532 dp = jd->inbuf;
533 dc = jd->infunc(jd, dp, JD_SZBUF);
534 if (!dc) return JDR_INP;
535 } else {
536 dp++;
537 }
538 dc--;
539 d = d << 8 | *dp; /* Get a byte */
540 }
541 jd->dptr = dp; jd->dctr = dc; jd->dbit = 0;
542
543 /* Check the marker */
544 if ((d & 0xFFD8) != 0xFFD0 || (d & 7) != (rstn & 7)) {
545 return JDR_FMT1; /* Err: expected RSTn marker is not detected (may be collapted data) */
546 }
547
548#else
549 uint16_t marker;
550
551
552 if (jd->marker) { /* Generate a maker if it has been detected */
553 marker = 0xFF00 | jd->marker;
554 jd->marker = 0;
555 } else {
556 marker = 0;
557 for (i = 0; i < 2; i++) { /* Get a restart marker */
558 if (!dc) { /* No input data is available, re-fill input buffer */
559 dp = jd->inbuf;
560 dc = jd->infunc(jd, dp, JD_SZBUF);
561 if (!dc) return JDR_INP;
562 }
563 marker = (marker << 8) | *dp++; /* Get a byte */
564 dc--;
565 }
566 jd->dptr = dp; jd->dctr = dc;
567 }
568
569 /* Check the marker */
570 if ((marker & 0xFFD8) != 0xFFD0 || (marker & 7) != (rstn & 7)) {
571 return JDR_FMT1; /* Err: expected RSTn marker was not detected (may be collapted data) */
572 }
573
574 jd->dbit = 0; /* Discard stuff bits */
575#endif
576
577 jd->dcv[2] = jd->dcv[1] = jd->dcv[0] = 0; /* Reset DC offset */
578 return JDR_OK;
579}

References FL_NOEXCEPT, JD_SZBUF, JDR_FMT1, JDR_INP, and JDR_OK.

Referenced by jd_decomp(), and jd_decomp_progressive().

+ Here is the caller graph for this function:

◆ SAR64()

__inline Word64 fl::third_party::SAR64 ( Word64 x,
int n )

Shift right.

Definition at line 564 of file assembly.h.

565{
566 return x >> n;
567}

References FL_NOEXCEPT, and fl::x.

Referenced by PolyphaseMono(), and PolyphaseStereo().

+ Here is the caller graph for this function:

◆ SetBitstreamPointer()

void fl::third_party::SetBitstreamPointer ( BitStreamInfo * bsi,
int32_t nBytes,
const unsigned char * buf )

Definition at line 65 of file bitstream.hpp.

66{
67 /* init bitstream */
68 bsi->bytePtr = buf;
69 bsi->iCache = 0; /* 4-byte unsigned int */
70 bsi->cachedBits = 0; /* i.e. zero bits in cache */
71 bsi->nBytes = nBytes;
72}

References FL_NOEXCEPT.

Referenced by UnpackScaleFactors(), and UnpackSideInfo().

+ Here is the caller graph for this function:

◆ SHL64()

__inline Word64 fl::third_party::SHL64 ( Word64 x,
int n )

Shift left.

Definition at line 556 of file assembly.h.

557{
558 return ((Word64) x) << n;
559}

References FL_NOEXCEPT, and fl::x.

◆ Subband()

int fl::third_party::Subband ( MP3DecInfo * mp3DecInfo,
short * pcmBuf )

Definition at line 65 of file subband.hpp.

66{
67 int b;
68 IMDCTInfo *mi;
69 SubbandInfo *sbi;
70
71 /* validate pointers */
72 if (!mp3DecInfo || !mp3DecInfo->HuffmanInfoPS || !mp3DecInfo->IMDCTInfoPS || !mp3DecInfo->SubbandInfoPS)
73 return -1;
74
75 mi = (IMDCTInfo *)(mp3DecInfo->IMDCTInfoPS);
76 sbi = (SubbandInfo*)(mp3DecInfo->SubbandInfoPS);
77
78 if (mp3DecInfo->nChans == 2) {
79 /* stereo */
80 for (b = 0; b < BLOCK_SIZE; b++) {
81 FDCT32(mi->outBuf[0][b], sbi->vbuf + 0*32, sbi->vindex, (b & 0x01), mi->gb[0]);
82 FDCT32(mi->outBuf[1][b], sbi->vbuf + 1*32, sbi->vindex, (b & 0x01), mi->gb[1]);
83 PolyphaseStereo(pcmBuf, sbi->vbuf + sbi->vindex + VBUF_LENGTH * (b & 0x01), polyCoef);
84 sbi->vindex = (sbi->vindex - (b & 0x01)) & 7;
85 pcmBuf += (2 * NBANDS);
86 }
87 } else {
88 /* mono */
89 for (b = 0; b < BLOCK_SIZE; b++) {
90 FDCT32(mi->outBuf[0][b], sbi->vbuf + 0*32, sbi->vindex, (b & 0x01), mi->gb[0]);
91 PolyphaseMono(pcmBuf, sbi->vbuf + sbi->vindex + VBUF_LENGTH * (b & 0x01), polyCoef);
92 sbi->vindex = (sbi->vindex - (b & 0x01)) & 7;
93 pcmBuf += NBANDS;
94 }
95 }
96
97 return 0;
98}
#define BLOCK_SIZE
Definition coder.h:106
void FDCT32(int32_t *x, int32_t *d, int32_t offset, int32_t oddBlock, int32_t gb) FL_NOEXCEPT
Definition dct32.hpp:151
const int32_t polyCoef[264]
Definition trigtabs.hpp:282
void PolyphaseMono(short *pcm, int32_t *vbuf, const int32_t *coefBase)
void PolyphaseStereo(short *pcm, int32_t *vbuf, const int32_t *coefBase)
int32_t vbuf[MAX_NCHAN *VBUF_LENGTH]
Definition coder.h:279

References BLOCK_SIZE, FDCT32(), FL_NOEXCEPT, fl::third_party::_IMDCTInfo::gb, NBANDS, fl::third_party::_IMDCTInfo::outBuf, polyCoef, PolyphaseMono(), PolyphaseStereo(), fl::third_party::_SubbandInfo::vbuf, VBUF_LENGTH, and fl::third_party::_SubbandInfo::vindex.

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnpackFrameHeader()

int fl::third_party::UnpackFrameHeader ( MP3DecInfo * mp3DecInfo,
const unsigned char * buf )

Definition at line 223 of file bitstream.hpp.

224{
225
226 int verIdx;
227 FrameHeader *fh;
228
229 /* validate pointers and sync word */
230 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || (buf[0] & SYNCWORDH) != SYNCWORDH || (buf[1] & SYNCWORDL) != SYNCWORDL)
231 return -1;
232
233 fh = ((FrameHeader *)(mp3DecInfo->FrameHeaderPS));
234
235 /* read header fields - use bitmasks instead of GetBits() for speed, since format never varies */
236 verIdx = (buf[1] >> 3) & 0x03;
237 fh->ver = (MPEGVersion)( verIdx == 0 ? MPEG25 : ((verIdx & 0x01) ? MPEG1 : MPEG2) );
238 fh->layer = 4 - ((buf[1] >> 1) & 0x03); /* easy mapping of index to layer number, 4 = error */
239 fh->crc = 1 - ((buf[1] >> 0) & 0x01);
240 fh->brIdx = (buf[2] >> 4) & 0x0f;
241 fh->srIdx = (buf[2] >> 2) & 0x03;
242 fh->paddingBit = (buf[2] >> 1) & 0x01;
243 fh->privateBit = (buf[2] >> 0) & 0x01;
244 fh->sMode = (StereoMode)((buf[3] >> 6) & 0x03); /* maps to correct enum (see definition) */
245 fh->modeExt = (buf[3] >> 4) & 0x03;
246 fh->copyFlag = (buf[3] >> 3) & 0x01;
247 fh->origFlag = (buf[3] >> 2) & 0x01;
248 fh->emphasis = (buf[3] >> 0) & 0x03;
249
250 /* check parameters to avoid indexing tables with bad values */
251 if (fh->srIdx == 3 || fh->layer == 4 || fh->brIdx == 15)
252 return -1;
253
254 fh->sfBand = &sfBandTable[fh->ver][fh->srIdx]; /* for readability (we reference sfBandTable many times in decoder) */
255 if (fh->sMode != Joint) /* just to be safe (dequant, stproc check fh->modeExt) */
256 fh->modeExt = 0;
257
258 /* init user-accessible data */
259 mp3DecInfo->nChans = (fh->sMode == Mono ? 1 : 2);
260 mp3DecInfo->samprate = samplerateTab[fh->ver][fh->srIdx];
261 mp3DecInfo->nGrans = (fh->ver == MPEG1 ? NGRANS_MPEG1 : NGRANS_MPEG2);
262 mp3DecInfo->nGranSamps = ((int)samplesPerFrameTab[fh->ver][fh->layer - 1]) / mp3DecInfo->nGrans;
263 mp3DecInfo->layer = fh->layer;
264 mp3DecInfo->version = fh->ver;
265
266 /* get bitrate and nSlots from table, unless brIdx == 0 (free mode) in which case caller must figure it out himself
267 * question - do we want to overwrite mp3DecInfo->bitrate with 0 each time if it's free mode, and
268 * copy the pre-calculated actual free bitrate into it in mp3dec.c (according to the spec,
269 * this shouldn't be necessary, since it should be either all frames free or none free)
270 */
271 if (fh->brIdx) {
272 mp3DecInfo->bitrate = ((int)bitrateTab[fh->ver][fh->layer - 1][fh->brIdx]) * 1000;
273
274 /* nSlots = total frame bytes (from table) - sideInfo bytes - header - CRC (if present) + pad (if present) */
275 mp3DecInfo->nSlots = (int)slotTab[fh->ver][fh->srIdx][fh->brIdx] -
276 (int)sideBytesTab[fh->ver][(fh->sMode == Mono ? 0 : 1)] -
277 4 - (fh->crc ? 2 : 0) + (fh->paddingBit ? 1 : 0);
278 }
279
280 /* load crc word, if enabled, and return length of frame header (in bytes) */
281 if (fh->crc) {
282 fh->CRCWord = ((int)buf[4] << 8 | (int)buf[5] << 0);
283 return 6;
284 } else {
285 fh->CRCWord = 0;
286 return 4;
287 }
288}
StereoMode
Definition coder.h:143
@ Mono
Definition coder.h:147
@ Joint
Definition coder.h:145
#define NGRANS_MPEG2
Definition mp3common.h:54
#define NGRANS_MPEG1
Definition mp3common.h:53
MPEGVersion
Definition mp3dec.h:82
@ MPEG25
Definition mp3dec.h:85
@ MPEG2
Definition mp3dec.h:84
const short slotTab[3][3][15]
Definition mp3tabs.hpp:110
const short sideBytesTab[3][2]
Definition mp3tabs.hpp:100
const int32_t samplerateTab[3][3]
Definition mp3tabs.hpp:53
const SFBandTable sfBandTable[3][3]
Definition mp3tabs.hpp:135
const short bitrateTab[3][3][15]
Definition mp3tabs.hpp:64

References bitrateTab, fl::third_party::_FrameHeader::brIdx, fl::third_party::_FrameHeader::copyFlag, fl::third_party::_FrameHeader::crc, fl::third_party::_FrameHeader::CRCWord, fl::third_party::_FrameHeader::emphasis, FL_NOEXCEPT, Joint, fl::third_party::_FrameHeader::layer, fl::third_party::_FrameHeader::modeExt, Mono, MPEG1, MPEG2, MPEG25, NGRANS_MPEG1, NGRANS_MPEG2, fl::third_party::_FrameHeader::origFlag, fl::third_party::_FrameHeader::paddingBit, fl::third_party::_FrameHeader::privateBit, samplerateTab, samplesPerFrameTab, fl::third_party::_FrameHeader::sfBand, sfBandTable, sideBytesTab, slotTab, fl::third_party::_FrameHeader::sMode, fl::third_party::_FrameHeader::srIdx, SYNCWORDH, SYNCWORDL, and fl::third_party::_FrameHeader::ver.

Referenced by MP3Decode(), and MP3GetNextFrameInfo().

+ Here is the caller graph for this function:

◆ UnpackScaleFactors()

int fl::third_party::UnpackScaleFactors ( MP3DecInfo * mp3DecInfo,
const unsigned char * buf,
int * bitOffset,
int bitsAvail,
int gr,
int ch )

Definition at line 357 of file scalfact.hpp.

358{
359 int bitsUsed;
360 const unsigned char *startBuf;
361 BitStreamInfo bitStreamInfo, *bsi;
362 FrameHeader *fh;
363 SideInfo *si;
364 ScaleFactorInfo *sfi;
365
366 /* validate pointers */
367 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || !mp3DecInfo->SideInfoPS || !mp3DecInfo->ScaleFactorInfoPS)
368 return -1;
369 fh = ((FrameHeader *)(mp3DecInfo->FrameHeaderPS));
370 si = ((SideInfo *)(mp3DecInfo->SideInfoPS));
371 sfi = ((ScaleFactorInfo *)(mp3DecInfo->ScaleFactorInfoPS));
372
373 /* init GetBits reader */
374 startBuf = buf;
375 bsi = &bitStreamInfo;
376 SetBitstreamPointer(bsi, (bitsAvail + *bitOffset + 7) / 8, buf);
377 if (*bitOffset)
378 GetBits(bsi, *bitOffset);
379
380 if (fh->ver == MPEG1)
381 UnpackSFMPEG1(bsi, &si->sis[gr][ch], &sfi->sfis[gr][ch], si->scfsi[ch], gr, &sfi->sfis[0][ch]);
382 else
383 UnpackSFMPEG2(bsi, &si->sis[gr][ch], &sfi->sfis[gr][ch], gr, ch, fh->modeExt, &sfi->sfjs);
384
385 mp3DecInfo->part23Length[gr][ch] = si->sis[gr][ch].part23Length;
386
387 bitsUsed = CalcBitsUsed(bsi, buf, *bitOffset);
388 buf += (bitsUsed + *bitOffset) >> 3;
389 *bitOffset = (bitsUsed + *bitOffset) & 0x07;
390
391 return (buf - startBuf);
392}
struct fl::third_party::_BitStreamInfo BitStreamInfo
uint32_t GetBits(BitStreamInfo *bsi, int32_t nBits) FL_NOEXCEPT
void SetBitstreamPointer(BitStreamInfo *bsi, int32_t nBytes, const unsigned char *buf) FL_NOEXCEPT
Definition bitstream.hpp:65
static void UnpackSFMPEG1(BitStreamInfo *bsi, SideInfoSub *sis, ScaleFactorInfoSub *sfis, int32_t *scfsi, int gr, ScaleFactorInfoSub *sfisGr0) FL_NOEXCEPT
Definition scalfact.hpp:85
static void UnpackSFMPEG2(BitStreamInfo *bsi, SideInfoSub *sis, ScaleFactorInfoSub *sfis, int gr, int ch, int modeExt, ScaleFactorJS *sfjs) FL_NOEXCEPT
Definition scalfact.hpp:212
int32_t CalcBitsUsed(BitStreamInfo *bsi, const unsigned char *startBuf, int32_t startOffset) FL_NOEXCEPT
int32_t scfsi[MAX_NCHAN][MAX_SCFBD]
Definition coder.h:198

References CalcBitsUsed(), FL_NOEXCEPT, GetBits(), fl::third_party::_FrameHeader::modeExt, MPEG1, fl::third_party::_SideInfoSub::part23Length, fl::third_party::_SideInfo::scfsi, SetBitstreamPointer(), fl::third_party::_ScaleFactorInfo::sfis, fl::third_party::_ScaleFactorInfo::sfjs, fl::third_party::_SideInfo::sis, UnpackSFMPEG1(), UnpackSFMPEG2(), and fl::third_party::_FrameHeader::ver.

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnpackSFMPEG1()

static void fl::third_party::UnpackSFMPEG1 ( BitStreamInfo * bsi,
SideInfoSub * sis,
ScaleFactorInfoSub * sfis,
int32_t * scfsi,
int gr,
ScaleFactorInfoSub * sfisGr0 )
static

Definition at line 85 of file scalfact.hpp.

86{
87 int sfb;
88 int slen0, slen1;
89
90 /* these can be 0, so make sure GetBits(bsi, 0) returns 0 (no >> 32 or anything) */
91 slen0 = (int)SFLenTab[sis->sfCompress][0];
92 slen1 = (int)SFLenTab[sis->sfCompress][1];
93
94 if (sis->blockType == 2) {
95 /* short block, type 2 (implies winSwitchFlag == 1) */
96 if (sis->mixedBlock) {
97 /* do long block portion */
98 for (sfb = 0; sfb < 8; sfb++)
99 sfis->l[sfb] = (char)GetBits(bsi, slen0);
100 sfb = 3;
101 } else {
102 /* all short blocks */
103 sfb = 0;
104 }
105
106 for ( ; sfb < 6; sfb++) {
107 sfis->s[sfb][0] = (char)GetBits(bsi, slen0);
108 sfis->s[sfb][1] = (char)GetBits(bsi, slen0);
109 sfis->s[sfb][2] = (char)GetBits(bsi, slen0);
110 }
111
112 for ( ; sfb < 12; sfb++) {
113 sfis->s[sfb][0] = (char)GetBits(bsi, slen1);
114 sfis->s[sfb][1] = (char)GetBits(bsi, slen1);
115 sfis->s[sfb][2] = (char)GetBits(bsi, slen1);
116 }
117
118 /* last sf band not transmitted */
119 sfis->s[12][0] = sfis->s[12][1] = sfis->s[12][2] = 0;
120 } else {
121 /* long blocks, type 0, 1, or 3 */
122 if(gr == 0) {
123 /* first granule */
124 for (sfb = 0; sfb < 11; sfb++)
125 sfis->l[sfb] = (char)GetBits(bsi, slen0);
126 for (sfb = 11; sfb < 21; sfb++)
127 sfis->l[sfb] = (char)GetBits(bsi, slen1);
128 return;
129 } else {
130 /* second granule
131 * scfsi: 0 = different scalefactors for each granule, 1 = copy sf's from granule 0 into granule 1
132 * for block type == 2, scfsi is always 0
133 */
134 sfb = 0;
135 if(scfsi[0]) for( ; sfb < 6 ; sfb++) sfis->l[sfb] = sfisGr0->l[sfb];
136 else for( ; sfb < 6 ; sfb++) sfis->l[sfb] = (char)GetBits(bsi, slen0);
137 if(scfsi[1]) for( ; sfb <11 ; sfb++) sfis->l[sfb] = sfisGr0->l[sfb];
138 else for( ; sfb <11 ; sfb++) sfis->l[sfb] = (char)GetBits(bsi, slen0);
139 if(scfsi[2]) for( ; sfb <16 ; sfb++) sfis->l[sfb] = sfisGr0->l[sfb];
140 else for( ; sfb <16 ; sfb++) sfis->l[sfb] = (char)GetBits(bsi, slen1);
141 if(scfsi[3]) for( ; sfb <21 ; sfb++) sfis->l[sfb] = sfisGr0->l[sfb];
142 else for( ; sfb <21 ; sfb++) sfis->l[sfb] = (char)GetBits(bsi, slen1);
143 }
144 /* last sf band not transmitted */
145 sfis->l[21] = 0;
146 sfis->l[22] = 0;
147 }
148}
static const char SFLenTab[16][2]
Definition scalfact.hpp:51

References FL_NOEXCEPT, GetBits(), and SFLenTab.

Referenced by UnpackScaleFactors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnpackSFMPEG2()

static void fl::third_party::UnpackSFMPEG2 ( BitStreamInfo * bsi,
SideInfoSub * sis,
ScaleFactorInfoSub * sfis,
int gr,
int ch,
int modeExt,
ScaleFactorJS * sfjs )
static

Definition at line 212 of file scalfact.hpp.

213{
214 (void)gr; // Unused parameter - kept for API consistency
215
216 int i, sfb, sfcIdx, btIdx, nrIdx;
217 int slen[4], nr[4];
218 int sfCompress, preFlag, intensityScale;
219
220 sfCompress = sis->sfCompress;
221 preFlag = 0;
222 intensityScale = 0;
223
224 /* stereo mode bits (1 = on): bit 1 = mid-side on/off, bit 0 = intensity on/off */
225 if (! ((modeExt & 0x01) && (ch == 1)) ) {
226 /* in other words: if ((modeExt & 0x01) == 0 || ch == 0) */
227 if (sfCompress < 400) {
228 /* max slen = floor[(399/16) / 5] = 4 */
229 slen[0] = (sfCompress >> 4) / 5;
230 slen[1]= (sfCompress >> 4) % 5;
231 slen[2]= (sfCompress & 0x0f) >> 2;
232 slen[3]= (sfCompress & 0x03);
233 sfcIdx = 0;
234 } else if (sfCompress < 500) {
235 /* max slen = floor[(99/4) / 5] = 4 */
236 sfCompress -= 400;
237 slen[0] = (sfCompress >> 2) / 5;
238 slen[1]= (sfCompress >> 2) % 5;
239 slen[2]= (sfCompress & 0x03);
240 slen[3]= 0;
241 sfcIdx = 1;
242 } else {
243 /* max slen = floor[11/3] = 3 (sfCompress = 9 bits in MPEG2) */
244 sfCompress -= 500;
245 slen[0] = sfCompress / 3;
246 slen[1] = sfCompress % 3;
247 slen[2] = slen[3] = 0;
248 if (sis->mixedBlock) {
249 /* adjust for long/short mix logic (see comment above in NRTab[] definition) */
250 slen[2] = slen[1];
251 slen[1] = slen[0];
252 }
253 preFlag = 1;
254 sfcIdx = 2;
255 }
256 } else {
257 /* intensity stereo ch = 1 (right) */
258 intensityScale = sfCompress & 0x01;
259 sfCompress >>= 1;
260 if (sfCompress < 180) {
261 /* max slen = floor[35/6] = 5 (from mod 36) */
262 slen[0] = (sfCompress / 36);
263 slen[1] = (sfCompress % 36) / 6;
264 slen[2] = (sfCompress % 36) % 6;
265 slen[3] = 0;
266 sfcIdx = 3;
267 } else if (sfCompress < 244) {
268 /* max slen = floor[63/16] = 3 */
269 sfCompress -= 180;
270 slen[0] = (sfCompress & 0x3f) >> 4;
271 slen[1] = (sfCompress & 0x0f) >> 2;
272 slen[2] = (sfCompress & 0x03);
273 slen[3] = 0;
274 sfcIdx = 4;
275 } else {
276 /* max slen = floor[11/3] = 3 (max sfCompress >> 1 = 511/2 = 255) */
277 sfCompress -= 244;
278 slen[0] = (sfCompress / 3);
279 slen[1] = (sfCompress % 3);
280 slen[2] = slen[3] = 0;
281 sfcIdx = 5;
282 }
283 }
284
285 /* set index based on block type: (0,1,3) --> 0, (2 non-mixed) --> 1, (2 mixed) ---> 2 */
286 btIdx = 0;
287 if (sis->blockType == 2)
288 btIdx = (sis->mixedBlock ? 2 : 1);
289 for (i = 0; i < 4; i++)
290 nr[i] = (int)NRTab[sfcIdx][btIdx][i];
291
292 /* save intensity stereo scale factor info */
293 if( (modeExt & 0x01) && (ch == 1) ) {
294 for (i = 0; i < 4; i++) {
295 sfjs->slen[i] = slen[i];
296 sfjs->nr[i] = nr[i];
297 }
298 sfjs->intensityScale = intensityScale;
299 }
300 sis->preFlag = preFlag;
301
302 /* short blocks */
303 if(sis->blockType == 2) {
304 if(sis->mixedBlock) {
305 /* do long block portion */
306 for (sfb=0; sfb < 6; sfb++) {
307 sfis->l[sfb] = (char)GetBits(bsi, slen[0]);
308 }
309 sfb = 3; /* start sfb for short */
310 nrIdx = 1;
311 } else {
312 /* all short blocks, so start nr, sfb at 0 */
313 sfb = 0;
314 nrIdx = 0;
315 }
316
317 /* remaining short blocks, sfb just keeps incrementing */
318 for ( ; nrIdx <= 3; nrIdx++) {
319 for (i=0; i < nr[nrIdx]; i++, sfb++) {
320 sfis->s[sfb][0] = (char)GetBits(bsi, slen[nrIdx]);
321 sfis->s[sfb][1] = (char)GetBits(bsi, slen[nrIdx]);
322 sfis->s[sfb][2] = (char)GetBits(bsi, slen[nrIdx]);
323 }
324 }
325 /* last sf band not transmitted */
326 sfis->s[12][0] = sfis->s[12][1] = sfis->s[12][2] = 0;
327 } else {
328 /* long blocks */
329 sfb = 0;
330 for (nrIdx = 0; nrIdx <= 3; nrIdx++) {
331 for(i=0; i < nr[nrIdx]; i++, sfb++) {
332 sfis->l[sfb] = (char)GetBits(bsi, slen[nrIdx]);
333 }
334 }
335 /* last sf band not transmitted */
336 sfis->l[21] = sfis->l[22] = 0;
337
338 }
339}
static const char NRTab[6][3][4]
Definition scalfact.hpp:160

References FL_NOEXCEPT, GetBits(), and NRTab.

Referenced by UnpackScaleFactors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnpackSideInfo()

int fl::third_party::UnpackSideInfo ( MP3DecInfo * mp3DecInfo,
const unsigned char * buf )

Definition at line 304 of file bitstream.hpp.

305{
306 int gr, ch, bd, nBytes;
307 BitStreamInfo bitStreamInfo, *bsi;
308 FrameHeader *fh;
309 SideInfo *si;
310 SideInfoSub *sis;
311
312 /* validate pointers and sync word */
313 if (!mp3DecInfo || !mp3DecInfo->FrameHeaderPS || !mp3DecInfo->SideInfoPS)
314 return -1;
315
316 fh = ((FrameHeader *)(mp3DecInfo->FrameHeaderPS));
317 si = ((SideInfo *)(mp3DecInfo->SideInfoPS));
318
319 bsi = &bitStreamInfo;
320 if (fh->ver == MPEG1) {
321 /* MPEG 1 */
323 SetBitstreamPointer(bsi, nBytes, buf);
324 si->mainDataBegin = GetBits(bsi, 9);
325 si->privateBits = GetBits(bsi, (fh->sMode == Mono ? 5 : 3));
326
327 for (ch = 0; ch < mp3DecInfo->nChans; ch++)
328 for (bd = 0; bd < MAX_SCFBD; bd++)
329 si->scfsi[ch][bd] = GetBits(bsi, 1);
330 } else {
331 /* MPEG 2, MPEG 2.5 */
333 SetBitstreamPointer(bsi, nBytes, buf);
334 si->mainDataBegin = GetBits(bsi, 8);
335 si->privateBits = GetBits(bsi, (fh->sMode == Mono ? 1 : 2));
336 }
337
338 for(gr =0; gr < mp3DecInfo->nGrans; gr++) {
339 for (ch = 0; ch < mp3DecInfo->nChans; ch++) {
340 sis = &si->sis[gr][ch]; /* side info subblock for this granule, channel */
341
342 sis->part23Length = GetBits(bsi, 12);
343 sis->nBigvals = GetBits(bsi, 9);
344 sis->globalGain = GetBits(bsi, 8);
345 sis->sfCompress = GetBits(bsi, (fh->ver == MPEG1 ? 4 : 9));
346 sis->winSwitchFlag = GetBits(bsi, 1);
347
348 if(sis->winSwitchFlag) {
349 /* this is a start, stop, short, or mixed block */
350 sis->blockType = GetBits(bsi, 2); /* 0 = normal, 1 = start, 2 = short, 3 = stop */
351 sis->mixedBlock = GetBits(bsi, 1); /* 0 = not mixed, 1 = mixed */
352 sis->tableSelect[0] = GetBits(bsi, 5);
353 sis->tableSelect[1] = GetBits(bsi, 5);
354 sis->tableSelect[2] = 0; /* unused */
355 sis->subBlockGain[0] = GetBits(bsi, 3);
356 sis->subBlockGain[1] = GetBits(bsi, 3);
357 sis->subBlockGain[2] = GetBits(bsi, 3);
358
359 /* TODO - check logic */
360 if (sis->blockType == 0) {
361 /* this should not be allowed, according to spec */
362 sis->nBigvals = 0;
363 sis->part23Length = 0;
364 sis->sfCompress = 0;
365 } else if (sis->blockType == 2 && sis->mixedBlock == 0) {
366 /* short block, not mixed */
367 sis->region0Count = 8;
368 } else {
369 /* start, stop, or short-mixed */
370 sis->region0Count = 7;
371 }
372 sis->region1Count = 20 - sis->region0Count;
373 } else {
374 /* this is a normal block */
375 sis->blockType = 0;
376 sis->mixedBlock = 0;
377 sis->tableSelect[0] = GetBits(bsi, 5);
378 sis->tableSelect[1] = GetBits(bsi, 5);
379 sis->tableSelect[2] = GetBits(bsi, 5);
380 sis->region0Count = GetBits(bsi, 4);
381 sis->region1Count = GetBits(bsi, 3);
382 }
383 sis->preFlag = (fh->ver == MPEG1 ? GetBits(bsi, 1) : 0);
384 sis->sfactScale = GetBits(bsi, 1);
385 sis->count1TableSelect = GetBits(bsi, 1);
386 }
387 }
388 mp3DecInfo->mainDataBegin = si->mainDataBegin; /* needed by main decode loop */
389
390 ASSERT(nBytes == CalcBitsUsed(bsi, buf, 0) >> 3);
391
392 return nBytes;
393}
#define SIBYTES_MPEG2_MONO
Definition coder.h:95
#define SIBYTES_MPEG1_MONO
Definition coder.h:93
#define SIBYTES_MPEG2_STEREO
Definition coder.h:96
#define SIBYTES_MPEG1_STEREO
Definition coder.h:94
#define MAX_SCFBD
Definition mp3common.h:52

References ASSERT, fl::third_party::_SideInfoSub::blockType, CalcBitsUsed(), fl::third_party::_SideInfoSub::count1TableSelect, FL_NOEXCEPT, GetBits(), fl::third_party::_SideInfoSub::globalGain, fl::third_party::_SideInfo::mainDataBegin, MAX_SCFBD, fl::third_party::_SideInfoSub::mixedBlock, Mono, MPEG1, fl::third_party::_SideInfoSub::nBigvals, fl::third_party::_SideInfoSub::part23Length, fl::third_party::_SideInfoSub::preFlag, fl::third_party::_SideInfo::privateBits, fl::third_party::_SideInfoSub::region0Count, fl::third_party::_SideInfoSub::region1Count, fl::third_party::_SideInfo::scfsi, SetBitstreamPointer(), fl::third_party::_SideInfoSub::sfactScale, fl::third_party::_SideInfoSub::sfCompress, SIBYTES_MPEG1_MONO, SIBYTES_MPEG1_STEREO, SIBYTES_MPEG2_MONO, SIBYTES_MPEG2_STEREO, fl::third_party::_SideInfo::sis, fl::third_party::_FrameHeader::sMode, fl::third_party::_SideInfoSub::subBlockGain, fl::third_party::_SideInfoSub::tableSelect, fl::third_party::_FrameHeader::ver, and fl::third_party::_SideInfoSub::winSwitchFlag.

Referenced by MP3Decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WinPrevious()

static void fl::third_party::WinPrevious ( int32_t * xPrev,
int32_t * xPrevWin,
int32_t btPrev )
static

Definition at line 141 of file imdct.hpp.

142{
143 int32_t i;
144 int32_t x, *xp, *xpwLo, *xpwHi, wLo, wHi;
145 const int32_t *wpLo, *wpHi;
146
147 xp = xPrev;
148 /* mapping (see IMDCT12x3): xPrev[0-2] = sum[6-8], xPrev[3-8] = sum[12-17] */
149 if (btPrev == 2) {
150 /* this could be reordered for minimum loads/stores */
151 wpLo = imdctWin[btPrev];
152 xPrevWin[ 0] = MULSHIFT32(wpLo[ 6], xPrev[2]) + MULSHIFT32(wpLo[0], xPrev[6]);
153 xPrevWin[ 1] = MULSHIFT32(wpLo[ 7], xPrev[1]) + MULSHIFT32(wpLo[1], xPrev[7]);
154 xPrevWin[ 2] = MULSHIFT32(wpLo[ 8], xPrev[0]) + MULSHIFT32(wpLo[2], xPrev[8]);
155 xPrevWin[ 3] = MULSHIFT32(wpLo[ 9], xPrev[0]) + MULSHIFT32(wpLo[3], xPrev[8]);
156 xPrevWin[ 4] = MULSHIFT32(wpLo[10], xPrev[1]) + MULSHIFT32(wpLo[4], xPrev[7]);
157 xPrevWin[ 5] = MULSHIFT32(wpLo[11], xPrev[2]) + MULSHIFT32(wpLo[5], xPrev[6]);
158 xPrevWin[ 6] = MULSHIFT32(wpLo[ 6], xPrev[5]);
159 xPrevWin[ 7] = MULSHIFT32(wpLo[ 7], xPrev[4]);
160 xPrevWin[ 8] = MULSHIFT32(wpLo[ 8], xPrev[3]);
161 xPrevWin[ 9] = MULSHIFT32(wpLo[ 9], xPrev[3]);
162 xPrevWin[10] = MULSHIFT32(wpLo[10], xPrev[4]);
163 xPrevWin[11] = MULSHIFT32(wpLo[11], xPrev[5]);
164 xPrevWin[12] = xPrevWin[13] = xPrevWin[14] = xPrevWin[15] = xPrevWin[16] = xPrevWin[17] = 0;
165 } else {
166 /* use ARM-style pointers (*ptr++) so that ADS compiles well */
167 wpLo = imdctWin[btPrev] + 18;
168 wpHi = wpLo + 17;
169 xpwLo = xPrevWin;
170 xpwHi = xPrevWin + 17;
171 for (i = 9; i > 0; i--) {
172 x = *xp++; wLo = *wpLo++; wHi = *wpHi--;
173 *xpwLo++ = MULSHIFT32(wLo, x);
174 *xpwHi-- = MULSHIFT32(wHi, x);
175 }
176 }
177}

References FL_NOEXCEPT, imdctWin, MULSHIFT32(), and fl::x.

Referenced by HybridTransform(), IMDCT12x3(), and IMDCT36().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yuv_to_rgb()

static void fl::third_party::yuv_to_rgb ( const fl::third_party::plm_frame_t * frame,
fl::u8 * rgb_buffer )
static

Definition at line 24 of file software_decoder.cpp.hpp.

24 {
25 fl::u32 width = frame->width;
26 fl::u32 height = frame->height;
27
28 // YUV to RGB conversion coefficients (ITU-R BT.601 standard, scaled by 1000)
29 const fl::i32 YUV_TO_RGB_MATRIX[9] = {
30 1164, 0, 1596, // Y, U, V coefficients for R
31 1164, -391, -813, // Y, U, V coefficients for G
32 1164, 2017, 0 // Y, U, V coefficients for B (fixed: 2018 -> 2017)
33 };
34
35 for (fl::u32 y = 0; y < height; y++) {
36 for (fl::u32 x = 0; x < width; x++) {
37 // Get Y, U, V values
38 fl::u32 y_index = y * frame->y.width + x;
39 fl::u32 uv_x = x / 2;
40 fl::u32 uv_y = y / 2;
41 fl::u32 uv_index = uv_y * frame->cr.width + uv_x;
42
43 fl::i32 Y = frame->y.data[y_index] - 16;
44 fl::i32 U = frame->cb.data[uv_index] - 128;
45 fl::i32 V = frame->cr.data[uv_index] - 128;
46
47 // Convert to RGB
48 fl::i32 R = (YUV_TO_RGB_MATRIX[0] * Y + YUV_TO_RGB_MATRIX[1] * U + YUV_TO_RGB_MATRIX[2] * V) / 1000;
49 fl::i32 G = (YUV_TO_RGB_MATRIX[3] * Y + YUV_TO_RGB_MATRIX[4] * U + YUV_TO_RGB_MATRIX[5] * V) / 1000;
50 fl::i32 B = (YUV_TO_RGB_MATRIX[6] * Y + YUV_TO_RGB_MATRIX[7] * U + YUV_TO_RGB_MATRIX[8] * V) / 1000;
51
52 // Clamp values
53 R = R < 0 ? 0 : (R > 255 ? 255 : R);
54 G = G < 0 ? 0 : (G > 255 ? 255 : G);
55 B = B < 0 ? 0 : (B > 255 ? 255 : B);
56
57 // Store RGB values
58 fl::u32 rgb_index = (y * width + x) * 3;
59 rgb_buffer[rgb_index + 0] = static_cast<fl::u8>(R);
60 rgb_buffer[rgb_index + 1] = static_cast<fl::u8>(G);
61 rgb_buffer[rgb_index + 2] = static_cast<fl::u8>(B);
62 }
63 }
64}
FL_DISABLE_WARNING_PUSH unsigned char * B

References fl::B, FL_NOEXCEPT, fl::height, fl::width, fl::x, and fl::y.

Referenced by fl::third_party::SoftwareMpeg1Decoder::videoDecodeCallback().

+ Here is the caller graph for this function:

Variable Documentation

◆ bitrateTab

const short fl::third_party::bitrateTab
Initial value:
= {
{
{ 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448},
{ 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384},
{ 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320},
},
{
{ 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256},
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160},
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160},
},
{
{ 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256},
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160},
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160},
},
}

Definition at line 64 of file mp3tabs.hpp.

64 {
65 {
66 /* MPEG-1 */
67 { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448}, /* Layer 1 */
68 { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384}, /* Layer 2 */
69 { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320}, /* Layer 3 */
70 },
71 {
72 /* MPEG-2 */
73 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
74 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
75 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
76 },
77 {
78 /* MPEG-2.5 */
79 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
80 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
81 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
82 },
83};

Referenced by IMDCT(), and UnpackFrameHeader().

◆ bitsPerSlotTab

const short fl::third_party::bitsPerSlotTab = {32, 8, 8}

Definition at line 95 of file mp3tabs.hpp.

95{32, 8, 8};

Referenced by IMDCT().

◆ c18

const int32_t fl::third_party::c18[9]
static
Initial value:
= {
static_cast<int32_t>(0x7f834ed0U), static_cast<int32_t>(0x7ba3751dU), static_cast<int32_t>(0x7401e4c1U), static_cast<int32_t>(0x68d9f964U), static_cast<int32_t>(0x5a82799aU), static_cast<int32_t>(0x496af3e2U), static_cast<int32_t>(0x36185aeeU), 0x2120fb83, 0x0b27eb5c,
}

Definition at line 267 of file imdct.hpp.

267 {
268 static_cast<int32_t>(0x7f834ed0U), static_cast<int32_t>(0x7ba3751dU), static_cast<int32_t>(0x7401e4c1U), static_cast<int32_t>(0x68d9f964U), static_cast<int32_t>(0x5a82799aU), static_cast<int32_t>(0x496af3e2U), static_cast<int32_t>(0x36185aeeU), 0x2120fb83, 0x0b27eb5c,
269};

Referenced by IMDCT36().

◆ c3_0

int32_t fl::third_party::c3_0 = static_cast<int32_t>(0x6ed9eba1U)
static

Definition at line 479 of file imdct.hpp.

Referenced by imdct12().

◆ c6

int32_t fl::third_party::c6[3] = { static_cast<int32_t>(0x7ba3751dU), static_cast<int32_t>(0x5a82799aU), 0x2120fb83 }
static

Definition at line 480 of file imdct.hpp.

480{ static_cast<int32_t>(0x7ba3751dU), static_cast<int32_t>(0x5a82799aU), 0x2120fb83 }; /* format = Q31, cos(((0:2) + 0.5) * (pi/6)) */

Referenced by imdct12().

◆ c9_0

const int32_t fl::third_party::c9_0 = static_cast<int32_t>(0x6ed9eba1U)
static

Definition at line 258 of file imdct.hpp.

Referenced by idct9().

◆ c9_1

const int32_t fl::third_party::c9_1 = static_cast<int32_t>(0x620dbe8bU)
static

Definition at line 259 of file imdct.hpp.

Referenced by idct9().

◆ c9_2

const int32_t fl::third_party::c9_2 = 0x163a1a7e
static

Definition at line 260 of file imdct.hpp.

Referenced by idct9().

◆ c9_3

const int32_t fl::third_party::c9_3 = static_cast<int32_t>(0x5246dd49U)
static

Definition at line 261 of file imdct.hpp.

Referenced by idct9().

◆ c9_4

const int32_t fl::third_party::c9_4 = static_cast<int32_t>(0x7e0e2e32U)
static

Definition at line 262 of file imdct.hpp.

Referenced by idct9().

◆ coef32

const int32_t fl::third_party::coef32
Initial value:
= {
0x7fd8878d, 0x7e9d55fc, 0x7c29fbee, 0x78848413, 0x73b5ebd0, 0x6dca0d14, 0x66cf811f, 0x5ed77c89,
0x55f5a4d2, 0x4c3fdff3, 0x41ce1e64, 0x36ba2013, 0x2b1f34eb, 0x1f19f97b, 0x12c8106e, 0x0647d97c,
0x7f62368f, 0x7a7d055b, 0x70e2cbc6, 0x62f201ac, 0x5133cc94, 0x3c56ba70, 0x25280c5d, 0x0c8bd35e,
0x7d8a5f3f, 0x6a6d98a4, 0x471cece6, 0x18f8b83c, 0x7641af3c, 0x30fbc54d, 0x2d413ccc,
}

Definition at line 252 of file trigtabs.hpp.

252 {
253 0x7fd8878d, 0x7e9d55fc, 0x7c29fbee, 0x78848413, 0x73b5ebd0, 0x6dca0d14, 0x66cf811f, 0x5ed77c89,
254 0x55f5a4d2, 0x4c3fdff3, 0x41ce1e64, 0x36ba2013, 0x2b1f34eb, 0x1f19f97b, 0x12c8106e, 0x0647d97c,
255 0x7f62368f, 0x7a7d055b, 0x70e2cbc6, 0x62f201ac, 0x5133cc94, 0x3c56ba70, 0x25280c5d, 0x0c8bd35e,
256 0x7d8a5f3f, 0x6a6d98a4, 0x471cece6, 0x18f8b83c, 0x7641af3c, 0x30fbc54d, 0x2d413ccc,
257};

◆ csa

const int32_t fl::third_party::csa
Initial value:
= {
{0x6dc253f0, (int32_t)0xbe2500aa},
{0x70dcebe4, (int32_t)0xc39e4949},
{0x798d6e73, (int32_t)0xd7e33f4a},
{0x7ddd40a7, (int32_t)0xe8b71176},
{0x7f6d20b7, (int32_t)0xf3e4fe2f},
{0x7fe47e40, (int32_t)0xfac1a3c7},
{0x7ffcb263, (int32_t)0xfe2ebdc6},
{0x7fffc694, (int32_t)0xff86c25d},
}

Definition at line 229 of file trigtabs.hpp.

229 {
230 {0x6dc253f0, (int32_t)0xbe2500aa},
231 {0x70dcebe4, (int32_t)0xc39e4949},
232 {0x798d6e73, (int32_t)0xd7e33f4a},
233 {0x7ddd40a7, (int32_t)0xe8b71176},
234 {0x7f6d20b7, (int32_t)0xf3e4fe2f},
235 {0x7fe47e40, (int32_t)0xfac1a3c7},
236 {0x7ffcb263, (int32_t)0xfe2ebdc6},
237 {0x7fffc694, (int32_t)0xff86c25d},
238};

Referenced by AntiAlias().

◆ dcttab

const int32_t fl::third_party::dcttab[48]
static
Initial value:
= {
}
#define COS0_3
Definition dct32.hpp:58
#define COS0_4
Definition dct32.hpp:59
#define COS1_6
Definition dct32.hpp:78
#define COS0_8
Definition dct32.hpp:63
#define COS0_10
Definition dct32.hpp:65
#define COS3_1
Definition dct32.hpp:87
#define COS0_0
Definition dct32.hpp:55
#define COS1_7
Definition dct32.hpp:79
#define COS0_5
Definition dct32.hpp:60
#define COS1_2
Definition dct32.hpp:74
#define COS2_0
Definition dct32.hpp:81
#define COS0_1
Definition dct32.hpp:56
#define COS0_9
Definition dct32.hpp:64
#define COS3_0
Definition dct32.hpp:86
#define COS1_0
Definition dct32.hpp:72
#define COS2_2
Definition dct32.hpp:83
#define COS1_5
Definition dct32.hpp:77
#define COS1_4
Definition dct32.hpp:76
#define COS1_1
Definition dct32.hpp:73
#define COS2_1
Definition dct32.hpp:82
#define COS0_2
Definition dct32.hpp:57
#define COS0_7
Definition dct32.hpp:62
#define COS2_3
Definition dct32.hpp:84
#define COS1_3
Definition dct32.hpp:75
#define COS0_12
Definition dct32.hpp:67
#define COS0_14
Definition dct32.hpp:69
#define COS0_11
Definition dct32.hpp:66
#define COS0_15
Definition dct32.hpp:70
#define COS0_6
Definition dct32.hpp:61
#define COS0_13
Definition dct32.hpp:68

Definition at line 92 of file dct32.hpp.

92 {
93 /* first pass */
94 COS0_0, COS0_15, COS1_0, /* 31, 27, 31 */
95 COS0_1, COS0_14, COS1_1, /* 31, 29, 31 */
96 COS0_2, COS0_13, COS1_2, /* 31, 29, 31 */
97 COS0_3, COS0_12, COS1_3, /* 31, 30, 31 */
98 COS0_4, COS0_11, COS1_4, /* 31, 30, 31 */
99 COS0_5, COS0_10, COS1_5, /* 31, 31, 30 */
100 COS0_6, COS0_9, COS1_6, /* 31, 31, 30 */
101 COS0_7, COS0_8, COS1_7, /* 31, 31, 28 */
102 /* second pass */
103 COS2_0, COS2_3, COS3_0, /* 31, 29, 31 */
104 COS2_1, COS2_2, COS3_1, /* 31, 31, 30 */
105 -COS2_0, -COS2_3, COS3_0, /* 31, 29, 31 */
106 -COS2_1, -COS2_2, COS3_1, /* 31, 31, 30 */
107 COS2_0, COS2_3, COS3_0, /* 31, 29, 31 */
108 COS2_1, COS2_2, COS3_1, /* 31, 31, 30 */
109 -COS2_0, -COS2_3, COS3_0, /* 31, 29, 31 */
110 -COS2_1, -COS2_2, COS3_1, /* 31, 31, 30 */
111};

Referenced by FDCT32().

◆ fastWin36

int32_t fl::third_party::fastWin36[18]
Initial value:
= {
static_cast<int32_t>(0x42aace8bU), static_cast<int32_t>(0xc2e92724U), static_cast<int32_t>(0x47311c28U), static_cast<int32_t>(0xc95f619aU), static_cast<int32_t>(0x4a868febU), static_cast<int32_t>(0xd0859d8cU),
static_cast<int32_t>(0x4c913b51U), static_cast<int32_t>(0xd8243ea0U), static_cast<int32_t>(0x4d413cccU), static_cast<int32_t>(0xe0000000U), static_cast<int32_t>(0x4c913b51U), static_cast<int32_t>(0xe7dbc161U),
static_cast<int32_t>(0x4a868febU), static_cast<int32_t>(0xef7a6275U), static_cast<int32_t>(0x47311c28U), static_cast<int32_t>(0xf6a09e67U), static_cast<int32_t>(0x42aace8bU), static_cast<int32_t>(0xfd16d8ddU),
}

Definition at line 342 of file imdct.hpp.

342 {
343 static_cast<int32_t>(0x42aace8bU), static_cast<int32_t>(0xc2e92724U), static_cast<int32_t>(0x47311c28U), static_cast<int32_t>(0xc95f619aU), static_cast<int32_t>(0x4a868febU), static_cast<int32_t>(0xd0859d8cU),
344 static_cast<int32_t>(0x4c913b51U), static_cast<int32_t>(0xd8243ea0U), static_cast<int32_t>(0x4d413cccU), static_cast<int32_t>(0xe0000000U), static_cast<int32_t>(0x4c913b51U), static_cast<int32_t>(0xe7dbc161U),
345 static_cast<int32_t>(0x4a868febU), static_cast<int32_t>(0xef7a6275U), static_cast<int32_t>(0x47311c28U), static_cast<int32_t>(0xf6a09e67U), static_cast<int32_t>(0x42aace8bU), static_cast<int32_t>(0xfd16d8ddU),
346};

Referenced by IMDCT36().

◆ huffTable

const unsigned short fl::third_party::huffTable

Definition at line 81 of file hufftabs.hpp.

81 {
82 /* huffTable01[9] */
83 0xf003, 0x3112, 0x3101, 0x2011, 0x2011, 0x1000, 0x1000, 0x1000,
84 0x1000,
85
86 /* huffTable02[65] */
87 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021,
88 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
89 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
90 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
91 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
92 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
93 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
94 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
95 0x1000,
96
97 /* huffTable03[65] */
98 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021,
99 0x5021, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
100 0x3011, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
101 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
102 0x2112, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101,
103 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101,
104 0x2101, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
105 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
106 0x2000,
107
108 /* huffTable05[257] */
109 0xf008, 0x8332, 0x8322, 0x7232, 0x7232, 0x6132, 0x6132, 0x6132,
110 0x6132, 0x7312, 0x7312, 0x7301, 0x7301, 0x7031, 0x7031, 0x7222,
111 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122,
112 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021,
113 0x6021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
114 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
115 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
116 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
117 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
118 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
119 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
120 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
121 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
122 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
123 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
124 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
125 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
126 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
127 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
128 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
129 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
130 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
131 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
132 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
133 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
134 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
135 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
136 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
137 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
138 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
139 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
140 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
141 0x1000,
142
143 /* huffTable06[129] */
144 0xf007, 0x7332, 0x7301, 0x6322, 0x6322, 0x6232, 0x6232, 0x6031,
145 0x6031, 0x5312, 0x5312, 0x5312, 0x5312, 0x5132, 0x5132, 0x5132,
146 0x5132, 0x5222, 0x5222, 0x5222, 0x5222, 0x5201, 0x5201, 0x5201,
147 0x5201, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
148 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122,
149 0x4122, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021,
150 0x4021, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
151 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
152 0x3101, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
153 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
154 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
155 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
156 0x2112, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
157 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
158 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
159 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
160 0x3000,
161
162 /* huffTable07[110] */
163 0xf006, 0x0041, 0x0052, 0x005b, 0x0060, 0x0063, 0x0068, 0x006b,
164 0x6212, 0x5122, 0x5122, 0x6201, 0x6021, 0x4112, 0x4112, 0x4112,
165 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
166 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
167 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
168 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
169 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
170 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
171 0x1000, 0xf004, 0x4552, 0x4542, 0x4452, 0x4352, 0x3532, 0x3532,
172 0x3442, 0x3442, 0x3522, 0x3522, 0x3252, 0x3252, 0x2512, 0x2512,
173 0x2512, 0x2512, 0xf003, 0x2152, 0x2152, 0x3501, 0x3432, 0x2051,
174 0x2051, 0x3342, 0x3332, 0xf002, 0x2422, 0x2242, 0x1412, 0x1412,
175 0xf001, 0x1142, 0x1041, 0xf002, 0x2401, 0x2322, 0x2232, 0x2301,
176 0xf001, 0x1312, 0x1132, 0xf001, 0x1031, 0x1222,
177
178 /* huffTable08[280] */
179 0xf008, 0x0101, 0x010a, 0x010f, 0x8512, 0x8152, 0x0112, 0x0115,
180 0x8422, 0x8242, 0x8412, 0x7142, 0x7142, 0x8401, 0x8041, 0x8322,
181 0x8232, 0x8312, 0x8132, 0x8301, 0x8031, 0x6222, 0x6222, 0x6222,
182 0x6222, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021,
183 0x6021, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
184 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
185 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122,
186 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122,
187 0x4122, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
188 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
189 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
190 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
191 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
192 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
193 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
194 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112,
195 0x2112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
196 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
197 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
198 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
199 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
200 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
201 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
202 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
203 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
204 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
205 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
206 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
207 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
208 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
209 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
210 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
211 0x2000, 0xf003, 0x3552, 0x3452, 0x2542, 0x2542, 0x1352, 0x1352,
212 0x1352, 0x1352, 0xf002, 0x2532, 0x2442, 0x1522, 0x1522, 0xf001,
213 0x1252, 0x1501, 0xf001, 0x1432, 0x1342, 0xf001, 0x1051, 0x1332,
214
215 /* huffTable09[93] */
216 0xf006, 0x0041, 0x004a, 0x004f, 0x0052, 0x0057, 0x005a, 0x6412,
217 0x6142, 0x6322, 0x6232, 0x5312, 0x5312, 0x5132, 0x5132, 0x6301,
218 0x6031, 0x5222, 0x5222, 0x5201, 0x5201, 0x4212, 0x4212, 0x4212,
219 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4021, 0x4021, 0x4021,
220 0x4021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
221 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
222 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
223 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
224 0x3000, 0xf003, 0x3552, 0x3542, 0x2532, 0x2532, 0x2352, 0x2352,
225 0x3452, 0x3501, 0xf002, 0x2442, 0x2522, 0x2252, 0x2512, 0xf001,
226 0x1152, 0x1432, 0xf002, 0x1342, 0x1342, 0x2051, 0x2401, 0xf001,
227 0x1422, 0x1242, 0xf001, 0x1332, 0x1041,
228
229 /* huffTable10[320] */
230 0xf008, 0x0101, 0x010a, 0x010f, 0x0118, 0x011b, 0x0120, 0x0125,
231 0x8712, 0x8172, 0x012a, 0x012d, 0x0132, 0x8612, 0x8162, 0x8061,
232 0x0137, 0x013a, 0x013d, 0x8412, 0x8142, 0x8041, 0x8322, 0x8232,
233 0x8301, 0x7312, 0x7312, 0x7132, 0x7132, 0x7031, 0x7031, 0x7222,
234 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122,
235 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021,
236 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
237 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
238 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
239 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
240 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
241 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
242 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
243 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
244 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
245 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
246 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
247 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
248 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
249 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
250 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
251 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
252 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
253 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
254 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
255 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
256 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
257 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
258 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
259 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
260 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
261 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
262 0x1000, 0xf003, 0x3772, 0x3762, 0x3672, 0x3752, 0x3572, 0x3662,
263 0x2742, 0x2742, 0xf002, 0x2472, 0x2652, 0x2562, 0x2732, 0xf003,
264 0x2372, 0x2372, 0x2642, 0x2642, 0x3552, 0x3452, 0x2362, 0x2362,
265 0xf001, 0x1722, 0x1272, 0xf002, 0x2462, 0x2701, 0x1071, 0x1071,
266 0xf002, 0x1262, 0x1262, 0x2542, 0x2532, 0xf002, 0x1601, 0x1601,
267 0x2352, 0x2442, 0xf001, 0x1632, 0x1622, 0xf002, 0x2522, 0x2252,
268 0x1512, 0x1512, 0xf002, 0x1152, 0x1152, 0x2432, 0x2342, 0xf001,
269 0x1501, 0x1051, 0xf001, 0x1422, 0x1242, 0xf001, 0x1332, 0x1401,
270
271 /* huffTable11[296] */
272 0xf008, 0x0101, 0x0106, 0x010f, 0x0114, 0x0117, 0x8722, 0x8272,
273 0x011c, 0x7172, 0x7172, 0x8712, 0x8071, 0x8632, 0x8362, 0x8061,
274 0x011f, 0x0122, 0x8512, 0x7262, 0x7262, 0x8622, 0x8601, 0x7612,
275 0x7612, 0x7162, 0x7162, 0x8152, 0x8432, 0x8051, 0x0125, 0x8422,
276 0x8242, 0x8412, 0x8142, 0x8401, 0x8041, 0x7322, 0x7322, 0x7232,
277 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6132, 0x6132, 0x6132,
278 0x6132, 0x7301, 0x7301, 0x7031, 0x7031, 0x6222, 0x6222, 0x6222,
279 0x6222, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122,
280 0x5122, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
281 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
282 0x4212, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201,
283 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021,
284 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
285 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
286 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
287 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
288 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
289 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
290 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
291 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
292 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
293 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
294 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
295 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
296 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
297 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
298 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
299 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
300 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
301 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
302 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
303 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000,
304 0x2000, 0xf002, 0x2772, 0x2762, 0x2672, 0x2572, 0xf003, 0x2662,
305 0x2662, 0x2742, 0x2742, 0x2472, 0x2472, 0x3752, 0x3552, 0xf002,
306 0x2652, 0x2562, 0x1732, 0x1732, 0xf001, 0x1372, 0x1642, 0xf002,
307 0x2542, 0x2452, 0x2532, 0x2352, 0xf001, 0x1462, 0x1701, 0xf001,
308 0x1442, 0x1522, 0xf001, 0x1252, 0x1501, 0xf001, 0x1342, 0x1332,
309
310 /* huffTable12[185] */
311 0xf007, 0x0081, 0x008a, 0x008f, 0x0092, 0x0097, 0x009a, 0x009d,
312 0x00a2, 0x00a5, 0x00a8, 0x7622, 0x7262, 0x7162, 0x00ad, 0x00b0,
313 0x00b3, 0x7512, 0x7152, 0x7432, 0x7342, 0x00b6, 0x7422, 0x7242,
314 0x7412, 0x6332, 0x6332, 0x6142, 0x6142, 0x6322, 0x6322, 0x6232,
315 0x6232, 0x7041, 0x7301, 0x6031, 0x6031, 0x5312, 0x5312, 0x5312,
316 0x5312, 0x5132, 0x5132, 0x5132, 0x5132, 0x5222, 0x5222, 0x5222,
317 0x5222, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212,
318 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122,
319 0x4122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5021, 0x5021, 0x5021,
320 0x5021, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
321 0x4000, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
322 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
323 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
324 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101,
325 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
326 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
327 0x3011, 0xf003, 0x3772, 0x3762, 0x2672, 0x2672, 0x2752, 0x2752,
328 0x2572, 0x2572, 0xf002, 0x2662, 0x2742, 0x2472, 0x2562, 0xf001,
329 0x1652, 0x1732, 0xf002, 0x2372, 0x2552, 0x1722, 0x1722, 0xf001,
330 0x1272, 0x1642, 0xf001, 0x1462, 0x1712, 0xf002, 0x1172, 0x1172,
331 0x2701, 0x2071, 0xf001, 0x1632, 0x1362, 0xf001, 0x1542, 0x1452,
332 0xf002, 0x1442, 0x1442, 0x2601, 0x2501, 0xf001, 0x1612, 0x1061,
333 0xf001, 0x1532, 0x1352, 0xf001, 0x1522, 0x1252, 0xf001, 0x1051,
334 0x1401,
335
336 /* huffTable13[497] */
337 0xf006, 0x0041, 0x0082, 0x00c3, 0x00e4, 0x0105, 0x0116, 0x011f,
338 0x0130, 0x0139, 0x013e, 0x0143, 0x0146, 0x6212, 0x6122, 0x6201,
339 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4101, 0x4101, 0x4101,
340 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
341 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
342 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
343 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
344 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
345 0x1000, 0xf006, 0x0108, 0x0111, 0x011a, 0x0123, 0x012c, 0x0131,
346 0x0136, 0x013f, 0x0144, 0x0147, 0x014c, 0x0151, 0x0156, 0x015b,
347 0x6f12, 0x61f2, 0x60f1, 0x0160, 0x0163, 0x0166, 0x62e2, 0x0169,
348 0x6e12, 0x61e2, 0x016c, 0x016f, 0x0172, 0x0175, 0x0178, 0x017b,
349 0x66c2, 0x6d32, 0x017e, 0x6d22, 0x62d2, 0x6d12, 0x67b2, 0x0181,
350 0x0184, 0x63c2, 0x0187, 0x6b42, 0x51d2, 0x51d2, 0x6d01, 0x60d1,
351 0x6a82, 0x68a2, 0x6c42, 0x64c2, 0x6b62, 0x66b2, 0x5c32, 0x5c32,
352 0x5c22, 0x5c22, 0x52c2, 0x52c2, 0x5b52, 0x5b52, 0x65b2, 0x6982,
353 0x5c12, 0x5c12, 0xf006, 0x51c2, 0x51c2, 0x6892, 0x6c01, 0x50c1,
354 0x50c1, 0x64b2, 0x6a62, 0x66a2, 0x6972, 0x5b32, 0x5b32, 0x53b2,
355 0x53b2, 0x6882, 0x6a52, 0x5b22, 0x5b22, 0x65a2, 0x6962, 0x54a2,
356 0x54a2, 0x6872, 0x6782, 0x5492, 0x5492, 0x6772, 0x6672, 0x42b2,
357 0x42b2, 0x42b2, 0x42b2, 0x4b12, 0x4b12, 0x4b12, 0x4b12, 0x41b2,
358 0x41b2, 0x41b2, 0x41b2, 0x5b01, 0x5b01, 0x50b1, 0x50b1, 0x5692,
359 0x5692, 0x5a42, 0x5a42, 0x5a32, 0x5a32, 0x53a2, 0x53a2, 0x5952,
360 0x5952, 0x5592, 0x5592, 0x4a22, 0x4a22, 0x4a22, 0x4a22, 0x42a2,
361 0x42a2, 0x42a2, 0x42a2, 0xf005, 0x4a12, 0x4a12, 0x41a2, 0x41a2,
362 0x5a01, 0x5862, 0x40a1, 0x40a1, 0x5682, 0x5942, 0x4392, 0x4392,
363 0x5932, 0x5852, 0x5582, 0x5762, 0x4922, 0x4922, 0x4292, 0x4292,
364 0x5752, 0x5572, 0x4832, 0x4832, 0x4382, 0x4382, 0x5662, 0x5742,
365 0x5472, 0x5652, 0x5562, 0x5372, 0xf005, 0x3912, 0x3912, 0x3912,
366 0x3912, 0x3192, 0x3192, 0x3192, 0x3192, 0x4901, 0x4901, 0x4091,
367 0x4091, 0x4842, 0x4842, 0x4482, 0x4482, 0x4272, 0x4272, 0x5642,
368 0x5462, 0x3822, 0x3822, 0x3822, 0x3822, 0x3282, 0x3282, 0x3282,
369 0x3282, 0x3812, 0x3812, 0x3812, 0x3812, 0xf004, 0x4732, 0x4722,
370 0x3712, 0x3712, 0x3172, 0x3172, 0x4552, 0x4701, 0x4071, 0x4632,
371 0x4362, 0x4542, 0x4452, 0x4622, 0x4262, 0x4532, 0xf003, 0x2182,
372 0x2182, 0x3801, 0x3081, 0x3612, 0x3162, 0x3601, 0x3061, 0xf004,
373 0x4352, 0x4442, 0x3522, 0x3522, 0x3252, 0x3252, 0x3501, 0x3501,
374 0x2512, 0x2512, 0x2512, 0x2512, 0x2152, 0x2152, 0x2152, 0x2152,
375 0xf003, 0x3432, 0x3342, 0x3051, 0x3422, 0x3242, 0x3332, 0x2412,
376 0x2412, 0xf002, 0x1142, 0x1142, 0x2401, 0x2041, 0xf002, 0x2322,
377 0x2232, 0x1312, 0x1312, 0xf001, 0x1132, 0x1301, 0xf001, 0x1031,
378 0x1222, 0xf003, 0x0082, 0x008b, 0x008e, 0x0091, 0x0094, 0x0097,
379 0x3ce2, 0x3dd2, 0xf003, 0x0093, 0x3eb2, 0x3be2, 0x3f92, 0x39f2,
380 0x3ae2, 0x3db2, 0x3bd2, 0xf003, 0x3f82, 0x38f2, 0x3cc2, 0x008d,
381 0x3e82, 0x0090, 0x27f2, 0x27f2, 0xf003, 0x2ad2, 0x2ad2, 0x3da2,
382 0x3cb2, 0x3bc2, 0x36f2, 0x2f62, 0x2f62, 0xf002, 0x28e2, 0x2f52,
383 0x2d92, 0x29d2, 0xf002, 0x25f2, 0x27e2, 0x2ca2, 0x2bb2, 0xf003,
384 0x2f42, 0x2f42, 0x24f2, 0x24f2, 0x3ac2, 0x36e2, 0x23f2, 0x23f2,
385 0xf002, 0x1f32, 0x1f32, 0x2d82, 0x28d2, 0xf001, 0x1f22, 0x12f2,
386 0xf002, 0x2e62, 0x2c92, 0x1f01, 0x1f01, 0xf002, 0x29c2, 0x2e52,
387 0x1ba2, 0x1ba2, 0xf002, 0x2d72, 0x27d2, 0x1e42, 0x1e42, 0xf002,
388 0x28c2, 0x26d2, 0x1e32, 0x1e32, 0xf002, 0x19b2, 0x19b2, 0x2b92,
389 0x2aa2, 0xf001, 0x1ab2, 0x15e2, 0xf001, 0x14e2, 0x1c82, 0xf001,
390 0x1d62, 0x13e2, 0xf001, 0x1e22, 0x1e01, 0xf001, 0x10e1, 0x1d52,
391 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001, 0x1b82,
392 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62, 0xf001,
393 0x13d2, 0x1b72, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1992, 0x1a72,
394 0xf001, 0x17a2, 0x1792, 0xf003, 0x0023, 0x3df2, 0x2de2, 0x2de2,
395 0x1ff2, 0x1ff2, 0x1ff2, 0x1ff2, 0xf001, 0x1fe2, 0x1fd2, 0xf001,
396 0x1ee2, 0x1fc2, 0xf001, 0x1ed2, 0x1fb2, 0xf001, 0x1bf2, 0x1ec2,
397 0xf002, 0x1cd2, 0x1cd2, 0x2fa2, 0x29e2, 0xf001, 0x1af2, 0x1dc2,
398 0xf001, 0x1ea2, 0x1e92, 0xf001, 0x1f72, 0x1e72, 0xf001, 0x1ef2,
399 0x1cf2,
400
401 /* huffTable15[580] */
402 0xf008, 0x0101, 0x0122, 0x0143, 0x0154, 0x0165, 0x0176, 0x017f,
403 0x0188, 0x0199, 0x01a2, 0x01ab, 0x01b4, 0x01bd, 0x01c2, 0x01cb,
404 0x01d4, 0x01d9, 0x01de, 0x01e3, 0x01e8, 0x01ed, 0x01f2, 0x01f7,
405 0x01fc, 0x0201, 0x0204, 0x0207, 0x020a, 0x020f, 0x0212, 0x0215,
406 0x021a, 0x021d, 0x0220, 0x8192, 0x0223, 0x0226, 0x0229, 0x022c,
407 0x022f, 0x8822, 0x8282, 0x8812, 0x8182, 0x0232, 0x0235, 0x0238,
408 0x023b, 0x8722, 0x8272, 0x8462, 0x8712, 0x8552, 0x8172, 0x023e,
409 0x8632, 0x8362, 0x8542, 0x8452, 0x8622, 0x8262, 0x8612, 0x0241,
410 0x8532, 0x7162, 0x7162, 0x8352, 0x8442, 0x7522, 0x7522, 0x7252,
411 0x7252, 0x7512, 0x7512, 0x7152, 0x7152, 0x8501, 0x8051, 0x7432,
412 0x7432, 0x7342, 0x7342, 0x7422, 0x7422, 0x7242, 0x7242, 0x7332,
413 0x7332, 0x6142, 0x6142, 0x6142, 0x6142, 0x7412, 0x7412, 0x7401,
414 0x7401, 0x6322, 0x6322, 0x6322, 0x6322, 0x6232, 0x6232, 0x6232,
415 0x6232, 0x7041, 0x7041, 0x7301, 0x7301, 0x6312, 0x6312, 0x6312,
416 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6031, 0x6031, 0x6031,
417 0x6031, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222,
418 0x5222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212,
419 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122,
420 0x5122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201,
421 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021,
422 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
423 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
424 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
425 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112,
426 0x3112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
427 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
428 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
429 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
430 0x4011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
431 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
432 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
433 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000,
434 0x3000, 0xf005, 0x5ff2, 0x5fe2, 0x5ef2, 0x5fd2, 0x4ee2, 0x4ee2,
435 0x5df2, 0x5fc2, 0x5cf2, 0x5ed2, 0x5de2, 0x5fb2, 0x4bf2, 0x4bf2,
436 0x5ec2, 0x5ce2, 0x4dd2, 0x4dd2, 0x4fa2, 0x4fa2, 0x4af2, 0x4af2,
437 0x4eb2, 0x4eb2, 0x4be2, 0x4be2, 0x4dc2, 0x4dc2, 0x4cd2, 0x4cd2,
438 0x4f92, 0x4f92, 0xf005, 0x49f2, 0x49f2, 0x4ae2, 0x4ae2, 0x4db2,
439 0x4db2, 0x4bd2, 0x4bd2, 0x4f82, 0x4f82, 0x48f2, 0x48f2, 0x4cc2,
440 0x4cc2, 0x4e92, 0x4e92, 0x49e2, 0x49e2, 0x4f72, 0x4f72, 0x47f2,
441 0x47f2, 0x4da2, 0x4da2, 0x4ad2, 0x4ad2, 0x4cb2, 0x4cb2, 0x4f62,
442 0x4f62, 0x5ea2, 0x5f01, 0xf004, 0x3bc2, 0x3bc2, 0x36f2, 0x36f2,
443 0x4e82, 0x48e2, 0x4f52, 0x4d92, 0x35f2, 0x35f2, 0x3e72, 0x3e72,
444 0x37e2, 0x37e2, 0x3ca2, 0x3ca2, 0xf004, 0x3ac2, 0x3ac2, 0x3bb2,
445 0x3bb2, 0x49d2, 0x4d82, 0x3f42, 0x3f42, 0x34f2, 0x34f2, 0x3f32,
446 0x3f32, 0x33f2, 0x33f2, 0x38d2, 0x38d2, 0xf004, 0x36e2, 0x36e2,
447 0x3f22, 0x3f22, 0x32f2, 0x32f2, 0x4e62, 0x40f1, 0x3f12, 0x3f12,
448 0x31f2, 0x31f2, 0x3c92, 0x3c92, 0x39c2, 0x39c2, 0xf003, 0x3e52,
449 0x3ba2, 0x3ab2, 0x35e2, 0x3d72, 0x37d2, 0x3e42, 0x34e2, 0xf003,
450 0x3c82, 0x38c2, 0x3e32, 0x3d62, 0x36d2, 0x33e2, 0x3b92, 0x39b2,
451 0xf004, 0x3e22, 0x3e22, 0x3aa2, 0x3aa2, 0x32e2, 0x32e2, 0x3e12,
452 0x3e12, 0x31e2, 0x31e2, 0x4e01, 0x40e1, 0x3d52, 0x3d52, 0x35d2,
453 0x35d2, 0xf003, 0x3c72, 0x37c2, 0x3d42, 0x3b82, 0x24d2, 0x24d2,
454 0x38b2, 0x3a92, 0xf003, 0x39a2, 0x3c62, 0x36c2, 0x3d32, 0x23d2,
455 0x23d2, 0x22d2, 0x22d2, 0xf003, 0x3d22, 0x3d01, 0x2d12, 0x2d12,
456 0x2b72, 0x2b72, 0x27b2, 0x27b2, 0xf003, 0x21d2, 0x21d2, 0x3c52,
457 0x30d1, 0x25c2, 0x25c2, 0x2a82, 0x2a82, 0xf002, 0x28a2, 0x2c42,
458 0x24c2, 0x2b62, 0xf003, 0x26b2, 0x26b2, 0x3992, 0x3c01, 0x2c32,
459 0x2c32, 0x23c2, 0x23c2, 0xf003, 0x2a72, 0x2a72, 0x27a2, 0x27a2,
460 0x26a2, 0x26a2, 0x30c1, 0x3b01, 0xf002, 0x12c2, 0x12c2, 0x2c22,
461 0x2b52, 0xf002, 0x25b2, 0x2c12, 0x2982, 0x2892, 0xf002, 0x21c2,
462 0x2b42, 0x24b2, 0x2a62, 0xf002, 0x2b32, 0x2972, 0x13b2, 0x13b2,
463 0xf002, 0x2792, 0x2882, 0x2b22, 0x2a52, 0xf002, 0x12b2, 0x12b2,
464 0x25a2, 0x2b12, 0xf002, 0x11b2, 0x11b2, 0x20b1, 0x2962, 0xf002,
465 0x2692, 0x2a42, 0x24a2, 0x2872, 0xf002, 0x2782, 0x2a32, 0x13a2,
466 0x13a2, 0xf001, 0x1952, 0x1592, 0xf001, 0x1a22, 0x12a2, 0xf001,
467 0x1a12, 0x11a2, 0xf002, 0x2a01, 0x20a1, 0x1862, 0x1862, 0xf001,
468 0x1682, 0x1942, 0xf001, 0x1492, 0x1932, 0xf002, 0x1392, 0x1392,
469 0x2772, 0x2901, 0xf001, 0x1852, 0x1582, 0xf001, 0x1922, 0x1762,
470 0xf001, 0x1672, 0x1292, 0xf001, 0x1912, 0x1091, 0xf001, 0x1842,
471 0x1482, 0xf001, 0x1752, 0x1572, 0xf001, 0x1832, 0x1382, 0xf001,
472 0x1662, 0x1742, 0xf001, 0x1472, 0x1801, 0xf001, 0x1081, 0x1652,
473 0xf001, 0x1562, 0x1732, 0xf001, 0x1372, 0x1642, 0xf001, 0x1701,
474 0x1071, 0xf001, 0x1601, 0x1061,
475
476 /* huffTable16[651] */
477 0xf008, 0x0101, 0x010a, 0x0113, 0x8ff2, 0x0118, 0x011d, 0x0120,
478 0x82f2, 0x0131, 0x8f12, 0x81f2, 0x0134, 0x0145, 0x0156, 0x0167,
479 0x0178, 0x0189, 0x019a, 0x01a3, 0x01ac, 0x01b5, 0x01be, 0x01c7,
480 0x01d0, 0x01d9, 0x01de, 0x01e3, 0x01e6, 0x01eb, 0x01f0, 0x8152,
481 0x01f3, 0x01f6, 0x01f9, 0x01fc, 0x8412, 0x8142, 0x01ff, 0x8322,
482 0x8232, 0x7312, 0x7312, 0x7132, 0x7132, 0x8301, 0x8031, 0x7222,
483 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122,
484 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021,
485 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
486 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
487 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
488 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
489 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
490 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
491 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
492 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011,
493 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
494 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
495 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
496 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
497 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
498 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
499 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
500 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
501 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
502 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
503 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
504 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
505 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
506 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
507 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
508 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
509 0x1000, 0xf003, 0x3fe2, 0x3ef2, 0x3fd2, 0x3df2, 0x3fc2, 0x3cf2,
510 0x3fb2, 0x3bf2, 0xf003, 0x2fa2, 0x2fa2, 0x3af2, 0x3f92, 0x39f2,
511 0x38f2, 0x2f82, 0x2f82, 0xf002, 0x2f72, 0x27f2, 0x2f62, 0x26f2,
512 0xf002, 0x2f52, 0x25f2, 0x1f42, 0x1f42, 0xf001, 0x14f2, 0x13f2,
513 0xf004, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1,
514 0x10f1, 0x2f32, 0x2f32, 0x2f32, 0x2f32, 0x00e2, 0x00f3, 0x00fc,
515 0x0105, 0xf001, 0x1f22, 0x1f01, 0xf004, 0x00fa, 0x00ff, 0x0104,
516 0x0109, 0x010c, 0x0111, 0x0116, 0x0119, 0x011e, 0x0123, 0x0128,
517 0x43e2, 0x012d, 0x0130, 0x0133, 0x0136, 0xf004, 0x0128, 0x012b,
518 0x012e, 0x4d01, 0x0131, 0x0134, 0x0137, 0x4c32, 0x013a, 0x4c12,
519 0x40c1, 0x013d, 0x32e2, 0x32e2, 0x4e22, 0x4e12, 0xf004, 0x43d2,
520 0x4d22, 0x42d2, 0x41d2, 0x4b32, 0x012f, 0x3d12, 0x3d12, 0x44c2,
521 0x4b62, 0x43c2, 0x47a2, 0x3c22, 0x3c22, 0x42c2, 0x45b2, 0xf004,
522 0x41c2, 0x4c01, 0x4b42, 0x44b2, 0x4a62, 0x46a2, 0x33b2, 0x33b2,
523 0x4a52, 0x45a2, 0x3b22, 0x3b22, 0x32b2, 0x32b2, 0x3b12, 0x3b12,
524 0xf004, 0x31b2, 0x31b2, 0x4b01, 0x40b1, 0x4962, 0x4692, 0x4a42,
525 0x44a2, 0x4872, 0x4782, 0x33a2, 0x33a2, 0x4a32, 0x4952, 0x3a22,
526 0x3a22, 0xf004, 0x4592, 0x4862, 0x31a2, 0x31a2, 0x4682, 0x4772,
527 0x3492, 0x3492, 0x4942, 0x4752, 0x3762, 0x3762, 0x22a2, 0x22a2,
528 0x22a2, 0x22a2, 0xf003, 0x2a12, 0x2a12, 0x3a01, 0x30a1, 0x3932,
529 0x3392, 0x3852, 0x3582, 0xf003, 0x2922, 0x2922, 0x2292, 0x2292,
530 0x3672, 0x3901, 0x2912, 0x2912, 0xf003, 0x2192, 0x2192, 0x3091,
531 0x3842, 0x3482, 0x3572, 0x3832, 0x3382, 0xf003, 0x3662, 0x3822,
532 0x2282, 0x2282, 0x3742, 0x3472, 0x2812, 0x2812, 0xf003, 0x2182,
533 0x2182, 0x2081, 0x2081, 0x3801, 0x3652, 0x2732, 0x2732, 0xf003,
534 0x2372, 0x2372, 0x3562, 0x3642, 0x2722, 0x2722, 0x2272, 0x2272,
535 0xf003, 0x3462, 0x3552, 0x2701, 0x2701, 0x1712, 0x1712, 0x1712,
536 0x1712, 0xf002, 0x1172, 0x1172, 0x2071, 0x2632, 0xf002, 0x2362,
537 0x2542, 0x2452, 0x2622, 0xf001, 0x1262, 0x1612, 0xf002, 0x1162,
538 0x1162, 0x2601, 0x2061, 0xf002, 0x1352, 0x1352, 0x2532, 0x2442,
539 0xf001, 0x1522, 0x1252, 0xf001, 0x1512, 0x1501, 0xf001, 0x1432,
540 0x1342, 0xf001, 0x1051, 0x1422, 0xf001, 0x1242, 0x1332, 0xf001,
541 0x1401, 0x1041, 0xf004, 0x4ec2, 0x0086, 0x3ed2, 0x3ed2, 0x39e2,
542 0x39e2, 0x4ae2, 0x49d2, 0x2ee2, 0x2ee2, 0x2ee2, 0x2ee2, 0x3de2,
543 0x3de2, 0x3be2, 0x3be2, 0xf003, 0x2eb2, 0x2eb2, 0x2dc2, 0x2dc2,
544 0x3cd2, 0x3bd2, 0x2ea2, 0x2ea2, 0xf003, 0x2cc2, 0x2cc2, 0x3da2,
545 0x3ad2, 0x3e72, 0x3ca2, 0x2ac2, 0x2ac2, 0xf003, 0x39c2, 0x3d72,
546 0x2e52, 0x2e52, 0x1db2, 0x1db2, 0x1db2, 0x1db2, 0xf002, 0x1e92,
547 0x1e92, 0x2cb2, 0x2bc2, 0xf002, 0x2e82, 0x28e2, 0x2d92, 0x27e2,
548 0xf002, 0x2bb2, 0x2d82, 0x28d2, 0x2e62, 0xf001, 0x16e2, 0x1c92,
549 0xf002, 0x2ba2, 0x2ab2, 0x25e2, 0x27d2, 0xf002, 0x1e42, 0x1e42,
550 0x24e2, 0x2c82, 0xf001, 0x18c2, 0x1e32, 0xf002, 0x1d62, 0x1d62,
551 0x26d2, 0x2b92, 0xf002, 0x29b2, 0x2aa2, 0x11e2, 0x11e2, 0xf002,
552 0x14d2, 0x14d2, 0x28b2, 0x29a2, 0xf002, 0x1b72, 0x1b72, 0x27b2,
553 0x20d1, 0xf001, 0x1e01, 0x10e1, 0xf001, 0x1d52, 0x15d2, 0xf001,
554 0x1c72, 0x17c2, 0xf001, 0x1d42, 0x1b82, 0xf001, 0x1a92, 0x1c62,
555 0xf001, 0x16c2, 0x1d32, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1a82,
556 0x18a2, 0xf001, 0x1992, 0x1c42, 0xf001, 0x16b2, 0x1a72, 0xf001,
557 0x1b52, 0x1982, 0xf001, 0x1892, 0x1972, 0xf001, 0x1792, 0x1882,
558 0xf001, 0x1ce2, 0x1dd2,
559
560 /* huffTable24[705] */
561 0xf009, 0x8fe2, 0x8fe2, 0x8ef2, 0x8ef2, 0x8fd2, 0x8fd2, 0x8df2,
562 0x8df2, 0x8fc2, 0x8fc2, 0x8cf2, 0x8cf2, 0x8fb2, 0x8fb2, 0x8bf2,
563 0x8bf2, 0x7af2, 0x7af2, 0x7af2, 0x7af2, 0x8fa2, 0x8fa2, 0x8f92,
564 0x8f92, 0x79f2, 0x79f2, 0x79f2, 0x79f2, 0x78f2, 0x78f2, 0x78f2,
565 0x78f2, 0x8f82, 0x8f82, 0x8f72, 0x8f72, 0x77f2, 0x77f2, 0x77f2,
566 0x77f2, 0x7f62, 0x7f62, 0x7f62, 0x7f62, 0x76f2, 0x76f2, 0x76f2,
567 0x76f2, 0x7f52, 0x7f52, 0x7f52, 0x7f52, 0x75f2, 0x75f2, 0x75f2,
568 0x75f2, 0x7f42, 0x7f42, 0x7f42, 0x7f42, 0x74f2, 0x74f2, 0x74f2,
569 0x74f2, 0x7f32, 0x7f32, 0x7f32, 0x7f32, 0x73f2, 0x73f2, 0x73f2,
570 0x73f2, 0x7f22, 0x7f22, 0x7f22, 0x7f22, 0x72f2, 0x72f2, 0x72f2,
571 0x72f2, 0x71f2, 0x71f2, 0x71f2, 0x71f2, 0x8f12, 0x8f12, 0x80f1,
572 0x80f1, 0x9f01, 0x0201, 0x0206, 0x020b, 0x0210, 0x0215, 0x021a,
573 0x021f, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2,
574 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2,
575 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2,
576 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2,
577 0x4ff2, 0x0224, 0x0229, 0x0232, 0x0237, 0x023a, 0x023f, 0x0242,
578 0x0245, 0x024a, 0x024d, 0x0250, 0x0253, 0x0256, 0x0259, 0x025c,
579 0x025f, 0x0262, 0x0265, 0x0268, 0x026b, 0x026e, 0x0271, 0x0274,
580 0x0277, 0x027a, 0x027d, 0x0280, 0x0283, 0x0288, 0x028b, 0x028e,
581 0x0291, 0x0294, 0x0297, 0x029a, 0x029f, 0x94b2, 0x02a4, 0x02a7,
582 0x02aa, 0x93b2, 0x9882, 0x02af, 0x92b2, 0x02b2, 0x02b5, 0x9692,
583 0x94a2, 0x02b8, 0x9782, 0x9a32, 0x93a2, 0x9952, 0x9592, 0x9a22,
584 0x92a2, 0x91a2, 0x9862, 0x9682, 0x9772, 0x9942, 0x9492, 0x9932,
585 0x9392, 0x9852, 0x9582, 0x9922, 0x9762, 0x9672, 0x9292, 0x9912,
586 0x9192, 0x9842, 0x9482, 0x9752, 0x9572, 0x9832, 0x9382, 0x9662,
587 0x9822, 0x9282, 0x9812, 0x9742, 0x9472, 0x9182, 0x02bb, 0x9652,
588 0x9562, 0x9712, 0x02be, 0x8372, 0x8372, 0x9732, 0x9722, 0x8272,
589 0x8272, 0x8642, 0x8642, 0x8462, 0x8462, 0x8552, 0x8552, 0x8172,
590 0x8172, 0x8632, 0x8632, 0x8362, 0x8362, 0x8542, 0x8542, 0x8452,
591 0x8452, 0x8622, 0x8622, 0x8262, 0x8262, 0x8612, 0x8612, 0x8162,
592 0x8162, 0x9601, 0x9061, 0x8532, 0x8532, 0x8352, 0x8352, 0x8442,
593 0x8442, 0x8522, 0x8522, 0x8252, 0x8252, 0x8512, 0x8512, 0x9501,
594 0x9051, 0x7152, 0x7152, 0x7152, 0x7152, 0x8432, 0x8432, 0x8342,
595 0x8342, 0x7422, 0x7422, 0x7422, 0x7422, 0x7242, 0x7242, 0x7242,
596 0x7242, 0x7332, 0x7332, 0x7332, 0x7332, 0x7412, 0x7412, 0x7412,
597 0x7412, 0x7142, 0x7142, 0x7142, 0x7142, 0x8401, 0x8401, 0x8041,
598 0x8041, 0x7322, 0x7322, 0x7322, 0x7322, 0x7232, 0x7232, 0x7232,
599 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312,
600 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132,
601 0x6132, 0x7301, 0x7301, 0x7301, 0x7301, 0x7031, 0x7031, 0x7031,
602 0x7031, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222,
603 0x6222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212,
604 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212,
605 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122,
606 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122,
607 0x5122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201,
608 0x6201, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021,
609 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
610 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
611 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
612 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112,
613 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
614 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
615 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
616 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101,
617 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
618 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
619 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
620 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011,
621 0x4011, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
622 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
623 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
624 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
625 0x4000, 0xf002, 0x2ee2, 0x2ed2, 0x2de2, 0x2ec2, 0xf002, 0x2ce2,
626 0x2dd2, 0x2eb2, 0x2be2, 0xf002, 0x2dc2, 0x2cd2, 0x2ea2, 0x2ae2,
627 0xf002, 0x2db2, 0x2bd2, 0x2cc2, 0x2e92, 0xf002, 0x29e2, 0x2da2,
628 0x2ad2, 0x2cb2, 0xf002, 0x2bc2, 0x2e82, 0x28e2, 0x2d92, 0xf002,
629 0x29d2, 0x2e72, 0x27e2, 0x2ca2, 0xf002, 0x2ac2, 0x2bb2, 0x2d82,
630 0x28d2, 0xf003, 0x3e01, 0x30e1, 0x2d01, 0x2d01, 0x16e2, 0x16e2,
631 0x16e2, 0x16e2, 0xf002, 0x2e62, 0x2c92, 0x19c2, 0x19c2, 0xf001,
632 0x1e52, 0x1ab2, 0xf002, 0x15e2, 0x15e2, 0x2ba2, 0x2d72, 0xf001,
633 0x17d2, 0x14e2, 0xf001, 0x1c82, 0x18c2, 0xf002, 0x2e42, 0x2e22,
634 0x1e32, 0x1e32, 0xf001, 0x1d62, 0x16d2, 0xf001, 0x13e2, 0x1b92,
635 0xf001, 0x19b2, 0x1aa2, 0xf001, 0x12e2, 0x1e12, 0xf001, 0x11e2,
636 0x1d52, 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001,
637 0x1b82, 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62,
638 0xf001, 0x16c2, 0x1d32, 0xf001, 0x13d2, 0x1d22, 0xf001, 0x12d2,
639 0x1d12, 0xf001, 0x1b72, 0x17b2, 0xf001, 0x11d2, 0x1c52, 0xf001,
640 0x15c2, 0x1a82, 0xf001, 0x18a2, 0x1992, 0xf001, 0x1c42, 0x14c2,
641 0xf001, 0x1b62, 0x16b2, 0xf002, 0x20d1, 0x2c01, 0x1c32, 0x1c32,
642 0xf001, 0x13c2, 0x1a72, 0xf001, 0x17a2, 0x1c22, 0xf001, 0x12c2,
643 0x1b52, 0xf001, 0x15b2, 0x1c12, 0xf001, 0x1982, 0x1892, 0xf001,
644 0x11c2, 0x1b42, 0xf002, 0x20c1, 0x2b01, 0x1b32, 0x1b32, 0xf002,
645 0x20b1, 0x2a01, 0x1a12, 0x1a12, 0xf001, 0x1a62, 0x16a2, 0xf001,
646 0x1972, 0x1792, 0xf002, 0x20a1, 0x2901, 0x1091, 0x1091, 0xf001,
647 0x1b22, 0x1a52, 0xf001, 0x15a2, 0x1b12, 0xf001, 0x11b2, 0x1962,
648 0xf001, 0x1a42, 0x1872, 0xf001, 0x1801, 0x1081, 0xf001, 0x1701,
649 0x1071,
650};

Referenced by DecodeHuffmanPairs().

◆ huffTabLookup

const HuffTabLookup fl::third_party::huffTabLookup

Definition at line 703 of file hufftabs.hpp.

703 {
704 { 0, noBits },
705 { 0, oneShot },
706 { 0, oneShot },
707 { 0, oneShot },
708 { 0, invalidTab },
709 { 0, oneShot },
710 { 0, oneShot },
711 { 0, loopNoLinbits },
712 { 0, loopNoLinbits },
713 { 0, loopNoLinbits },
714 { 0, loopNoLinbits },
715 { 0, loopNoLinbits },
716 { 0, loopNoLinbits },
717 { 0, loopNoLinbits },
718 { 0, invalidTab },
719 { 0, loopNoLinbits },
720 { 1, loopLinbits },
721 { 2, loopLinbits },
722 { 3, loopLinbits },
723 { 4, loopLinbits },
724 { 6, loopLinbits },
725 { 8, loopLinbits },
726 { 10, loopLinbits },
727 { 13, loopLinbits },
728 { 4, loopLinbits },
729 { 5, loopLinbits },
730 { 6, loopLinbits },
731 { 7, loopLinbits },
732 { 8, loopLinbits },
733 { 9, loopLinbits },
734 { 11, loopLinbits },
735 { 13, loopLinbits },
736};

Referenced by DecodeHuffmanPairs().

◆ huffTabOffset

const int32_t fl::third_party::huffTabOffset

Definition at line 668 of file hufftabs.hpp.

668 {
669 0,
673 0,
683 0,
701};
#define HUFF_OFFSET_15
Definition hufftabs.hpp:664
#define HUFF_OFFSET_24
Definition hufftabs.hpp:666
#define HUFF_OFFSET_02
Definition hufftabs.hpp:653
#define HUFF_OFFSET_10
Definition hufftabs.hpp:660
#define HUFF_OFFSET_09
Definition hufftabs.hpp:659
#define HUFF_OFFSET_16
Definition hufftabs.hpp:665
#define HUFF_OFFSET_06
Definition hufftabs.hpp:656
#define HUFF_OFFSET_03
Definition hufftabs.hpp:654
#define HUFF_OFFSET_05
Definition hufftabs.hpp:655
#define HUFF_OFFSET_01
Definition hufftabs.hpp:652
#define HUFF_OFFSET_08
Definition hufftabs.hpp:658
#define HUFF_OFFSET_11
Definition hufftabs.hpp:661
#define HUFF_OFFSET_07
Definition hufftabs.hpp:657
#define HUFF_OFFSET_12
Definition hufftabs.hpp:662
#define HUFF_OFFSET_13
Definition hufftabs.hpp:663

Referenced by DecodeHuffmanPairs().

◆ imdctWin

const int32_t fl::third_party::imdctWin
Initial value:
= {
{
0x02aace8b, 0x07311c28, 0x0a868fec, 0x0c913b52, 0x0d413ccd, 0x0c913b52, 0x0a868fec, 0x07311c28,
0x02aace8b, (int32_t)0xfd16d8dd, (int32_t)0xf6a09e66, (int32_t)0xef7a6275, (int32_t)0xe7dbc161, (int32_t)0xe0000000, (int32_t)0xd8243e9f, (int32_t)0xd0859d8b,
(int32_t)0xc95f619a, (int32_t)0xc2e92723, (int32_t)0xbd553175, (int32_t)0xb8cee3d8, (int32_t)0xb5797014, (int32_t)0xb36ec4ae, (int32_t)0xb2bec333, (int32_t)0xb36ec4ae,
(int32_t)0xb5797014, (int32_t)0xb8cee3d8, (int32_t)0xbd553175, (int32_t)0xc2e92723, (int32_t)0xc95f619a, (int32_t)0xd0859d8b, (int32_t)0xd8243e9f, (int32_t)0xe0000000,
(int32_t)0xe7dbc161, (int32_t)0xef7a6275, (int32_t)0xf6a09e66, (int32_t)0xfd16d8dd,
},
{
0x02aace8b, 0x07311c28, 0x0a868fec, 0x0c913b52, 0x0d413ccd, 0x0c913b52, 0x0a868fec, 0x07311c28,
0x02aace8b, (int32_t)0xfd16d8dd, (int32_t)0xf6a09e66, (int32_t)0xef7a6275, (int32_t)0xe7dbc161, (int32_t)0xe0000000, (int32_t)0xd8243e9f, (int32_t)0xd0859d8b,
(int32_t)0xc95f619a, (int32_t)0xc2e92723, (int32_t)0xbd44ef14, (int32_t)0xb831a052, (int32_t)0xb3aa3837, (int32_t)0xafb789a4, (int32_t)0xac6145bb, (int32_t)0xa9adecdc,
(int32_t)0xa864491f, (int32_t)0xad1868f0, (int32_t)0xb8431f49, (int32_t)0xc8f42236, (int32_t)0xdda8e6b1, (int32_t)0xf47755dc, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
},
{
0x07311c28, 0x0d413ccd, 0x07311c28, (int32_t)0xf6a09e66, (int32_t)0xe0000000, (int32_t)0xc95f619a, (int32_t)0xb8cee3d8, (int32_t)0xb2bec333,
(int32_t)0xb8cee3d8, (int32_t)0xc95f619a, (int32_t)0xe0000000, (int32_t)0xf6a09e66, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
},
{
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x028e9709, 0x04855ec0,
0x026743a1, (int32_t)0xfcde2c10, (int32_t)0xf515dc82, (int32_t)0xec93e53b, (int32_t)0xe4c880f8, (int32_t)0xdd5d0b08, (int32_t)0xd63510b7, (int32_t)0xcf5e834a,
(int32_t)0xc8e6b562, (int32_t)0xc2da4105, (int32_t)0xbd553175, (int32_t)0xb8cee3d8, (int32_t)0xb5797014, (int32_t)0xb36ec4ae, (int32_t)0xb2bec333, (int32_t)0xb36ec4ae,
(int32_t)0xb5797014, (int32_t)0xb8cee3d8, (int32_t)0xbd553175, (int32_t)0xc2e92723, (int32_t)0xc95f619a, (int32_t)0xd0859d8b, (int32_t)0xd8243e9f, (int32_t)0xe0000000,
(int32_t)0xe7dbc161, (int32_t)0xef7a6275, (int32_t)0xf6a09e66, (int32_t)0xfd16d8dd,
},
}

Definition at line 107 of file trigtabs.hpp.

107 {
108 {
109 0x02aace8b, 0x07311c28, 0x0a868fec, 0x0c913b52, 0x0d413ccd, 0x0c913b52, 0x0a868fec, 0x07311c28,
110 0x02aace8b, (int32_t)0xfd16d8dd, (int32_t)0xf6a09e66, (int32_t)0xef7a6275, (int32_t)0xe7dbc161, (int32_t)0xe0000000, (int32_t)0xd8243e9f, (int32_t)0xd0859d8b,
111 (int32_t)0xc95f619a, (int32_t)0xc2e92723, (int32_t)0xbd553175, (int32_t)0xb8cee3d8, (int32_t)0xb5797014, (int32_t)0xb36ec4ae, (int32_t)0xb2bec333, (int32_t)0xb36ec4ae,
112 (int32_t)0xb5797014, (int32_t)0xb8cee3d8, (int32_t)0xbd553175, (int32_t)0xc2e92723, (int32_t)0xc95f619a, (int32_t)0xd0859d8b, (int32_t)0xd8243e9f, (int32_t)0xe0000000,
113 (int32_t)0xe7dbc161, (int32_t)0xef7a6275, (int32_t)0xf6a09e66, (int32_t)0xfd16d8dd,
114 },
115 {
116 0x02aace8b, 0x07311c28, 0x0a868fec, 0x0c913b52, 0x0d413ccd, 0x0c913b52, 0x0a868fec, 0x07311c28,
117 0x02aace8b, (int32_t)0xfd16d8dd, (int32_t)0xf6a09e66, (int32_t)0xef7a6275, (int32_t)0xe7dbc161, (int32_t)0xe0000000, (int32_t)0xd8243e9f, (int32_t)0xd0859d8b,
118 (int32_t)0xc95f619a, (int32_t)0xc2e92723, (int32_t)0xbd44ef14, (int32_t)0xb831a052, (int32_t)0xb3aa3837, (int32_t)0xafb789a4, (int32_t)0xac6145bb, (int32_t)0xa9adecdc,
119 (int32_t)0xa864491f, (int32_t)0xad1868f0, (int32_t)0xb8431f49, (int32_t)0xc8f42236, (int32_t)0xdda8e6b1, (int32_t)0xf47755dc, 0x00000000, 0x00000000,
120 0x00000000, 0x00000000, 0x00000000, 0x00000000,
121 },
122 {
123 0x07311c28, 0x0d413ccd, 0x07311c28, (int32_t)0xf6a09e66, (int32_t)0xe0000000, (int32_t)0xc95f619a, (int32_t)0xb8cee3d8, (int32_t)0xb2bec333,
124 (int32_t)0xb8cee3d8, (int32_t)0xc95f619a, (int32_t)0xe0000000, (int32_t)0xf6a09e66, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
125 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
126 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
127 0x00000000, 0x00000000, 0x00000000, 0x00000000,
128 },
129 {
130 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x028e9709, 0x04855ec0,
131 0x026743a1, (int32_t)0xfcde2c10, (int32_t)0xf515dc82, (int32_t)0xec93e53b, (int32_t)0xe4c880f8, (int32_t)0xdd5d0b08, (int32_t)0xd63510b7, (int32_t)0xcf5e834a,
132 (int32_t)0xc8e6b562, (int32_t)0xc2da4105, (int32_t)0xbd553175, (int32_t)0xb8cee3d8, (int32_t)0xb5797014, (int32_t)0xb36ec4ae, (int32_t)0xb2bec333, (int32_t)0xb36ec4ae,
133 (int32_t)0xb5797014, (int32_t)0xb8cee3d8, (int32_t)0xbd553175, (int32_t)0xc2e92723, (int32_t)0xc95f619a, (int32_t)0xd0859d8b, (int32_t)0xd8243e9f, (int32_t)0xe0000000,
134 (int32_t)0xe7dbc161, (int32_t)0xef7a6275, (int32_t)0xf6a09e66, (int32_t)0xfd16d8dd,
135 },
136};

Referenced by IMDCT12x3(), IMDCT36(), and WinPrevious().

◆ Ipsf

const uint16_t fl::third_party::Ipsf[64]
static
Initial value:
= {
(uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
(uint16_t)(1.38704*8192), (uint16_t)(1.92388*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.08979*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.38268*8192),
(uint16_t)(1.30656*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.70711*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.36048*8192),
(uint16_t)(1.17588*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.38268*8192), (uint16_t)(1.17588*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.32442*8192),
(uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
(uint16_t)(0.78570*8192), (uint16_t)(1.08979*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.61732*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.21677*8192),
(uint16_t)(0.54120*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.29290*8192), (uint16_t)(0.14932*8192),
(uint16_t)(0.27590*8192), (uint16_t)(0.38268*8192), (uint16_t)(0.36048*8192), (uint16_t)(0.32442*8192), (uint16_t)(0.27590*8192), (uint16_t)(0.21678*8192), (uint16_t)(0.14932*8192), (uint16_t)(0.07612*8192)
}

Definition at line 64 of file tjpgd.cpp.hpp.

64 { /* See also aa_idct.png */
65 (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
66 (uint16_t)(1.38704*8192), (uint16_t)(1.92388*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.08979*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.38268*8192),
67 (uint16_t)(1.30656*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.70711*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.36048*8192),
68 (uint16_t)(1.17588*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.38268*8192), (uint16_t)(1.17588*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.32442*8192),
69 (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
70 (uint16_t)(0.78570*8192), (uint16_t)(1.08979*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.61732*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.21677*8192),
71 (uint16_t)(0.54120*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.29290*8192), (uint16_t)(0.14932*8192),
72 (uint16_t)(0.27590*8192), (uint16_t)(0.38268*8192), (uint16_t)(0.36048*8192), (uint16_t)(0.32442*8192), (uint16_t)(0.27590*8192), (uint16_t)(0.21678*8192), (uint16_t)(0.14932*8192), (uint16_t)(0.07612*8192)
73};

Referenced by create_qt_tbl().

◆ ISFIIP

const int32_t fl::third_party::ISFIIP
Initial value:
= {
{0x40000000, 0x00000000},
{0x40000000, 0x40000000},
}

Definition at line 218 of file trigtabs.hpp.

218 {
219 {0x40000000, 0x00000000}, /* mid-side off */
220 {0x40000000, 0x40000000}, /* mid-side on */
221};

Referenced by IntensityProcMPEG1(), and IntensityProcMPEG2().

◆ ISFMpeg1

const int32_t fl::third_party::ISFMpeg1
Initial value:
= {
{0x00000000, 0x0d8658ba, 0x176cf5d0, 0x20000000, 0x28930a2f, 0x3279a745, 0x40000000},
{0x00000000, 0x13207f5c, 0x2120fb83, 0x2d413ccc, 0x39617e16, 0x4761fa3d, 0x5a827999}
}

Definition at line 164 of file trigtabs.hpp.

164 {
165 {0x00000000, 0x0d8658ba, 0x176cf5d0, 0x20000000, 0x28930a2f, 0x3279a745, 0x40000000},
166 {0x00000000, 0x13207f5c, 0x2120fb83, 0x2d413ccc, 0x39617e16, 0x4761fa3d, 0x5a827999}
167};

Referenced by IntensityProcMPEG1().

◆ ISFMpeg2

const int32_t fl::third_party::ISFMpeg2
Initial value:
= {
{
{
0x40000000, 0x35d13f32, 0x2d413ccc, 0x260dfc14, 0x1fffffff, 0x1ae89f99, 0x16a09e66, 0x1306fe0a,
0x0fffffff, 0x0d744fcc, 0x0b504f33, 0x09837f05, 0x07ffffff, 0x06ba27e6, 0x05a82799, 0x04c1bf82,
},
{
0x5a827999, 0x4c1bf827, 0x3fffffff, 0x35d13f32, 0x2d413ccc, 0x260dfc13, 0x1fffffff, 0x1ae89f99,
0x16a09e66, 0x1306fe09, 0x0fffffff, 0x0d744fcc, 0x0b504f33, 0x09837f04, 0x07ffffff, 0x06ba27e6,
},
},
{
{
0x40000000, 0x2d413ccc, 0x20000000, 0x16a09e66, 0x10000000, 0x0b504f33, 0x08000000, 0x05a82799,
0x04000000, 0x02d413cc, 0x02000000, 0x016a09e6, 0x01000000, 0x00b504f3, 0x00800000, 0x005a8279,
},
{
0x5a827999, 0x3fffffff, 0x2d413ccc, 0x1fffffff, 0x16a09e66, 0x0fffffff, 0x0b504f33, 0x07ffffff,
0x05a82799, 0x03ffffff, 0x02d413cc, 0x01ffffff, 0x016a09e6, 0x00ffffff, 0x00b504f3, 0x007fffff,
}
}
}

Definition at line 186 of file trigtabs.hpp.

186 {
187{
188 {
189 /* intensityScale off, mid-side off */
190 0x40000000, 0x35d13f32, 0x2d413ccc, 0x260dfc14, 0x1fffffff, 0x1ae89f99, 0x16a09e66, 0x1306fe0a,
191 0x0fffffff, 0x0d744fcc, 0x0b504f33, 0x09837f05, 0x07ffffff, 0x06ba27e6, 0x05a82799, 0x04c1bf82,
192 },
193 {
194 /* intensityScale off, mid-side on */
195 0x5a827999, 0x4c1bf827, 0x3fffffff, 0x35d13f32, 0x2d413ccc, 0x260dfc13, 0x1fffffff, 0x1ae89f99,
196 0x16a09e66, 0x1306fe09, 0x0fffffff, 0x0d744fcc, 0x0b504f33, 0x09837f04, 0x07ffffff, 0x06ba27e6,
197 },
198},
199{
200 {
201 /* intensityScale on, mid-side off */
202 0x40000000, 0x2d413ccc, 0x20000000, 0x16a09e66, 0x10000000, 0x0b504f33, 0x08000000, 0x05a82799,
203 0x04000000, 0x02d413cc, 0x02000000, 0x016a09e6, 0x01000000, 0x00b504f3, 0x00800000, 0x005a8279,
204 },
205 /* intensityScale on, mid-side on */
206 {
207 0x5a827999, 0x3fffffff, 0x2d413ccc, 0x1fffffff, 0x16a09e66, 0x0fffffff, 0x0b504f33, 0x07ffffff,
208 0x05a82799, 0x03ffffff, 0x02d413cc, 0x01ffffff, 0x016a09e6, 0x00ffffff, 0x00b504f3, 0x007fffff,
209 }
210}
211};

Referenced by IntensityProcMPEG2().

◆ MAX_PCM_SAMPLES

fl::size fl::third_party::MAX_PCM_SAMPLES = 2304
constexpr

Definition at line 15 of file mp3.cpp.hpp.

Referenced by fl::third_party::Mp3HelixDecoder::init().

◆ NRTab

const char fl::third_party::NRTab[6][3][4]
static
Initial value:
= {
{ {6, 5, 5, 5},
{3, 3, 3, 3},
{6, 3, 3, 3},
},
{ {6, 5, 7, 3},
{3, 3, 4, 2},
{6, 3, 4, 2},
},
{ {11, 10, 0, 0},
{6, 6, 0, 0},
{6, 3, 6, 0},
},
{ {7, 7, 7, 0},
{4, 4, 4, 0},
{6, 5, 4, 0},
},
{ {6, 6, 6, 3},
{4, 3, 3, 2},
{6, 4, 3, 2},
},
{ {8, 8, 5, 0},
{5, 4, 3, 0},
{6, 6, 3, 0},
}
}

Definition at line 160 of file scalfact.hpp.

160 {
161 /* non-intensity stereo */
162 { {6, 5, 5, 5},
163 {3, 3, 3, 3}, /* includes / 3 */
164 {6, 3, 3, 3}, /* includes / 3 except for first entry */
165 },
166 { {6, 5, 7, 3},
167 {3, 3, 4, 2},
168 {6, 3, 4, 2},
169 },
170 { {11, 10, 0, 0},
171 {6, 6, 0, 0},
172 {6, 3, 6, 0}, /* spec = [15,18,0,0], but 15 = 6L + 9S, so move 9/3=3 into col 1, 18/3=6 into col 2 and adj. slen[1,2] below */
173 },
174 /* intensity stereo, right chan */
175 { {7, 7, 7, 0},
176 {4, 4, 4, 0},
177 {6, 5, 4, 0},
178 },
179 { {6, 6, 6, 3},
180 {4, 3, 3, 2},
181 {6, 4, 3, 2},
182 },
183 { {8, 8, 5, 0},
184 {5, 4, 3, 0},
185 {6, 6, 3, 0},
186 }
187};

Referenced by UnpackSFMPEG2().

◆ PLM_AUDIO_BIT_RATE

const short fl::third_party::PLM_AUDIO_BIT_RATE[]
static
Initial value:
= {
32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,
8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
}

Definition at line 3022 of file pl_mpeg.hpp.

3022 {
3023 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, // MPEG-1
3024 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 // MPEG-2
3025};

Referenced by plm_audio_decode_header().

◆ PLM_AUDIO_FRAME_SYNC

const int fl::third_party::PLM_AUDIO_FRAME_SYNC = 0x7ff
static

Definition at line 3002 of file pl_mpeg.hpp.

Referenced by plm_audio_decode_header().

◆ PLM_AUDIO_LAYER_I

const int fl::third_party::PLM_AUDIO_LAYER_I = 0x3
static

Definition at line 3010 of file pl_mpeg.hpp.

◆ PLM_AUDIO_LAYER_II

const int fl::third_party::PLM_AUDIO_LAYER_II = 0x2
static

Definition at line 3009 of file pl_mpeg.hpp.

Referenced by plm_audio_decode_header().

◆ PLM_AUDIO_LAYER_III

const int fl::third_party::PLM_AUDIO_LAYER_III = 0x1
static

Definition at line 3008 of file pl_mpeg.hpp.

◆ PLM_AUDIO_MODE_DUAL_CHANNEL

const int fl::third_party::PLM_AUDIO_MODE_DUAL_CHANNEL = 0x2
static

Definition at line 3014 of file pl_mpeg.hpp.

◆ PLM_AUDIO_MODE_JOINT_STEREO

const int fl::third_party::PLM_AUDIO_MODE_JOINT_STEREO = 0x1
static

Definition at line 3013 of file pl_mpeg.hpp.

Referenced by plm_audio_decode_header().

◆ PLM_AUDIO_MODE_MONO

const int fl::third_party::PLM_AUDIO_MODE_MONO = 0x3
static

Definition at line 3015 of file pl_mpeg.hpp.

Referenced by plm_audio_decode_frame(), and plm_audio_decode_header().

◆ PLM_AUDIO_MODE_STEREO

const int fl::third_party::PLM_AUDIO_MODE_STEREO = 0x0
static

Definition at line 3012 of file pl_mpeg.hpp.

◆ PLM_AUDIO_MPEG_1

const int fl::third_party::PLM_AUDIO_MPEG_1 = 0x3
static

Definition at line 3006 of file pl_mpeg.hpp.

Referenced by plm_audio_decode_header().

◆ PLM_AUDIO_MPEG_2

const int fl::third_party::PLM_AUDIO_MPEG_2 = 0x2
static

Definition at line 3005 of file pl_mpeg.hpp.

◆ PLM_AUDIO_MPEG_2_5

const int fl::third_party::PLM_AUDIO_MPEG_2_5 = 0x0
static

Definition at line 3004 of file pl_mpeg.hpp.

◆ PLM_AUDIO_QUANT_LUT_STEP_1

const uint8_t fl::third_party::PLM_AUDIO_QUANT_LUT_STEP_1[2][16]
static
Initial value:
= {
{ 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
{ 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2 }
}

Definition at line 3121 of file pl_mpeg.hpp.

3121 {
3122 // 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384 <- bitrate
3123 { 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, // mono
3124 // 16, 24, 28, 32, 40, 48, 56, 64, 80, 96,112,128,160,192 <- bitrate / chan
3125 { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2 } // stereo
3126};

Referenced by plm_audio_decode_frame().

◆ PLM_AUDIO_QUANT_LUT_STEP_3

const uint8_t fl::third_party::PLM_AUDIO_QUANT_LUT_STEP_3[3][32]
static
Initial value:
= {
{
0x44,0x44,
0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34
},
{
0x43,0x43,0x43,
0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,
0x20,0x20,0x20,0x20,0x20,0x20,0x20
},
{
0x45,0x45,0x45,0x45,
0x34,0x34,0x34,0x34,0x34,0x34,0x34,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24
}
}

Definition at line 3143 of file pl_mpeg.hpp.

3143 {
3144 // Low-rate table (3-B.2c and 3-B.2d)
3145 {
3146 0x44,0x44,
3147 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34
3148 },
3149 // High-rate table (3-B.2a and 3-B.2b)
3150 {
3151 0x43,0x43,0x43,
3152 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
3153 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,
3154 0x20,0x20,0x20,0x20,0x20,0x20,0x20
3155 },
3156 // MPEG-2 LSR table (B.2 in ISO 13818-3)
3157 {
3158 0x45,0x45,0x45,0x45,
3159 0x34,0x34,0x34,0x34,0x34,0x34,0x34,
3160 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
3161 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24
3162 }
3163};

Referenced by plm_audio_read_allocation().

◆ PLM_AUDIO_QUANT_LUT_STEP_4

const uint8_t fl::third_party::PLM_AUDIO_QUANT_LUT_STEP_4[6][16]
static
Initial value:
= {
{ 0, 1, 2, 17 },
{ 0, 1, 2, 3, 4, 5, 6, 17 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17 },
{ 0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 },
{ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
}

Definition at line 3166 of file pl_mpeg.hpp.

3166 {
3167 { 0, 1, 2, 17 },
3168 { 0, 1, 2, 3, 4, 5, 6, 17 },
3169 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17 },
3170 { 0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 },
3171 { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17 },
3172 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
3173};

Referenced by plm_audio_read_allocation().

◆ PLM_AUDIO_QUANT_TAB

const plm_quantizer_spec_t fl::third_party::PLM_AUDIO_QUANT_TAB[]
static
Initial value:
= {
{ 3, 1, 5 },
{ 5, 1, 7 },
{ 7, 0, 3 },
{ 9, 1, 10 },
{ 15, 0, 4 },
{ 31, 0, 5 },
{ 63, 0, 6 },
{ 127, 0, 7 },
{ 255, 0, 8 },
{ 511, 0, 9 },
{ 1023, 0, 10 },
{ 2047, 0, 11 },
{ 4095, 0, 12 },
{ 8191, 0, 13 },
{ 16383, 0, 14 },
{ 32767, 0, 15 },
{ 65535, 0, 16 }
}

Definition at line 3181 of file pl_mpeg.hpp.

3181 {
3182 { 3, 1, 5 }, // 1
3183 { 5, 1, 7 }, // 2
3184 { 7, 0, 3 }, // 3
3185 { 9, 1, 10 }, // 4
3186 { 15, 0, 4 }, // 5
3187 { 31, 0, 5 }, // 6
3188 { 63, 0, 6 }, // 7
3189 { 127, 0, 7 }, // 8
3190 { 255, 0, 8 }, // 9
3191 { 511, 0, 9 }, // 10
3192 { 1023, 0, 10 }, // 11
3193 { 2047, 0, 11 }, // 12
3194 { 4095, 0, 12 }, // 13
3195 { 8191, 0, 13 }, // 14
3196 { 16383, 0, 14 }, // 15
3197 { 32767, 0, 15 }, // 16
3198 { 65535, 0, 16 } // 17
3199};

Referenced by plm_audio_read_allocation().

◆ PLM_AUDIO_SAMPLE_RATE

const unsigned short fl::third_party::PLM_AUDIO_SAMPLE_RATE[]
static
Initial value:
= {
44100, 48000, 32000, 0,
22050, 24000, 16000, 0
}

Definition at line 3017 of file pl_mpeg.hpp.

3017 {
3018 44100, 48000, 32000, 0, // MPEG-1
3019 22050, 24000, 16000, 0 // MPEG-2
3020};

Referenced by plm_audio_decode(), plm_audio_decode_header(), plm_audio_get_samplerate(), and plm_audio_set_time().

◆ PLM_AUDIO_SCALEFACTOR_BASE

const int32_t fl::third_party::PLM_AUDIO_SCALEFACTOR_BASE[]
static
Initial value:
= {
0x02000000, 0x01965FEA, 0x01428A30
}

Definition at line 3027 of file pl_mpeg.hpp.

3027 {
3028 0x02000000, 0x01965FEA, 0x01428A30
3029};

Referenced by plm_audio_read_samples().

◆ PLM_AUDIO_SYNTHESIS_WINDOW

const float fl::third_party::PLM_AUDIO_SYNTHESIS_WINDOW[]
static

Definition at line 3031 of file pl_mpeg.hpp.

3031 {
3032 0.0, -0.5, -0.5, -0.5, -0.5, -0.5,
3033 -0.5, -1.0, -1.0, -1.0, -1.0, -1.5,
3034 -1.5, -2.0, -2.0, -2.5, -2.5, -3.0,
3035 -3.5, -3.5, -4.0, -4.5, -5.0, -5.5,
3036 -6.5, -7.0, -8.0, -8.5, -9.5, -10.5,
3037 -12.0, -13.0, -14.5, -15.5, -17.5, -19.0,
3038 -20.5, -22.5, -24.5, -26.5, -29.0, -31.5,
3039 -34.0, -36.5, -39.5, -42.5, -45.5, -48.5,
3040 -52.0, -55.5, -58.5, -62.5, -66.0, -69.5,
3041 -73.5, -77.0, -80.5, -84.5, -88.0, -91.5,
3042 -95.0, -98.0, -101.0, -104.0, 106.5, 109.0,
3043 111.0, 112.5, 113.5, 114.0, 114.0, 113.5,
3044 112.0, 110.5, 107.5, 104.0, 100.0, 94.5,
3045 88.5, 81.5, 73.0, 63.5, 53.0, 41.5,
3046 28.5, 14.5, -1.0, -18.0, -36.0, -55.5,
3047 -76.5, -98.5, -122.0, -147.0, -173.5, -200.5,
3048 -229.5, -259.5, -290.5, -322.5, -355.5, -389.5,
3049 -424.0, -459.5, -495.5, -532.0, -568.5, -605.0,
3050 -641.5, -678.0, -714.0, -749.0, -783.5, -817.0,
3051 -849.0, -879.5, -908.5, -935.0, -959.5, -981.0,
3052 -1000.5, -1016.0, -1028.5, -1037.5, -1042.5, -1043.5,
3053 -1040.0, -1031.5, 1018.5, 1000.0, 976.0, 946.5,
3054 911.0, 869.5, 822.0, 767.5, 707.0, 640.0,
3055 565.5, 485.0, 397.0, 302.5, 201.0, 92.5,
3056 -22.5, -144.0, -272.5, -407.0, -547.5, -694.0,
3057 -846.0, -1003.0, -1165.0, -1331.5, -1502.0, -1675.5,
3058 -1852.5, -2031.5, -2212.5, -2394.0, -2576.5, -2758.5,
3059 -2939.5, -3118.5, -3294.5, -3467.5, -3635.5, -3798.5,
3060 -3955.0, -4104.5, -4245.5, -4377.5, -4499.0, -4609.5,
3061 -4708.0, -4792.5, -4863.5, -4919.0, -4958.0, -4979.5,
3062 -4983.0, -4967.5, -4931.5, -4875.0, -4796.0, -4694.5,
3063 -4569.5, -4420.0, -4246.0, -4046.0, -3820.0, -3567.0,
3064 3287.0, 2979.5, 2644.0, 2280.5, 1888.0, 1467.5,
3065 1018.5, 541.0, 35.0, -499.0, -1061.0, -1650.0,
3066 -2266.5, -2909.0, -3577.0, -4270.0, -4987.5, -5727.5,
3067 -6490.0, -7274.0, -8077.5, -8899.5, -9739.0, -10594.5,
3068 -11464.5, -12347.0, -13241.0, -14144.5, -15056.0, -15973.5,
3069 -16895.5, -17820.0, -18744.5, -19668.0, -20588.0, -21503.0,
3070 -22410.5, -23308.5, -24195.0, -25068.5, -25926.5, -26767.0,
3071 -27589.0, -28389.0, -29166.5, -29919.0, -30644.5, -31342.0,
3072 -32009.5, -32645.0, -33247.0, -33814.5, -34346.0, -34839.5,
3073 -35295.0, -35710.0, -36084.5, -36417.5, -36707.5, -36954.0,
3074 -37156.5, -37315.0, -37428.0, -37496.0, 37519.0, 37496.0,
3075 37428.0, 37315.0, 37156.5, 36954.0, 36707.5, 36417.5,
3076 36084.5, 35710.0, 35295.0, 34839.5, 34346.0, 33814.5,
3077 33247.0, 32645.0, 32009.5, 31342.0, 30644.5, 29919.0,
3078 29166.5, 28389.0, 27589.0, 26767.0, 25926.5, 25068.5,
3079 24195.0, 23308.5, 22410.5, 21503.0, 20588.0, 19668.0,
3080 18744.5, 17820.0, 16895.5, 15973.5, 15056.0, 14144.5,
3081 13241.0, 12347.0, 11464.5, 10594.5, 9739.0, 8899.5,
3082 8077.5, 7274.0, 6490.0, 5727.5, 4987.5, 4270.0,
3083 3577.0, 2909.0, 2266.5, 1650.0, 1061.0, 499.0,
3084 -35.0, -541.0, -1018.5, -1467.5, -1888.0, -2280.5,
3085 -2644.0, -2979.5, 3287.0, 3567.0, 3820.0, 4046.0,
3086 4246.0, 4420.0, 4569.5, 4694.5, 4796.0, 4875.0,
3087 4931.5, 4967.5, 4983.0, 4979.5, 4958.0, 4919.0,
3088 4863.5, 4792.5, 4708.0, 4609.5, 4499.0, 4377.5,
3089 4245.5, 4104.5, 3955.0, 3798.5, 3635.5, 3467.5,
3090 3294.5, 3118.5, 2939.5, 2758.5, 2576.5, 2394.0,
3091 2212.5, 2031.5, 1852.5, 1675.5, 1502.0, 1331.5,
3092 1165.0, 1003.0, 846.0, 694.0, 547.5, 407.0,
3093 272.5, 144.0, 22.5, -92.5, -201.0, -302.5,
3094 -397.0, -485.0, -565.5, -640.0, -707.0, -767.5,
3095 -822.0, -869.5, -911.0, -946.5, -976.0, -1000.0,
3096 1018.5, 1031.5, 1040.0, 1043.5, 1042.5, 1037.5,
3097 1028.5, 1016.0, 1000.5, 981.0, 959.5, 935.0,
3098 908.5, 879.5, 849.0, 817.0, 783.5, 749.0,
3099 714.0, 678.0, 641.5, 605.0, 568.5, 532.0,
3100 495.5, 459.5, 424.0, 389.5, 355.5, 322.5,
3101 290.5, 259.5, 229.5, 200.5, 173.5, 147.0,
3102 122.0, 98.5, 76.5, 55.5, 36.0, 18.0,
3103 1.0, -14.5, -28.5, -41.5, -53.0, -63.5,
3104 -73.0, -81.5, -88.5, -94.5, -100.0, -104.0,
3105 -107.5, -110.5, -112.0, -113.5, -114.0, -114.0,
3106 -113.5, -112.5, -111.0, -109.0, 106.5, 104.0,
3107 101.0, 98.0, 95.0, 91.5, 88.0, 84.5,
3108 80.5, 77.0, 73.5, 69.5, 66.0, 62.5,
3109 58.5, 55.5, 52.0, 48.5, 45.5, 42.5,
3110 39.5, 36.5, 34.0, 31.5, 29.0, 26.5,
3111 24.5, 22.5, 20.5, 19.0, 17.5, 15.5,
3112 14.5, 13.0, 12.0, 10.5, 9.5, 8.5,
3113 8.0, 7.0, 6.5, 5.5, 5.0, 4.5,
3114 4.0, 3.5, 3.5, 3.0, 2.5, 2.5,
3115 2.0, 2.0, 1.5, 1.5, 1.0, 1.0,
3116 1.0, 1.0, 0.5, 0.5, 0.5, 0.5,
3117 0.5, 0.5
3118};

Referenced by plm_audio_create_with_buffer().

◆ PLM_DEMUX_PACKET_AUDIO_1

const int fl::third_party::PLM_DEMUX_PACKET_AUDIO_1 = 0xC0
static

Definition at line 590 of file pl_mpeg.h.

Referenced by plm_demux_decode(), plm_demux_probe(), plm_init_decoders(), and plm_set_audio_enabled().

◆ PLM_DEMUX_PACKET_AUDIO_2

const int fl::third_party::PLM_DEMUX_PACKET_AUDIO_2 = 0xC1
static

Definition at line 591 of file pl_mpeg.h.

◆ PLM_DEMUX_PACKET_AUDIO_3

const int fl::third_party::PLM_DEMUX_PACKET_AUDIO_3 = 0xC2
static

Definition at line 592 of file pl_mpeg.h.

◆ PLM_DEMUX_PACKET_AUDIO_4

const int fl::third_party::PLM_DEMUX_PACKET_AUDIO_4 = 0xC3
static

Definition at line 593 of file pl_mpeg.h.

Referenced by plm_demux_decode(), and plm_demux_probe().

◆ PLM_DEMUX_PACKET_PRIVATE

const int fl::third_party::PLM_DEMUX_PACKET_PRIVATE = 0xBD
static

Definition at line 589 of file pl_mpeg.h.

Referenced by plm_demux_decode().

◆ PLM_DEMUX_PACKET_VIDEO_1

const int fl::third_party::PLM_DEMUX_PACKET_VIDEO_1 = 0xE0
static

Definition at line 594 of file pl_mpeg.h.

Referenced by plm_demux_decode(), plm_demux_probe(), plm_get_duration(), plm_init_decoders(), and plm_set_video_enabled().

◆ PLM_START_END

const int fl::third_party::PLM_START_END = 0xB9
static

Definition at line 1129 of file pl_mpeg.hpp.

◆ PLM_START_EXTENSION

const int fl::third_party::PLM_START_EXTENSION = 0xB5
static

Definition at line 1638 of file pl_mpeg.hpp.

Referenced by plm_video_decode_picture().

◆ PLM_START_PACK

const int fl::third_party::PLM_START_PACK = 0xBA
static

Definition at line 1128 of file pl_mpeg.hpp.

Referenced by plm_demux_has_headers().

◆ PLM_START_PICTURE

const int fl::third_party::PLM_START_PICTURE = 0x00
static

Definition at line 1637 of file pl_mpeg.hpp.

Referenced by plm_video_decode().

◆ PLM_START_SEQUENCE

const int fl::third_party::PLM_START_SEQUENCE = 0xB3
static

Definition at line 1634 of file pl_mpeg.hpp.

Referenced by plm_video_create_with_buffer(), and plm_video_has_header().

◆ PLM_START_SLICE_FIRST

const int fl::third_party::PLM_START_SLICE_FIRST = 0x01
static

Definition at line 1635 of file pl_mpeg.hpp.

◆ PLM_START_SLICE_LAST

const int fl::third_party::PLM_START_SLICE_LAST = 0xAF
static

Definition at line 1636 of file pl_mpeg.hpp.

◆ PLM_START_SYSTEM

const int fl::third_party::PLM_START_SYSTEM = 0xBB
static

Definition at line 1130 of file pl_mpeg.hpp.

Referenced by plm_demux_has_headers().

◆ PLM_START_USER_DATA

const int fl::third_party::PLM_START_USER_DATA = 0xB2
static

Definition at line 1639 of file pl_mpeg.hpp.

Referenced by plm_video_decode_picture().

◆ PLM_VIDEO_CODE_BLOCK_PATTERN

const plm_vlc_t fl::third_party::PLM_VIDEO_CODE_BLOCK_PATTERN[]
static

Definition at line 1780 of file pl_mpeg.hpp.

1780 {
1781 { 1 << 1, 0}, { 2 << 1, 0}, // 0: x
1782 { 3 << 1, 0}, { 4 << 1, 0}, // 1: 0x
1783 { 5 << 1, 0}, { 6 << 1, 0}, // 2: 1x
1784 { 7 << 1, 0}, { 8 << 1, 0}, // 3: 00x
1785 { 9 << 1, 0}, { 10 << 1, 0}, // 4: 01x
1786 { 11 << 1, 0}, { 12 << 1, 0}, // 5: 10x
1787 { 13 << 1, 0}, { 0, 60}, // 6: 11x
1788 { 14 << 1, 0}, { 15 << 1, 0}, // 7: 000x
1789 { 16 << 1, 0}, { 17 << 1, 0}, // 8: 001x
1790 { 18 << 1, 0}, { 19 << 1, 0}, // 9: 010x
1791 { 20 << 1, 0}, { 21 << 1, 0}, // 10: 011x
1792 { 22 << 1, 0}, { 23 << 1, 0}, // 11: 100x
1793 { 0, 32}, { 0, 16}, // 12: 101x
1794 { 0, 8}, { 0, 4}, // 13: 110x
1795 { 24 << 1, 0}, { 25 << 1, 0}, // 14: 0000x
1796 { 26 << 1, 0}, { 27 << 1, 0}, // 15: 0001x
1797 { 28 << 1, 0}, { 29 << 1, 0}, // 16: 0010x
1798 { 30 << 1, 0}, { 31 << 1, 0}, // 17: 0011x
1799 { 0, 62}, { 0, 2}, // 18: 0100x
1800 { 0, 61}, { 0, 1}, // 19: 0101x
1801 { 0, 56}, { 0, 52}, // 20: 0110x
1802 { 0, 44}, { 0, 28}, // 21: 0111x
1803 { 0, 40}, { 0, 20}, // 22: 1000x
1804 { 0, 48}, { 0, 12}, // 23: 1001x
1805 { 32 << 1, 0}, { 33 << 1, 0}, // 24: 0000 0x
1806 { 34 << 1, 0}, { 35 << 1, 0}, // 25: 0000 1x
1807 { 36 << 1, 0}, { 37 << 1, 0}, // 26: 0001 0x
1808 { 38 << 1, 0}, { 39 << 1, 0}, // 27: 0001 1x
1809 { 40 << 1, 0}, { 41 << 1, 0}, // 28: 0010 0x
1810 { 42 << 1, 0}, { 43 << 1, 0}, // 29: 0010 1x
1811 { 0, 63}, { 0, 3}, // 30: 0011 0x
1812 { 0, 36}, { 0, 24}, // 31: 0011 1x
1813 { 44 << 1, 0}, { 45 << 1, 0}, // 32: 0000 00x
1814 { 46 << 1, 0}, { 47 << 1, 0}, // 33: 0000 01x
1815 { 48 << 1, 0}, { 49 << 1, 0}, // 34: 0000 10x
1816 { 50 << 1, 0}, { 51 << 1, 0}, // 35: 0000 11x
1817 { 52 << 1, 0}, { 53 << 1, 0}, // 36: 0001 00x
1818 { 54 << 1, 0}, { 55 << 1, 0}, // 37: 0001 01x
1819 { 56 << 1, 0}, { 57 << 1, 0}, // 38: 0001 10x
1820 { 58 << 1, 0}, { 59 << 1, 0}, // 39: 0001 11x
1821 { 0, 34}, { 0, 18}, // 40: 0010 00x
1822 { 0, 10}, { 0, 6}, // 41: 0010 01x
1823 { 0, 33}, { 0, 17}, // 42: 0010 10x
1824 { 0, 9}, { 0, 5}, // 43: 0010 11x
1825 { -1, 0}, { 60 << 1, 0}, // 44: 0000 000x
1826 { 61 << 1, 0}, { 62 << 1, 0}, // 45: 0000 001x
1827 { 0, 58}, { 0, 54}, // 46: 0000 010x
1828 { 0, 46}, { 0, 30}, // 47: 0000 011x
1829 { 0, 57}, { 0, 53}, // 48: 0000 100x
1830 { 0, 45}, { 0, 29}, // 49: 0000 101x
1831 { 0, 38}, { 0, 26}, // 50: 0000 110x
1832 { 0, 37}, { 0, 25}, // 51: 0000 111x
1833 { 0, 43}, { 0, 23}, // 52: 0001 000x
1834 { 0, 51}, { 0, 15}, // 53: 0001 001x
1835 { 0, 42}, { 0, 22}, // 54: 0001 010x
1836 { 0, 50}, { 0, 14}, // 55: 0001 011x
1837 { 0, 41}, { 0, 21}, // 56: 0001 100x
1838 { 0, 49}, { 0, 13}, // 57: 0001 101x
1839 { 0, 35}, { 0, 19}, // 58: 0001 110x
1840 { 0, 11}, { 0, 7}, // 59: 0001 111x
1841 { 0, 39}, { 0, 27}, // 60: 0000 0001x
1842 { 0, 59}, { 0, 55}, // 61: 0000 0010x
1843 { 0, 47}, { 0, 31}, // 62: 0000 0011x
1844};

Referenced by plm_video_decode_macroblock().

◆ PLM_VIDEO_DCT_COEFF

const plm_vlc_uint_t fl::third_party::PLM_VIDEO_DCT_COEFF[]
static

Definition at line 1920 of file pl_mpeg.hpp.

1920 {
1921 { 1 << 1, 0}, { 0, 0x0001}, // 0: x
1922 { 2 << 1, 0}, { 3 << 1, 0}, // 1: 0x
1923 { 4 << 1, 0}, { 5 << 1, 0}, // 2: 00x
1924 { 6 << 1, 0}, { 0, 0x0101}, // 3: 01x
1925 { 7 << 1, 0}, { 8 << 1, 0}, // 4: 000x
1926 { 9 << 1, 0}, { 10 << 1, 0}, // 5: 001x
1927 { 0, 0x0002}, { 0, 0x0201}, // 6: 010x
1928 { 11 << 1, 0}, { 12 << 1, 0}, // 7: 0000x
1929 { 13 << 1, 0}, { 14 << 1, 0}, // 8: 0001x
1930 { 15 << 1, 0}, { 0, 0x0003}, // 9: 0010x
1931 { 0, 0x0401}, { 0, 0x0301}, // 10: 0011x
1932 { 16 << 1, 0}, { 0, 0xffff}, // 11: 0000 0x
1933 { 17 << 1, 0}, { 18 << 1, 0}, // 12: 0000 1x
1934 { 0, 0x0701}, { 0, 0x0601}, // 13: 0001 0x
1935 { 0, 0x0102}, { 0, 0x0501}, // 14: 0001 1x
1936 { 19 << 1, 0}, { 20 << 1, 0}, // 15: 0010 0x
1937 { 21 << 1, 0}, { 22 << 1, 0}, // 16: 0000 00x
1938 { 0, 0x0202}, { 0, 0x0901}, // 17: 0000 10x
1939 { 0, 0x0004}, { 0, 0x0801}, // 18: 0000 11x
1940 { 23 << 1, 0}, { 24 << 1, 0}, // 19: 0010 00x
1941 { 25 << 1, 0}, { 26 << 1, 0}, // 20: 0010 01x
1942 { 27 << 1, 0}, { 28 << 1, 0}, // 21: 0000 000x
1943 { 29 << 1, 0}, { 30 << 1, 0}, // 22: 0000 001x
1944 { 0, 0x0d01}, { 0, 0x0006}, // 23: 0010 000x
1945 { 0, 0x0c01}, { 0, 0x0b01}, // 24: 0010 001x
1946 { 0, 0x0302}, { 0, 0x0103}, // 25: 0010 010x
1947 { 0, 0x0005}, { 0, 0x0a01}, // 26: 0010 011x
1948 { 31 << 1, 0}, { 32 << 1, 0}, // 27: 0000 0000x
1949 { 33 << 1, 0}, { 34 << 1, 0}, // 28: 0000 0001x
1950 { 35 << 1, 0}, { 36 << 1, 0}, // 29: 0000 0010x
1951 { 37 << 1, 0}, { 38 << 1, 0}, // 30: 0000 0011x
1952 { 39 << 1, 0}, { 40 << 1, 0}, // 31: 0000 0000 0x
1953 { 41 << 1, 0}, { 42 << 1, 0}, // 32: 0000 0000 1x
1954 { 43 << 1, 0}, { 44 << 1, 0}, // 33: 0000 0001 0x
1955 { 45 << 1, 0}, { 46 << 1, 0}, // 34: 0000 0001 1x
1956 { 0, 0x1001}, { 0, 0x0502}, // 35: 0000 0010 0x
1957 { 0, 0x0007}, { 0, 0x0203}, // 36: 0000 0010 1x
1958 { 0, 0x0104}, { 0, 0x0f01}, // 37: 0000 0011 0x
1959 { 0, 0x0e01}, { 0, 0x0402}, // 38: 0000 0011 1x
1960 { 47 << 1, 0}, { 48 << 1, 0}, // 39: 0000 0000 00x
1961 { 49 << 1, 0}, { 50 << 1, 0}, // 40: 0000 0000 01x
1962 { 51 << 1, 0}, { 52 << 1, 0}, // 41: 0000 0000 10x
1963 { 53 << 1, 0}, { 54 << 1, 0}, // 42: 0000 0000 11x
1964 { 55 << 1, 0}, { 56 << 1, 0}, // 43: 0000 0001 00x
1965 { 57 << 1, 0}, { 58 << 1, 0}, // 44: 0000 0001 01x
1966 { 59 << 1, 0}, { 60 << 1, 0}, // 45: 0000 0001 10x
1967 { 61 << 1, 0}, { 62 << 1, 0}, // 46: 0000 0001 11x
1968 { -1, 0}, { 63 << 1, 0}, // 47: 0000 0000 000x
1969 { 64 << 1, 0}, { 65 << 1, 0}, // 48: 0000 0000 001x
1970 { 66 << 1, 0}, { 67 << 1, 0}, // 49: 0000 0000 010x
1971 { 68 << 1, 0}, { 69 << 1, 0}, // 50: 0000 0000 011x
1972 { 70 << 1, 0}, { 71 << 1, 0}, // 51: 0000 0000 100x
1973 { 72 << 1, 0}, { 73 << 1, 0}, // 52: 0000 0000 101x
1974 { 74 << 1, 0}, { 75 << 1, 0}, // 53: 0000 0000 110x
1975 { 76 << 1, 0}, { 77 << 1, 0}, // 54: 0000 0000 111x
1976 { 0, 0x000b}, { 0, 0x0802}, // 55: 0000 0001 000x
1977 { 0, 0x0403}, { 0, 0x000a}, // 56: 0000 0001 001x
1978 { 0, 0x0204}, { 0, 0x0702}, // 57: 0000 0001 010x
1979 { 0, 0x1501}, { 0, 0x1401}, // 58: 0000 0001 011x
1980 { 0, 0x0009}, { 0, 0x1301}, // 59: 0000 0001 100x
1981 { 0, 0x1201}, { 0, 0x0105}, // 60: 0000 0001 101x
1982 { 0, 0x0303}, { 0, 0x0008}, // 61: 0000 0001 110x
1983 { 0, 0x0602}, { 0, 0x1101}, // 62: 0000 0001 111x
1984 { 78 << 1, 0}, { 79 << 1, 0}, // 63: 0000 0000 0001x
1985 { 80 << 1, 0}, { 81 << 1, 0}, // 64: 0000 0000 0010x
1986 { 82 << 1, 0}, { 83 << 1, 0}, // 65: 0000 0000 0011x
1987 { 84 << 1, 0}, { 85 << 1, 0}, // 66: 0000 0000 0100x
1988 { 86 << 1, 0}, { 87 << 1, 0}, // 67: 0000 0000 0101x
1989 { 88 << 1, 0}, { 89 << 1, 0}, // 68: 0000 0000 0110x
1990 { 90 << 1, 0}, { 91 << 1, 0}, // 69: 0000 0000 0111x
1991 { 0, 0x0a02}, { 0, 0x0902}, // 70: 0000 0000 1000x
1992 { 0, 0x0503}, { 0, 0x0304}, // 71: 0000 0000 1001x
1993 { 0, 0x0205}, { 0, 0x0107}, // 72: 0000 0000 1010x
1994 { 0, 0x0106}, { 0, 0x000f}, // 73: 0000 0000 1011x
1995 { 0, 0x000e}, { 0, 0x000d}, // 74: 0000 0000 1100x
1996 { 0, 0x000c}, { 0, 0x1a01}, // 75: 0000 0000 1101x
1997 { 0, 0x1901}, { 0, 0x1801}, // 76: 0000 0000 1110x
1998 { 0, 0x1701}, { 0, 0x1601}, // 77: 0000 0000 1111x
1999 { 92 << 1, 0}, { 93 << 1, 0}, // 78: 0000 0000 0001 0x
2000 { 94 << 1, 0}, { 95 << 1, 0}, // 79: 0000 0000 0001 1x
2001 { 96 << 1, 0}, { 97 << 1, 0}, // 80: 0000 0000 0010 0x
2002 { 98 << 1, 0}, { 99 << 1, 0}, // 81: 0000 0000 0010 1x
2003 {100 << 1, 0}, {101 << 1, 0}, // 82: 0000 0000 0011 0x
2004 {102 << 1, 0}, {103 << 1, 0}, // 83: 0000 0000 0011 1x
2005 { 0, 0x001f}, { 0, 0x001e}, // 84: 0000 0000 0100 0x
2006 { 0, 0x001d}, { 0, 0x001c}, // 85: 0000 0000 0100 1x
2007 { 0, 0x001b}, { 0, 0x001a}, // 86: 0000 0000 0101 0x
2008 { 0, 0x0019}, { 0, 0x0018}, // 87: 0000 0000 0101 1x
2009 { 0, 0x0017}, { 0, 0x0016}, // 88: 0000 0000 0110 0x
2010 { 0, 0x0015}, { 0, 0x0014}, // 89: 0000 0000 0110 1x
2011 { 0, 0x0013}, { 0, 0x0012}, // 90: 0000 0000 0111 0x
2012 { 0, 0x0011}, { 0, 0x0010}, // 91: 0000 0000 0111 1x
2013 {104 << 1, 0}, {105 << 1, 0}, // 92: 0000 0000 0001 00x
2014 {106 << 1, 0}, {107 << 1, 0}, // 93: 0000 0000 0001 01x
2015 {108 << 1, 0}, {109 << 1, 0}, // 94: 0000 0000 0001 10x
2016 {110 << 1, 0}, {111 << 1, 0}, // 95: 0000 0000 0001 11x
2017 { 0, 0x0028}, { 0, 0x0027}, // 96: 0000 0000 0010 00x
2018 { 0, 0x0026}, { 0, 0x0025}, // 97: 0000 0000 0010 01x
2019 { 0, 0x0024}, { 0, 0x0023}, // 98: 0000 0000 0010 10x
2020 { 0, 0x0022}, { 0, 0x0021}, // 99: 0000 0000 0010 11x
2021 { 0, 0x0020}, { 0, 0x010e}, // 100: 0000 0000 0011 00x
2022 { 0, 0x010d}, { 0, 0x010c}, // 101: 0000 0000 0011 01x
2023 { 0, 0x010b}, { 0, 0x010a}, // 102: 0000 0000 0011 10x
2024 { 0, 0x0109}, { 0, 0x0108}, // 103: 0000 0000 0011 11x
2025 { 0, 0x0112}, { 0, 0x0111}, // 104: 0000 0000 0001 000x
2026 { 0, 0x0110}, { 0, 0x010f}, // 105: 0000 0000 0001 001x
2027 { 0, 0x0603}, { 0, 0x1002}, // 106: 0000 0000 0001 010x
2028 { 0, 0x0f02}, { 0, 0x0e02}, // 107: 0000 0000 0001 011x
2029 { 0, 0x0d02}, { 0, 0x0c02}, // 108: 0000 0000 0001 100x
2030 { 0, 0x0b02}, { 0, 0x1f01}, // 109: 0000 0000 0001 101x
2031 { 0, 0x1e01}, { 0, 0x1d01}, // 110: 0000 0000 0001 110x
2032 { 0, 0x1c01}, { 0, 0x1b01}, // 111: 0000 0000 0001 111x
2033};

Referenced by plm_video_decode_block().

◆ PLM_VIDEO_DCT_SIZE

const plm_vlc_t* fl::third_party::PLM_VIDEO_DCT_SIZE[]
static
Initial value:
= {
}
static const plm_vlc_t PLM_VIDEO_DCT_SIZE_LUMINANCE[]
Definition pl_mpeg.hpp:1883
static const plm_vlc_t PLM_VIDEO_DCT_SIZE_CHROMINANCE[]
Definition pl_mpeg.hpp:1895

Definition at line 1907 of file pl_mpeg.hpp.

Referenced by plm_video_decode_block().

◆ PLM_VIDEO_DCT_SIZE_CHROMINANCE

const plm_vlc_t fl::third_party::PLM_VIDEO_DCT_SIZE_CHROMINANCE[]
static
Initial value:
= {
{ 1 << 1, 0}, { 2 << 1, 0},
{ 0, 0}, { 0, 1},
{ 0, 2}, { 3 << 1, 0},
{ 0, 3}, { 4 << 1, 0},
{ 0, 4}, { 5 << 1, 0},
{ 0, 5}, { 6 << 1, 0},
{ 0, 6}, { 7 << 1, 0},
{ 0, 7}, { 8 << 1, 0},
{ 0, 8}, { -1, 0},
}

Definition at line 1895 of file pl_mpeg.hpp.

1895 {
1896 { 1 << 1, 0}, { 2 << 1, 0}, // 0: x
1897 { 0, 0}, { 0, 1}, // 1: 0x
1898 { 0, 2}, { 3 << 1, 0}, // 2: 1x
1899 { 0, 3}, { 4 << 1, 0}, // 3: 11x
1900 { 0, 4}, { 5 << 1, 0}, // 4: 111x
1901 { 0, 5}, { 6 << 1, 0}, // 5: 1111x
1902 { 0, 6}, { 7 << 1, 0}, // 6: 1111 1x
1903 { 0, 7}, { 8 << 1, 0}, // 7: 1111 11x
1904 { 0, 8}, { -1, 0}, // 8: 1111 111x
1905};

◆ PLM_VIDEO_DCT_SIZE_LUMINANCE

const plm_vlc_t fl::third_party::PLM_VIDEO_DCT_SIZE_LUMINANCE[]
static
Initial value:
= {
{ 1 << 1, 0}, { 2 << 1, 0},
{ 0, 1}, { 0, 2},
{ 3 << 1, 0}, { 4 << 1, 0},
{ 0, 0}, { 0, 3},
{ 0, 4}, { 5 << 1, 0},
{ 0, 5}, { 6 << 1, 0},
{ 0, 6}, { 7 << 1, 0},
{ 0, 7}, { 8 << 1, 0},
{ 0, 8}, { -1, 0},
}

Definition at line 1883 of file pl_mpeg.hpp.

1883 {
1884 { 1 << 1, 0}, { 2 << 1, 0}, // 0: x
1885 { 0, 1}, { 0, 2}, // 1: 0x
1886 { 3 << 1, 0}, { 4 << 1, 0}, // 2: 1x
1887 { 0, 0}, { 0, 3}, // 3: 10x
1888 { 0, 4}, { 5 << 1, 0}, // 4: 11x
1889 { 0, 5}, { 6 << 1, 0}, // 5: 111x
1890 { 0, 6}, { 7 << 1, 0}, // 6: 1111x
1891 { 0, 7}, { 8 << 1, 0}, // 7: 1111 1x
1892 { 0, 8}, { -1, 0}, // 8: 1111 11x
1893};

◆ PLM_VIDEO_INTRA_QUANT_MATRIX

const uint8_t fl::third_party::PLM_VIDEO_INTRA_QUANT_MATRIX[]
static
Initial value:
= {
8, 16, 19, 22, 26, 27, 29, 34,
16, 16, 22, 24, 27, 29, 34, 37,
19, 22, 26, 27, 29, 34, 34, 38,
22, 22, 26, 27, 29, 34, 37, 40,
22, 26, 27, 29, 32, 35, 40, 48,
26, 27, 29, 32, 35, 40, 48, 58,
26, 27, 29, 34, 38, 46, 56, 69,
27, 29, 35, 38, 46, 56, 69, 83
}

Definition at line 1668 of file pl_mpeg.hpp.

1668 {
1669 8, 16, 19, 22, 26, 27, 29, 34,
1670 16, 16, 22, 24, 27, 29, 34, 37,
1671 19, 22, 26, 27, 29, 34, 34, 38,
1672 22, 22, 26, 27, 29, 34, 37, 40,
1673 22, 26, 27, 29, 32, 35, 40, 48,
1674 26, 27, 29, 32, 35, 40, 48, 58,
1675 26, 27, 29, 34, 38, 46, 56, 69,
1676 27, 29, 35, 38, 46, 56, 69, 83
1677};

Referenced by plm_video_decode_sequence_header().

◆ PLM_VIDEO_MACROBLOCK_ADDRESS_INCREMENT

const plm_vlc_t fl::third_party::PLM_VIDEO_MACROBLOCK_ADDRESS_INCREMENT[]
static

Definition at line 1701 of file pl_mpeg.hpp.

1701 {
1702 { 1 << 1, 0}, { 0, 1}, // 0: x
1703 { 2 << 1, 0}, { 3 << 1, 0}, // 1: 0x
1704 { 4 << 1, 0}, { 5 << 1, 0}, // 2: 00x
1705 { 0, 3}, { 0, 2}, // 3: 01x
1706 { 6 << 1, 0}, { 7 << 1, 0}, // 4: 000x
1707 { 0, 5}, { 0, 4}, // 5: 001x
1708 { 8 << 1, 0}, { 9 << 1, 0}, // 6: 0000x
1709 { 0, 7}, { 0, 6}, // 7: 0001x
1710 { 10 << 1, 0}, { 11 << 1, 0}, // 8: 0000 0x
1711 { 12 << 1, 0}, { 13 << 1, 0}, // 9: 0000 1x
1712 { 14 << 1, 0}, { 15 << 1, 0}, // 10: 0000 00x
1713 { 16 << 1, 0}, { 17 << 1, 0}, // 11: 0000 01x
1714 { 18 << 1, 0}, { 19 << 1, 0}, // 12: 0000 10x
1715 { 0, 9}, { 0, 8}, // 13: 0000 11x
1716 { -1, 0}, { 20 << 1, 0}, // 14: 0000 000x
1717 { -1, 0}, { 21 << 1, 0}, // 15: 0000 001x
1718 { 22 << 1, 0}, { 23 << 1, 0}, // 16: 0000 010x
1719 { 0, 15}, { 0, 14}, // 17: 0000 011x
1720 { 0, 13}, { 0, 12}, // 18: 0000 100x
1721 { 0, 11}, { 0, 10}, // 19: 0000 101x
1722 { 24 << 1, 0}, { 25 << 1, 0}, // 20: 0000 0001x
1723 { 26 << 1, 0}, { 27 << 1, 0}, // 21: 0000 0011x
1724 { 28 << 1, 0}, { 29 << 1, 0}, // 22: 0000 0100x
1725 { 30 << 1, 0}, { 31 << 1, 0}, // 23: 0000 0101x
1726 { 32 << 1, 0}, { -1, 0}, // 24: 0000 0001 0x
1727 { -1, 0}, { 33 << 1, 0}, // 25: 0000 0001 1x
1728 { 34 << 1, 0}, { 35 << 1, 0}, // 26: 0000 0011 0x
1729 { 36 << 1, 0}, { 37 << 1, 0}, // 27: 0000 0011 1x
1730 { 38 << 1, 0}, { 39 << 1, 0}, // 28: 0000 0100 0x
1731 { 0, 21}, { 0, 20}, // 29: 0000 0100 1x
1732 { 0, 19}, { 0, 18}, // 30: 0000 0101 0x
1733 { 0, 17}, { 0, 16}, // 31: 0000 0101 1x
1734 { 0, 35}, { -1, 0}, // 32: 0000 0001 00x
1735 { -1, 0}, { 0, 34}, // 33: 0000 0001 11x
1736 { 0, 33}, { 0, 32}, // 34: 0000 0011 00x
1737 { 0, 31}, { 0, 30}, // 35: 0000 0011 01x
1738 { 0, 29}, { 0, 28}, // 36: 0000 0011 10x
1739 { 0, 27}, { 0, 26}, // 37: 0000 0011 11x
1740 { 0, 25}, { 0, 24}, // 38: 0000 0100 00x
1741 { 0, 23}, { 0, 22}, // 39: 0000 0100 01x
1742};

Referenced by plm_video_decode_macroblock().

◆ PLM_VIDEO_MACROBLOCK_TYPE

const plm_vlc_t* fl::third_party::PLM_VIDEO_MACROBLOCK_TYPE[]
static
Initial value:
= {
}
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_INTRA[]
Definition pl_mpeg.hpp:1744
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_B[]
Definition pl_mpeg.hpp:1759
static const plm_vlc_t PLM_VIDEO_MACROBLOCK_TYPE_PREDICTIVE[]
Definition pl_mpeg.hpp:1749

Definition at line 1773 of file pl_mpeg.hpp.

Referenced by plm_video_decode_macroblock().

◆ PLM_VIDEO_MACROBLOCK_TYPE_B

const plm_vlc_t fl::third_party::PLM_VIDEO_MACROBLOCK_TYPE_B[]
static
Initial value:
= {
{ 1 << 1, 0}, { 2 << 1, 0},
{ 3 << 1, 0}, { 4 << 1, 0},
{ 0, 0x0c}, { 0, 0x0e},
{ 5 << 1, 0}, { 6 << 1, 0},
{ 0, 0x04}, { 0, 0x06},
{ 7 << 1, 0}, { 8 << 1, 0},
{ 0, 0x08}, { 0, 0x0a},
{ 9 << 1, 0}, { 10 << 1, 0},
{ 0, 0x1e}, { 0, 0x01},
{ -1, 0}, { 0, 0x11},
{ 0, 0x16}, { 0, 0x1a},
}

Definition at line 1759 of file pl_mpeg.hpp.

1759 {
1760 { 1 << 1, 0}, { 2 << 1, 0}, // 0: x
1761 { 3 << 1, 0}, { 4 << 1, 0}, // 1: 0x
1762 { 0, 0x0c}, { 0, 0x0e}, // 2: 1x
1763 { 5 << 1, 0}, { 6 << 1, 0}, // 3: 00x
1764 { 0, 0x04}, { 0, 0x06}, // 4: 01x
1765 { 7 << 1, 0}, { 8 << 1, 0}, // 5: 000x
1766 { 0, 0x08}, { 0, 0x0a}, // 6: 001x
1767 { 9 << 1, 0}, { 10 << 1, 0}, // 7: 0000x
1768 { 0, 0x1e}, { 0, 0x01}, // 8: 0001x
1769 { -1, 0}, { 0, 0x11}, // 9: 0000 0x
1770 { 0, 0x16}, { 0, 0x1a}, // 10: 0000 1x
1771};

◆ PLM_VIDEO_MACROBLOCK_TYPE_INTRA

const plm_vlc_t fl::third_party::PLM_VIDEO_MACROBLOCK_TYPE_INTRA[]
static
Initial value:
= {
{ 1 << 1, 0}, { 0, 0x01},
{ -1, 0}, { 0, 0x11},
}

Definition at line 1744 of file pl_mpeg.hpp.

1744 {
1745 { 1 << 1, 0}, { 0, 0x01}, // 0: x
1746 { -1, 0}, { 0, 0x11}, // 1: 0x
1747};

◆ PLM_VIDEO_MACROBLOCK_TYPE_PREDICTIVE

const plm_vlc_t fl::third_party::PLM_VIDEO_MACROBLOCK_TYPE_PREDICTIVE[]
static
Initial value:
= {
{ 1 << 1, 0}, { 0, 0x0a},
{ 2 << 1, 0}, { 0, 0x02},
{ 3 << 1, 0}, { 0, 0x08},
{ 4 << 1, 0}, { 5 << 1, 0},
{ 6 << 1, 0}, { 0, 0x12},
{ 0, 0x1a}, { 0, 0x01},
{ -1, 0}, { 0, 0x11},
}

Definition at line 1749 of file pl_mpeg.hpp.

1749 {
1750 { 1 << 1, 0}, { 0, 0x0a}, // 0: x
1751 { 2 << 1, 0}, { 0, 0x02}, // 1: 0x
1752 { 3 << 1, 0}, { 0, 0x08}, // 2: 00x
1753 { 4 << 1, 0}, { 5 << 1, 0}, // 3: 000x
1754 { 6 << 1, 0}, { 0, 0x12}, // 4: 0000x
1755 { 0, 0x1a}, { 0, 0x01}, // 5: 0001x
1756 { -1, 0}, { 0, 0x11}, // 6: 0000 0x
1757};

◆ PLM_VIDEO_MOTION

const plm_vlc_t fl::third_party::PLM_VIDEO_MOTION[]
static

Definition at line 1846 of file pl_mpeg.hpp.

1846 {
1847 { 1 << 1, 0}, { 0, 0}, // 0: x
1848 { 2 << 1, 0}, { 3 << 1, 0}, // 1: 0x
1849 { 4 << 1, 0}, { 5 << 1, 0}, // 2: 00x
1850 { 0, 1}, { 0, -1}, // 3: 01x
1851 { 6 << 1, 0}, { 7 << 1, 0}, // 4: 000x
1852 { 0, 2}, { 0, -2}, // 5: 001x
1853 { 8 << 1, 0}, { 9 << 1, 0}, // 6: 0000x
1854 { 0, 3}, { 0, -3}, // 7: 0001x
1855 { 10 << 1, 0}, { 11 << 1, 0}, // 8: 0000 0x
1856 { 12 << 1, 0}, { 13 << 1, 0}, // 9: 0000 1x
1857 { -1, 0}, { 14 << 1, 0}, // 10: 0000 00x
1858 { 15 << 1, 0}, { 16 << 1, 0}, // 11: 0000 01x
1859 { 17 << 1, 0}, { 18 << 1, 0}, // 12: 0000 10x
1860 { 0, 4}, { 0, -4}, // 13: 0000 11x
1861 { -1, 0}, { 19 << 1, 0}, // 14: 0000 001x
1862 { 20 << 1, 0}, { 21 << 1, 0}, // 15: 0000 010x
1863 { 0, 7}, { 0, -7}, // 16: 0000 011x
1864 { 0, 6}, { 0, -6}, // 17: 0000 100x
1865 { 0, 5}, { 0, -5}, // 18: 0000 101x
1866 { 22 << 1, 0}, { 23 << 1, 0}, // 19: 0000 0011x
1867 { 24 << 1, 0}, { 25 << 1, 0}, // 20: 0000 0100x
1868 { 26 << 1, 0}, { 27 << 1, 0}, // 21: 0000 0101x
1869 { 28 << 1, 0}, { 29 << 1, 0}, // 22: 0000 0011 0x
1870 { 30 << 1, 0}, { 31 << 1, 0}, // 23: 0000 0011 1x
1871 { 32 << 1, 0}, { 33 << 1, 0}, // 24: 0000 0100 0x
1872 { 0, 10}, { 0, -10}, // 25: 0000 0100 1x
1873 { 0, 9}, { 0, -9}, // 26: 0000 0101 0x
1874 { 0, 8}, { 0, -8}, // 27: 0000 0101 1x
1875 { 0, 16}, { 0, -16}, // 28: 0000 0011 00x
1876 { 0, 15}, { 0, -15}, // 29: 0000 0011 01x
1877 { 0, 14}, { 0, -14}, // 30: 0000 0011 10x
1878 { 0, 13}, { 0, -13}, // 31: 0000 0011 11x
1879 { 0, 12}, { 0, -12}, // 32: 0000 0100 00x
1880 { 0, 11}, { 0, -11}, // 33: 0000 0100 01x
1881};

Referenced by plm_video_decode_motion_vector().

◆ PLM_VIDEO_NON_INTRA_QUANT_MATRIX

const uint8_t fl::third_party::PLM_VIDEO_NON_INTRA_QUANT_MATRIX[]
static
Initial value:
= {
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16
}

Definition at line 1679 of file pl_mpeg.hpp.

1679 {
1680 16, 16, 16, 16, 16, 16, 16, 16,
1681 16, 16, 16, 16, 16, 16, 16, 16,
1682 16, 16, 16, 16, 16, 16, 16, 16,
1683 16, 16, 16, 16, 16, 16, 16, 16,
1684 16, 16, 16, 16, 16, 16, 16, 16,
1685 16, 16, 16, 16, 16, 16, 16, 16,
1686 16, 16, 16, 16, 16, 16, 16, 16,
1687 16, 16, 16, 16, 16, 16, 16, 16
1688};

Referenced by plm_video_decode_sequence_header().

◆ PLM_VIDEO_PICTURE_RATE

const double fl::third_party::PLM_VIDEO_PICTURE_RATE[]
static
Initial value:
= {
0.000, 23.976, 24.000, 25.000, 29.970, 30.000, 50.000, 59.940,
60.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000
}

Definition at line 1652 of file pl_mpeg.hpp.

1652 {
1653 0.000, 23.976, 24.000, 25.000, 29.970, 30.000, 50.000, 59.940,
1654 60.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000
1655};

Referenced by plm_video_decode_sequence_header().

◆ PLM_VIDEO_PICTURE_TYPE_B

const int fl::third_party::PLM_VIDEO_PICTURE_TYPE_B = 3
static

Definition at line 1632 of file pl_mpeg.hpp.

Referenced by plm_video_decode(), plm_video_decode_picture(), and plm_video_predict_macroblock().

◆ PLM_VIDEO_PICTURE_TYPE_INTRA

const int fl::third_party::PLM_VIDEO_PICTURE_TYPE_INTRA = 1
static

Definition at line 1630 of file pl_mpeg.hpp.

Referenced by plm_video_decode(), and plm_video_decode_picture().

◆ PLM_VIDEO_PICTURE_TYPE_PREDICTIVE

const int fl::third_party::PLM_VIDEO_PICTURE_TYPE_PREDICTIVE = 2
static

Definition at line 1631 of file pl_mpeg.hpp.

Referenced by plm_video_decode(), plm_video_decode_macroblock(), plm_video_decode_motion_vectors(), and plm_video_decode_picture().

◆ PLM_VIDEO_PIXEL_ASPECT_RATIO

const float fl::third_party::PLM_VIDEO_PIXEL_ASPECT_RATIO[]
static
Initial value:
= {
1.0000,
0.6735,
0.7031,
0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815,
1.0255, 1.0695, 1.0950, 1.1575, 1.2051,
}

Definition at line 1644 of file pl_mpeg.hpp.

1644 {
1645 1.0000, /* square pixels */
1646 0.6735, /* 3:4? */
1647 0.7031, /* MPEG-1 / MPEG-2 video encoding divergence? */
1648 0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815,
1649 1.0255, 1.0695, 1.0950, 1.1575, 1.2051,
1650};

Referenced by plm_video_decode_sequence_header().

◆ PLM_VIDEO_PREMULTIPLIER_MATRIX

const uint8_t fl::third_party::PLM_VIDEO_PREMULTIPLIER_MATRIX[]
static
Initial value:
= {
32, 44, 42, 38, 32, 25, 17, 9,
44, 62, 58, 52, 44, 35, 24, 12,
42, 58, 55, 49, 42, 33, 23, 12,
38, 52, 49, 44, 38, 30, 20, 10,
32, 44, 42, 38, 32, 25, 17, 9,
25, 35, 33, 30, 25, 20, 14, 7,
17, 24, 23, 20, 17, 14, 9, 5,
9, 12, 12, 10, 9, 7, 5, 2
}

Definition at line 1690 of file pl_mpeg.hpp.

1690 {
1691 32, 44, 42, 38, 32, 25, 17, 9,
1692 44, 62, 58, 52, 44, 35, 24, 12,
1693 42, 58, 55, 49, 42, 33, 23, 12,
1694 38, 52, 49, 44, 38, 30, 20, 10,
1695 32, 44, 42, 38, 32, 25, 17, 9,
1696 25, 35, 33, 30, 25, 20, 14, 7,
1697 17, 24, 23, 20, 17, 14, 9, 5,
1698 9, 12, 12, 10, 9, 7, 5, 2
1699};

Referenced by plm_video_decode_block().

◆ PLM_VIDEO_ZIG_ZAG

const uint8_t fl::third_party::PLM_VIDEO_ZIG_ZAG[]
static
Initial value:
= {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
}

Definition at line 1657 of file pl_mpeg.hpp.

1657 {
1658 0, 1, 8, 16, 9, 2, 3, 10,
1659 17, 24, 32, 25, 18, 11, 4, 5,
1660 12, 19, 26, 33, 40, 48, 41, 34,
1661 27, 20, 13, 6, 7, 14, 21, 28,
1662 35, 42, 49, 56, 57, 50, 43, 36,
1663 29, 22, 15, 23, 30, 37, 44, 51,
1664 58, 59, 52, 45, 38, 31, 39, 46,
1665 53, 60, 61, 54, 47, 55, 62, 63
1666};

Referenced by plm_video_decode_block(), and plm_video_decode_sequence_header().

◆ poly43hi

int32_t fl::third_party::poly43hi[5] = { (int32_t)0x10852163, (int32_t)0xd333f6a4, (int32_t)0x46e9408b, (int32_t)0x27c2cef0, (int32_t)0xfef577b4 }

Definition at line 116 of file dqchan.hpp.

116{ (int32_t)0x10852163, (int32_t)0xd333f6a4, (int32_t)0x46e9408b, (int32_t)0x27c2cef0, (int32_t)0xfef577b4 };

Referenced by DequantBlock().

◆ poly43lo

int32_t fl::third_party::poly43lo[5] = { (int32_t)0x29a0bda9, (int32_t)0xb02e4828, (int32_t)0x5957aa1b, (int32_t)0x236c498d, (int32_t)0xff581859 }

Definition at line 115 of file dqchan.hpp.

115{ (int32_t)0x29a0bda9, (int32_t)0xb02e4828, (int32_t)0x5957aa1b, (int32_t)0x236c498d, (int32_t)0xff581859 };

Referenced by DequantBlock().

◆ polyCoef

const int32_t fl::third_party::polyCoef

Definition at line 282 of file trigtabs.hpp.

282 {
283 /* shuffled vs. original from 0, 1, ... 15 to 0, 15, 2, 13, ... 14, 1 */
284 0x00000000, 0x00000074, 0x00000354, 0x0000072c, 0x00001fd4, 0x00005084, 0x000066b8, 0x000249c4,
285 0x00049478, (int32_t)0xfffdb63c, 0x000066b8, (int32_t)0xffffaf7c, 0x00001fd4, (int32_t)0xfffff8d4, 0x00000354, (int32_t)0xffffff8c,
286 (int32_t)0xfffffffc, 0x00000068, 0x00000368, 0x00000644, 0x00001f40, 0x00004ad0, 0x00005d1c, 0x00022ce0,
287 0x000493c0, (int32_t)0xfffd9960, 0x00006f78, (int32_t)0xffffa9cc, 0x0000203c, (int32_t)0xfffff7e4, 0x00000340, (int32_t)0xffffff84,
288 (int32_t)0xfffffffc, 0x00000060, 0x00000378, 0x0000056c, 0x00001e80, 0x00004524, 0x000052a0, 0x00020ffc,
289 0x000491a0, (int32_t)0xfffd7ca0, 0x00007760, (int32_t)0xffffa424, 0x00002080, (int32_t)0xfffff6ec, 0x00000328, (int32_t)0xffffff74,
290 (int32_t)0xfffffffc, 0x00000054, 0x00000384, 0x00000498, 0x00001d94, 0x00003f7c, 0x00004744, 0x0001f32c,
291 0x00048e18, (int32_t)0xfffd6008, 0x00007e70, (int32_t)0xffff9e8c, 0x0000209c, (int32_t)0xfffff5ec, 0x00000310, (int32_t)0xffffff68,
292 (int32_t)0xfffffffc, 0x0000004c, 0x0000038c, 0x000003d0, 0x00001c78, 0x000039e4, 0x00003b00, 0x0001d680,
293 0x00048924, (int32_t)0xfffd43ac, 0x000084b0, (int32_t)0xffff990c, 0x00002094, (int32_t)0xfffff4e4, 0x000002f8, (int32_t)0xffffff5c,
294 (int32_t)0xfffffffc, 0x00000044, 0x00000390, 0x00000314, 0x00001b2c, 0x0000345c, 0x00002ddc, 0x0001ba04,
295 0x000482d0, (int32_t)0xfffd279c, 0x00008a20, (int32_t)0xffff93a4, 0x0000206c, (int32_t)0xfffff3d4, 0x000002dc, (int32_t)0xffffff4c,
296 (int32_t)0xfffffffc, 0x00000040, 0x00000390, 0x00000264, 0x000019b0, 0x00002ef0, 0x00001fd4, 0x00019dc8,
297 0x00047b1c, (int32_t)0xfffd0be8, 0x00008ecc, (int32_t)0xffff8e64, 0x00002024, (int32_t)0xfffff2c0, 0x000002c0, (int32_t)0xffffff3c,
298 (int32_t)0xfffffff8, 0x00000038, 0x0000038c, 0x000001bc, 0x000017fc, 0x0000299c, 0x000010e8, 0x000181d8,
299 0x0004720c, (int32_t)0xfffcf09c, 0x000092b4, (int32_t)0xffff894c, 0x00001fc0, (int32_t)0xfffff1a4, 0x000002a4, (int32_t)0xffffff2c,
300 (int32_t)0xfffffff8, 0x00000034, 0x00000380, 0x00000120, 0x00001618, 0x00002468, 0x00000118, 0x00016644,
301 0x000467a4, (int32_t)0xfffcd5cc, 0x000095e0, (int32_t)0xffff8468, 0x00001f44, (int32_t)0xfffff084, 0x00000284, (int32_t)0xffffff18,
302 (int32_t)0xfffffff8, 0x0000002c, 0x00000374, 0x00000090, 0x00001400, 0x00001f58, (int32_t)0xfffff068, 0x00014b14,
303 0x00045bf0, (int32_t)0xfffcbb88, 0x00009858, (int32_t)0xffff7fbc, 0x00001ea8, (int32_t)0xffffef60, 0x00000268, (int32_t)0xffffff04,
304 (int32_t)0xfffffff8, 0x00000028, 0x0000035c, 0x00000008, 0x000011ac, 0x00001a70, (int32_t)0xffffded8, 0x00013058,
305 0x00044ef8, (int32_t)0xfffca1d8, 0x00009a1c, (int32_t)0xffff7b54, 0x00001dfc, (int32_t)0xffffee3c, 0x0000024c, (int32_t)0xfffffef0,
306 (int32_t)0xfffffff4, 0x00000024, 0x00000340, (int32_t)0xffffff8c, 0x00000f28, 0x000015b0, (int32_t)0xffffcc70, 0x0001161c,
307 0x000440bc, (int32_t)0xfffc88d8, 0x00009b3c, (int32_t)0xffff7734, 0x00001d38, (int32_t)0xffffed18, 0x0000022c, (int32_t)0xfffffedc,
308 (int32_t)0xfffffff4, 0x00000020, 0x00000320, (int32_t)0xffffff1c, 0x00000c68, 0x0000111c, (int32_t)0xffffb92c, 0x0000fc6c,
309 0x00043150, (int32_t)0xfffc708c, 0x00009bb8, (int32_t)0xffff7368, 0x00001c64, (int32_t)0xffffebf4, 0x00000210, (int32_t)0xfffffec4,
310 (int32_t)0xfffffff0, 0x0000001c, 0x000002f4, (int32_t)0xfffffeb4, 0x00000974, 0x00000cb8, (int32_t)0xffffa518, 0x0000e350,
311 0x000420b4, (int32_t)0xfffc5908, 0x00009b9c, (int32_t)0xffff6ff4, 0x00001b7c, (int32_t)0xffffead0, 0x000001f4, (int32_t)0xfffffeac,
312 (int32_t)0xfffffff0, 0x0000001c, 0x000002c4, (int32_t)0xfffffe58, 0x00000648, 0x00000884, (int32_t)0xffff9038, 0x0000cad0,
313 0x00040ef8, (int32_t)0xfffc425c, 0x00009af0, (int32_t)0xffff6ce0, 0x00001a88, (int32_t)0xffffe9b0, 0x000001d4, (int32_t)0xfffffe94,
314 (int32_t)0xffffffec, 0x00000018, 0x0000028c, (int32_t)0xfffffe04, 0x000002e4, 0x00000480, (int32_t)0xffff7a90, 0x0000b2fc,
315 0x0003fc28, (int32_t)0xfffc2c90, 0x000099b8, (int32_t)0xffff6a3c, 0x00001988, (int32_t)0xffffe898, 0x000001bc, (int32_t)0xfffffe7c,
316 0x000001a0, 0x0000187c, 0x000097fc, 0x0003e84c, (int32_t)0xffff6424, (int32_t)0xffffff4c, 0x00000248, (int32_t)0xffffffec,
317};

Referenced by Subband().

◆ pow14

int32_t fl::third_party::pow14[4]
Initial value:
= {
0x7fffffff, (int32_t)0x6ba27e65, (int32_t)0x5a82799a, 0x4c1bf829
}

Definition at line 61 of file dqchan.hpp.

61 {
62 0x7fffffff, (int32_t)0x6ba27e65, (int32_t)0x5a82799a, 0x4c1bf829
63};

Referenced by DequantBlock().

◆ pow2exp

int fl::third_party::pow2exp[8] = { 14, 13, 11, 10, 9, 7, 6, 5 }

Definition at line 119 of file dqchan.hpp.

119{ 14, 13, 11, 10, 9, 7, 6, 5 };

Referenced by DequantBlock().

◆ pow2frac

int32_t fl::third_party::pow2frac[8]
Initial value:
= {
(int32_t)0x6597fa94, (int32_t)0x50a28be6, 0x7fffffff, (int32_t)0x6597fa94,
(int32_t)0x50a28be6, 0x7fffffff, (int32_t)0x6597fa94, (int32_t)0x50a28be6
}

Definition at line 121 of file dqchan.hpp.

121 {
122 (int32_t)0x6597fa94, (int32_t)0x50a28be6, 0x7fffffff, (int32_t)0x6597fa94,
123 (int32_t)0x50a28be6, 0x7fffffff, (int32_t)0x6597fa94, (int32_t)0x50a28be6
124};

Referenced by DequantBlock().

◆ pow43

int32_t fl::third_party::pow43[]
Initial value:
= {
0x1428a2fa, 0x15db1bd6, 0x1796302c, 0x19598d85,
0x1b24e8bb, 0x1cf7fcfa, 0x1ed28af2, 0x20b4582a,
0x229d2e6e, 0x248cdb55, 0x26832fda, 0x28800000,
0x2a832287, 0x2c8c70a8, 0x2e9bc5d8, (int32_t)0x30b0ff99,
(int32_t)0x32cbfd4a, (int32_t)0x34eca001, (int32_t)0x3712ca62, (int32_t)0x393e6088,
(int32_t)0x3b6f47e0, (int32_t)0x3da56717, (int32_t)0x3fe0a5fc, (int32_t)0x4220ed72,
(int32_t)0x44662758, (int32_t)0x46b03e7c, (int32_t)0x48ff1e87, (int32_t)0x4b52b3f3,
(int32_t)0x4daaebfd, (int32_t)0x5007b497, (int32_t)0x5268fc62, (int32_t)0x54ceb29c,
(int32_t)0x5738c721, (int32_t)0x59a72a59, (int32_t)0x5c19cd35, (int32_t)0x5e90a129,
(int32_t)0x610b9821, (int32_t)0x638aa47f, (int32_t)0x660db90f, (int32_t)0x6894c90b,
(int32_t)0x6b1fc80c, (int32_t)0x6daeaa0d, (int32_t)0x70416360, (int32_t)0x72d7e8b0,
(int32_t)0x75722ef9, (int32_t)0x78102b85, (int32_t)0x7ab1d3ec, (int32_t)0x7d571e09,
}

Definition at line 89 of file dqchan.hpp.

89 {
90 0x1428a2fa, 0x15db1bd6, 0x1796302c, 0x19598d85,
91 0x1b24e8bb, 0x1cf7fcfa, 0x1ed28af2, 0x20b4582a,
92 0x229d2e6e, 0x248cdb55, 0x26832fda, 0x28800000,
93 0x2a832287, 0x2c8c70a8, 0x2e9bc5d8, (int32_t)0x30b0ff99,
94 (int32_t)0x32cbfd4a, (int32_t)0x34eca001, (int32_t)0x3712ca62, (int32_t)0x393e6088,
95 (int32_t)0x3b6f47e0, (int32_t)0x3da56717, (int32_t)0x3fe0a5fc, (int32_t)0x4220ed72,
96 (int32_t)0x44662758, (int32_t)0x46b03e7c, (int32_t)0x48ff1e87, (int32_t)0x4b52b3f3,
97 (int32_t)0x4daaebfd, (int32_t)0x5007b497, (int32_t)0x5268fc62, (int32_t)0x54ceb29c,
98 (int32_t)0x5738c721, (int32_t)0x59a72a59, (int32_t)0x5c19cd35, (int32_t)0x5e90a129,
99 (int32_t)0x610b9821, (int32_t)0x638aa47f, (int32_t)0x660db90f, (int32_t)0x6894c90b,
100 (int32_t)0x6b1fc80c, (int32_t)0x6daeaa0d, (int32_t)0x70416360, (int32_t)0x72d7e8b0,
101 (int32_t)0x75722ef9, (int32_t)0x78102b85, (int32_t)0x7ab1d3ec, (int32_t)0x7d571e09,
102};

Referenced by DequantBlock().

◆ pow43_14

int32_t fl::third_party::pow43_14[4][16]
Initial value:
= {
{ 0x00000000, 0x10000000, 0x285145f3, (int32_t)0x453a5cdb,
0x0cb2ff53, 0x111989d6, 0x15ce31c8, 0x1ac7f203,
0x20000000, 0x257106b9, 0x2b16b4a3, (int32_t)0x30ed74b4,
(int32_t)0x36f23fa5, (int32_t)0x3d227bd3, (int32_t)0x437be656, (int32_t)0x49fc823c, },
{ 0x00000000, 0x0d744fcd, 0x21e71f26, (int32_t)0x3a36abd9,
0x0aadc084, 0x0e610e6e, 0x12560c1d, 0x168523cf,
0x1ae89f99, 0x1f7c03a4, 0x243bae49, 0x29249c67,
0x2e34420f, (int32_t)0x33686f85, (int32_t)0x38bf3dff, (int32_t)0x3e370182, },
{ 0x00000000, 0x0b504f33, 0x1c823e07, (int32_t)0x30f39a55,
0x08facd62, 0x0c176319, 0x0f6b3522, 0x12efe2ad,
0x16a09e66, 0x1a79a317, 0x1e77e301, 0x2298d5b4,
0x26da56fc, 0x2b3a902a, 0x2fb7e7e7, (int32_t)0x3450f650, },
{ 0x00000000, 0x09837f05, 0x17f910d7, 0x2929c7a9,
0x078d0dfa, 0x0a2ae661, 0x0cf73154, 0x0fec91cb,
0x1306fe0a, 0x16434a6c, 0x199ee595, 0x1d17ae3d,
0x20abd76a, 0x2459d551, 0x28204fbb, 0x2bfe1808, },
}

Definition at line 66 of file dqchan.hpp.

66 {
67{ 0x00000000, 0x10000000, 0x285145f3, (int32_t)0x453a5cdb, /* Q28 */
68 0x0cb2ff53, 0x111989d6, 0x15ce31c8, 0x1ac7f203,
69 0x20000000, 0x257106b9, 0x2b16b4a3, (int32_t)0x30ed74b4,
70 (int32_t)0x36f23fa5, (int32_t)0x3d227bd3, (int32_t)0x437be656, (int32_t)0x49fc823c, },
71
72{ 0x00000000, 0x0d744fcd, 0x21e71f26, (int32_t)0x3a36abd9,
73 0x0aadc084, 0x0e610e6e, 0x12560c1d, 0x168523cf,
74 0x1ae89f99, 0x1f7c03a4, 0x243bae49, 0x29249c67,
75 0x2e34420f, (int32_t)0x33686f85, (int32_t)0x38bf3dff, (int32_t)0x3e370182, },
76
77{ 0x00000000, 0x0b504f33, 0x1c823e07, (int32_t)0x30f39a55,
78 0x08facd62, 0x0c176319, 0x0f6b3522, 0x12efe2ad,
79 0x16a09e66, 0x1a79a317, 0x1e77e301, 0x2298d5b4,
80 0x26da56fc, 0x2b3a902a, 0x2fb7e7e7, (int32_t)0x3450f650, },
81
82{ 0x00000000, 0x09837f05, 0x17f910d7, 0x2929c7a9,
83 0x078d0dfa, 0x0a2ae661, 0x0cf73154, 0x0fec91cb,
84 0x1306fe0a, 0x16434a6c, 0x199ee595, 0x1d17ae3d,
85 0x20abd76a, 0x2459d551, 0x28204fbb, 0x2bfe1808, },
86};

Referenced by DequantBlock().

◆ preTab

const char fl::third_party::preTab[22] = { 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0 }
static

Definition at line 58 of file dqchan.hpp.

58{ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0 };

Referenced by DequantChannel().

◆ quadTable

const unsigned char fl::third_party::quadTable
Initial value:
= {
0x6b, 0x6f, 0x6d, 0x6e, 0x67, 0x65, 0x59, 0x59,
0x56, 0x56, 0x53, 0x53, 0x5a, 0x5a, 0x5c, 0x5c,
0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41,
0x44, 0x44, 0x44, 0x44, 0x48, 0x48, 0x48, 0x48,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48,
0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40,
}

Definition at line 743 of file hufftabs.hpp.

743 {
744 /* table A */
745 0x6b, 0x6f, 0x6d, 0x6e, 0x67, 0x65, 0x59, 0x59,
746 0x56, 0x56, 0x53, 0x53, 0x5a, 0x5a, 0x5c, 0x5c,
747 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41,
748 0x44, 0x44, 0x44, 0x44, 0x48, 0x48, 0x48, 0x48,
749 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
750 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
751 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
752 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
753 /* table B */
754 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48,
755 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40,
756};

Referenced by DecodeHuffmanQuads().

◆ quadTabMaxBits

const int32_t fl::third_party::quadTabMaxBits = {6, 4}

Definition at line 759 of file hufftabs.hpp.

759{6, 4};

Referenced by DecodeHuffmanQuads().

◆ quadTabOffset

const int32_t fl::third_party::quadTabOffset = {0, 64}

Definition at line 758 of file hufftabs.hpp.

758{0, 64};

Referenced by DecodeHuffmanQuads().

◆ QUANT_LUT_STEP_2

const uint8_t fl::third_party::QUANT_LUT_STEP_2[3][3]
static
Initial value:

Definition at line 3134 of file pl_mpeg.hpp.

3134 {
3135 //44.1 kHz, 48 kHz, 32 kHz
3139};

Referenced by plm_audio_decode_frame().

◆ samplerateTab

const int32_t fl::third_party::samplerateTab
Initial value:
= {
{44100, 48000, 32000},
{22050, 24000, 16000},
{11025, 12000, 8000},
}

Definition at line 53 of file mp3tabs.hpp.

53 {
54 {44100, 48000, 32000}, /* MPEG-1 */
55 {22050, 24000, 16000}, /* MPEG-2 */
56 {11025, 12000, 8000}, /* MPEG-2.5 */
57};

Referenced by IMDCT(), and UnpackFrameHeader().

◆ samplesPerFrameTab

const short fl::third_party::samplesPerFrameTab
Initial value:
= {
{384, 1152, 1152 },
{384, 1152, 576 },
{384, 1152, 576 },
}

Definition at line 88 of file mp3tabs.hpp.

88 {
89 {384, 1152, 1152 }, /* MPEG1 */
90 {384, 1152, 576 }, /* MPEG2 */
91 {384, 1152, 576 }, /* MPEG2.5 */
92};

Referenced by IMDCT(), MP3GetLastFrameInfo(), and UnpackFrameHeader().

◆ sfBandTable

const SFBandTable fl::third_party::sfBandTable

Definition at line 135 of file mp3tabs.hpp.

135 {
136 {
137 /* MPEG-1 (44, 48, 32 kHz) */
138 {
139 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90,110,134,162,196,238,288,342,418,576 },
140 { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84,106,136,192 }
141 },
142 {
143 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88,106,128,156,190,230,276,330,384,576 },
144 { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80,100,126,192 }
145 },
146 {
147 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82,102,126,156,194,240,296,364,448,550,576 },
148 { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78,104,138,180,192 }
149 }
150 },
151
152 {
153 /* MPEG-2 (22, 24, 16 kHz) */
154 {
155 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
156 { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74,100,132,174,192 }
157 },
158 {
159 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,114,136,162,194,232,278,332,394,464,540,576 },
160 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,136,180,192 }
161 },
162 {
163 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
164 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
165 },
166 },
167
168 {
169 /* MPEG-2.5 (11, 12, 8 kHz) */
170 {
171 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
172 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
173 },
174 {
175 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
176 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
177 },
178 {
179 { 0, 12, 24, 36, 48, 60, 72, 88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576 },
180 { 0, 8, 16, 24, 36, 52, 72, 96,124,160,162,164,166,192 }
181 },
182 },
183};

Referenced by IMDCT(), and UnpackFrameHeader().

◆ SFLenTab

const char fl::third_party::SFLenTab[16][2]
static
Initial value:
= {
{0, 0}, {0, 1},
{0, 2}, {0, 3},
{3, 0}, {1, 1},
{1, 2}, {1, 3},
{2, 1}, {2, 2},
{2, 3}, {3, 1},
{3, 2}, {3, 3},
{4, 2}, {4, 3},
}

Definition at line 51 of file scalfact.hpp.

51 {
52 {0, 0}, {0, 1},
53 {0, 2}, {0, 3},
54 {3, 0}, {1, 1},
55 {1, 2}, {1, 3},
56 {2, 1}, {2, 2},
57 {2, 3}, {3, 1},
58 {3, 2}, {3, 3},
59 {4, 2}, {4, 3},
60};

Referenced by UnpackSFMPEG1().

◆ sideBytesTab

const short fl::third_party::sideBytesTab
Initial value:
= {
{17, 32},
{ 9, 17},
{ 9, 17},
}

Definition at line 100 of file mp3tabs.hpp.

100 {
101 {17, 32}, /* MPEG-1: mono, stereo */
102 { 9, 17}, /* MPEG-2: mono, stereo */
103 { 9, 17}, /* MPEG-2.5: mono, stereo */
104};

Referenced by IMDCT(), and UnpackFrameHeader().

◆ slotTab

const short fl::third_party::slotTab
Initial value:
= {
{
{ 0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835,1044 },
{ 0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960 },
{ 0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864,1008,1152,1440 },
},
{
{ 0, 26, 52, 78, 104, 130, 156, 182, 208, 261, 313, 365, 417, 470, 522 },
{ 0, 24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480 },
{ 0, 36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720 },
},
{
{ 0, 52, 104, 156, 208, 261, 313, 365, 417, 522, 626, 731, 835, 940,1044 },
{ 0, 48, 96, 144, 192, 240, 288, 336, 384, 480, 576, 672, 768, 864, 960 },
{ 0, 72, 144, 216, 288, 360, 432, 504, 576, 720, 864,1008,1152,1296,1440 },
},
}

Definition at line 110 of file mp3tabs.hpp.

110 {
111 {
112 /* MPEG-1 */
113 { 0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835,1044 }, /* 44 kHz */
114 { 0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960 }, /* 48 kHz */
115 { 0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864,1008,1152,1440 }, /* 32 kHz */
116 },
117 {
118 /* MPEG-2 */
119 { 0, 26, 52, 78, 104, 130, 156, 182, 208, 261, 313, 365, 417, 470, 522 }, /* 22 kHz */
120 { 0, 24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480 }, /* 24 kHz */
121 { 0, 36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720 }, /* 16 kHz */
122 },
123 {
124 /* MPEG-2.5 */
125 { 0, 52, 104, 156, 208, 261, 313, 365, 417, 522, 626, 731, 835, 940,1044 }, /* 11 kHz */
126 { 0, 48, 96, 144, 192, 240, 288, 336, 384, 480, 576, 672, 768, 864, 960 }, /* 12 kHz */
127 { 0, 72, 144, 216, 288, 360, 432, 504, 576, 720, 864,1008,1152,1296,1440 }, /* 8 kHz */
128 },
129};

Referenced by IMDCT(), and UnpackFrameHeader().

◆ uniqueIDTab

const unsigned char fl::third_party::uniqueIDTab[8] = {0x5f, 0x4b, 0x43, 0x5f, 0x5f, 0x4a, 0x52, 0x5f}

Definition at line 223 of file trigtabs.hpp.

223{0x5f, 0x4b, 0x43, 0x5f, 0x5f, 0x4a, 0x52, 0x5f};

◆ Zig

const uint8_t fl::third_party::Zig[64]
static
Initial value:
= {
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
}

Definition at line 50 of file tjpgd.cpp.hpp.

50 { /* Zigzag-order to raster-order conversion table */
51 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
52 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
53 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
54 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
55};

Referenced by create_qt_tbl(), and mcu_load().