FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
hqx.c File Reference
#include <inttypes.h>
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "canopus.h"
#include "get_bits.h"
#include "internal.h"
#include "hqx.h"
#include "hqxdsp.h"

Go to the source code of this file.

Macros

#define HQX_HEADER_SIZE   59
 

Enumerations

enum  HQXFormat { HQX_422 = 0, HQX_444, HQX_422A, HQX_444A }
 

Functions

static void put_blocks (HQXContext *ctx, int plane, int x, int y, int ilace, int16_t *block0, int16_t *block1, const uint8_t *quant)
 
static void hqx_get_ac (GetBitContext *gb, const HQXAC *ac, int *run, int *lev)
 
static int decode_block (GetBitContext *gb, VLC *vlc, const int *quants, int dcb, int16_t block[64], int *last_dc)
 
static int hqx_decode_422 (HQXContext *ctx, int slice_no, int x, int y)
 
static int hqx_decode_422a (HQXContext *ctx, int slice_no, int x, int y)
 
static int hqx_decode_444 (HQXContext *ctx, int slice_no, int x, int y)
 
static int hqx_decode_444a (HQXContext *ctx, int slice_no, int x, int y)
 
static int decode_slice (HQXContext *ctx, int slice_no)
 
static int decode_slice_thread (AVCodecContext *avctx, void *arg, int slice_no, int threadnr)
 
static int hqx_decode_frame (AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt)
 
static av_cold int hqx_decode_close (AVCodecContext *avctx)
 
static av_cold int hqx_decode_init (AVCodecContext *avctx)
 

Variables

static const int hqx_quants [16][4]
 
static const uint8_t hqx_quant_luma [64]
 
static const uint8_t hqx_quant_chroma [64]
 
static const int shuffle_16 [16]
 
AVCodec ff_hqx_decoder
 

Macro Definition Documentation

#define HQX_HEADER_SIZE   59

Definition at line 42 of file hqx.c.

Referenced by decode_slice_thread(), and hqx_decode_frame().

Enumeration Type Documentation

enum HQXFormat
Enumerator
HQX_422 
HQX_444 
HQX_422A 
HQX_444A 

Definition at line 35 of file hqx.c.

Function Documentation

static void put_blocks ( HQXContext ctx,
int  plane,
int  x,
int  y,
int  ilace,
int16_t *  block0,
int16_t *  block1,
const uint8_t quant 
)
inlinestatic

Definition at line 83 of file hqx.c.

Referenced by hqx_decode_422(), hqx_decode_422a(), hqx_decode_444(), and hqx_decode_444a().

static void hqx_get_ac ( GetBitContext gb,
const HQXAC ac,
int *  run,
int *  lev 
)
inlinestatic

Definition at line 98 of file hqx.c.

Referenced by decode_block().

static int decode_block ( GetBitContext gb,
VLC vlc,
const int *  quants,
int  dcb,
int16_t  block[64],
int *  last_dc 
)
static

Definition at line 114 of file hqx.c.

Referenced by hqx_decode_422(), hqx_decode_422a(), hqx_decode_444(), and hqx_decode_444a().

static int hqx_decode_422 ( HQXContext ctx,
int  slice_no,
int  x,
int  y 
)
static

Definition at line 155 of file hqx.c.

Referenced by hqx_decode_frame().

static int hqx_decode_422a ( HQXContext ctx,
int  slice_no,
int  x,
int  y 
)
static

Definition at line 189 of file hqx.c.

Referenced by hqx_decode_frame().

static int hqx_decode_444 ( HQXContext ctx,
int  slice_no,
int  x,
int  y 
)
static

Definition at line 239 of file hqx.c.

Referenced by hqx_decode_frame().

static int hqx_decode_444a ( HQXContext ctx,
int  slice_no,
int  x,
int  y 
)
static

Definition at line 275 of file hqx.c.

Referenced by hqx_decode_frame().

static int decode_slice ( HQXContext ctx,
int  slice_no 
)
static

Definition at line 328 of file hqx.c.

Referenced by decode_slice_thread().

static int decode_slice_thread ( AVCodecContext avctx,
void arg,
int  slice_no,
int  threadnr 
)
static

Definition at line 381 of file hqx.c.

Referenced by hqx_decode_frame().

static int hqx_decode_frame ( AVCodecContext avctx,
void data,
int *  got_picture_ptr,
AVPacket avpkt 
)
static

Definition at line 404 of file hqx.c.

static av_cold int hqx_decode_close ( AVCodecContext avctx)
static

Definition at line 508 of file hqx.c.

static av_cold int hqx_decode_init ( AVCodecContext avctx)
static

Definition at line 521 of file hqx.c.

Variable Documentation

const int hqx_quants[16][4]
static
Initial value:
= {
{ 0x1, 0x2, 0x4, 0x8 }, { 0x1, 0x3, 0x6, 0xC },
{ 0x2, 0x4, 0x8, 0x10 }, { 0x3, 0x6, 0xC, 0x18 },
{ 0x4, 0x8, 0x10, 0x20 }, { 0x6, 0xC, 0x18, 0x30 },
{ 0x8, 0x10, 0x20, 0x40 },
{ 0xA, 0x14, 0x28, 0x50 },
{ 0xC, 0x18, 0x30, 0x60 },
{ 0x10, 0x20, 0x40, 0x80 }, { 0x18, 0x30, 0x60, 0xC0 },
{ 0x20, 0x40, 0x80, 0x100 }, { 0x30, 0x60, 0xC0, 0x180 },
{ 0x40, 0x80, 0x100, 0x200 }, { 0x60, 0xC0, 0x180, 0x300 },
{ 0x80, 0x100, 0x200, 0x400 }
}

Definition at line 48 of file hqx.c.

Referenced by hqx_decode_422(), hqx_decode_422a(), hqx_decode_444(), and hqx_decode_444a().

const uint8_t hqx_quant_luma[64]
static
Initial value:
= {
16, 16, 16, 19, 19, 19, 42, 44,
16, 16, 19, 19, 19, 38, 43, 45,
16, 19, 19, 19, 40, 41, 45, 48,
19, 19, 19, 40, 41, 42, 46, 49,
19, 19, 40, 41, 42, 43, 48, 101,
19, 38, 41, 42, 43, 44, 98, 104,
42, 43, 45, 46, 48, 98, 109, 116,
44, 45, 48, 49, 101, 104, 116, 123,
}

Definition at line 61 of file hqx.c.

Referenced by hqx_decode_422(), hqx_decode_422a(), hqx_decode_444(), and hqx_decode_444a().

const uint8_t hqx_quant_chroma[64]
static
Initial value:
= {
16, 16, 19, 25, 26, 26, 42, 44,
16, 19, 25, 25, 26, 38, 43, 91,
19, 25, 26, 27, 40, 41, 91, 96,
25, 25, 27, 40, 41, 84, 93, 197,
26, 26, 40, 41, 84, 86, 191, 203,
26, 38, 41, 84, 86, 177, 197, 209,
42, 43, 91, 93, 191, 197, 219, 232,
44, 91, 96, 197, 203, 209, 232, 246,
}

Definition at line 72 of file hqx.c.

Referenced by hqx_decode_422(), hqx_decode_422a(), hqx_decode_444(), and hqx_decode_444a().

const int shuffle_16[16]
static
Initial value:
= {
0, 5, 11, 14, 2, 7, 9, 13, 1, 4, 10, 15, 3, 6, 8, 12
}

Definition at line 324 of file hqx.c.

Referenced by decode_slice().

AVCodec ff_hqx_decoder
Initial value:
= {
.name = "hqx",
.long_name = NULL_IF_CONFIG_SMALL("Canopus HQX"),
.priv_data_size = sizeof(HQXContext),
.close = hqx_decode_close,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
}
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int hqx_decode_init(AVCodecContext *avctx)
Definition: hqx.c:521
static int hqx_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt)
Definition: hqx.c:404
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
static av_cold int hqx_decode_close(AVCodecContext *avctx)
Definition: hqx.c:508
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
Definition: hqx.h:62
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1026
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
Definition: ffmpeg.c:2035
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959

Definition at line 530 of file hqx.c.