FFmpeg  4.0
Data Structures | Macros | Functions | Variables
speedhq.c File Reference

NewTek SpeedHQ decoder. More...

#include "libavutil/attributes.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#include "libavutil/thread.h"
#include "mathops.h"
#include "mpeg12.h"
#include "mpeg12data.h"
#include "mpeg12vlc.h"

Go to the source code of this file.

Data Structures

struct  SHQContext
 

Macros

#define BITSTREAM_READER_LE
 
#define MAX_INDEX   (64 - 1)
 
#define ALPHA_VLC_BITS   5
 

Functions

static int decode_dc_le (GetBitContext *gb, int component)
 
static int decode_alpha_block (const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize)
 
static int decode_dct_block (const SHQContext *s, GetBitContext *gb, int last_dc[4], int component, uint8_t *dest, int linesize)
 
static int decode_speedhq_field (const SHQContext *s, const uint8_t *buf, int buf_size, AVFrame *frame, int field_number, int start, int end, int line_stride)
 
static void compute_quant_matrix (int *output, int qscale)
 
static int speedhq_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold void compute_alpha_vlcs (void)
 
static uint32_t reverse (uint32_t num, int bits)
 
static void reverse_code (const uint16_t *code, const uint8_t *bits, uint16_t *reversed_code, int num_entries)
 
static av_cold void speedhq_static_init (void)
 
static av_cold int speedhq_decode_init (AVCodecContext *avctx)
 

Variables

static uint16_t speedhq_vlc [123][2]
 
static const uint8_t speedhq_level [121]
 
static const uint8_t speedhq_run [121]
 
static RLTable ff_rl_speedhq
 
static const uint8_t unscaled_quant_matrix [64]
 
static uint8_t ff_speedhq_static_rl_table_store [2][2 *MAX_RUN+MAX_LEVEL+3]
 
static VLC ff_dc_lum_vlc_le
 
static VLC ff_dc_chroma_vlc_le
 
static VLC ff_dc_alpha_run_vlc_le
 
static VLC ff_dc_alpha_level_vlc_le
 
AVCodec ff_speedhq_decoder
 

Detailed Description

NewTek SpeedHQ decoder.

Definition in file speedhq.c.

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 27 of file speedhq.c.

◆ MAX_INDEX

#define MAX_INDEX   (64 - 1)

Definition at line 40 of file speedhq.c.

Referenced by decode_dct_block().

◆ ALPHA_VLC_BITS

#define ALPHA_VLC_BITS   5

Definition at line 46 of file speedhq.c.

Referenced by compute_alpha_vlcs(), and decode_alpha_block().

Function Documentation

◆ decode_dc_le()

static int decode_dc_le ( GetBitContext gb,
int  component 
)
inlinestatic

Definition at line 162 of file speedhq.c.

Referenced by decode_dct_block().

◆ decode_alpha_block()

static int decode_alpha_block ( const SHQContext s,
GetBitContext gb,
uint8_t  last_alpha[16],
uint8_t dest,
int  linesize 
)
inlinestatic

Definition at line 183 of file speedhq.c.

Referenced by decode_speedhq_field().

◆ decode_dct_block()

static int decode_dct_block ( const SHQContext s,
GetBitContext gb,
int  last_dc[4],
int  component,
uint8_t dest,
int  linesize 
)
inlinestatic

Definition at line 223 of file speedhq.c.

Referenced by decode_speedhq_field().

◆ decode_speedhq_field()

static int decode_speedhq_field ( const SHQContext s,
const uint8_t buf,
int  buf_size,
AVFrame frame,
int  field_number,
int  start,
int  end,
int  line_stride 
)
static

Definition at line 280 of file speedhq.c.

Referenced by speedhq_decode_frame().

◆ compute_quant_matrix()

static void compute_quant_matrix ( int output,
int  qscale 
)
static

Definition at line 409 of file speedhq.c.

Referenced by speedhq_decode_frame().

◆ speedhq_decode_frame()

static int speedhq_decode_frame ( AVCodecContext avctx,
void data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 415 of file speedhq.c.

◆ compute_alpha_vlcs()

static av_cold void compute_alpha_vlcs ( void  )
static

Definition at line 478 of file speedhq.c.

Referenced by speedhq_static_init().

◆ reverse()

static uint32_t reverse ( uint32_t  num,
int  bits 
)
static

◆ reverse_code()

static void reverse_code ( const uint16_t *  code,
const uint8_t bits,
uint16_t *  reversed_code,
int  num_entries 
)
static

Definition at line 570 of file speedhq.c.

Referenced by speedhq_static_init().

◆ speedhq_static_init()

static av_cold void speedhq_static_init ( void  )
static

Definition at line 579 of file speedhq.c.

Referenced by speedhq_decode_init().

◆ speedhq_decode_init()

static av_cold int speedhq_decode_init ( AVCodecContext avctx)
static

Definition at line 611 of file speedhq.c.

Variable Documentation

◆ speedhq_vlc

uint16_t speedhq_vlc[123][2]
static

Definition at line 61 of file speedhq.c.

Referenced by speedhq_static_init().

◆ speedhq_level

const uint8_t speedhq_level[121]
static
Initial value:
= {
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 1,
2, 3, 4, 5, 1, 2, 3, 4,
1, 2, 3, 1, 2, 3, 1, 2,
1, 2, 1, 2, 1, 2, 1, 2,
1, 2, 1, 2, 1, 2, 1, 2,
1, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1,
}

Definition at line 97 of file speedhq.c.

◆ speedhq_run

const uint8_t speedhq_run[121]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 4, 4, 4, 4,
5, 5, 5, 6, 6, 6, 7, 7,
8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13, 14, 14, 15, 15,
16, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30,
31,
}

Definition at line 116 of file speedhq.c.

◆ ff_rl_speedhq

RLTable ff_rl_speedhq
static
Initial value:
= {
121,
121,
(const uint16_t (*)[])speedhq_vlc,
}
static uint16_t speedhq_vlc[123][2]
Definition: speedhq.c:61
static const uint8_t speedhq_run[121]
Definition: speedhq.c:116
static const uint8_t speedhq_level[121]
Definition: speedhq.c:97

Definition at line 135 of file speedhq.c.

◆ unscaled_quant_matrix

const uint8_t unscaled_quant_matrix[64]
static
Initial value:
= {
16, 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 144 of file speedhq.c.

Referenced by compute_quant_matrix().

◆ ff_speedhq_static_rl_table_store

uint8_t ff_speedhq_static_rl_table_store[2][2 *MAX_RUN+MAX_LEVEL+3]
static

Definition at line 155 of file speedhq.c.

Referenced by speedhq_static_init().

◆ ff_dc_lum_vlc_le

VLC ff_dc_lum_vlc_le
static

Definition at line 157 of file speedhq.c.

◆ ff_dc_chroma_vlc_le

VLC ff_dc_chroma_vlc_le
static

Definition at line 158 of file speedhq.c.

◆ ff_dc_alpha_run_vlc_le

VLC ff_dc_alpha_run_vlc_le
static

Definition at line 159 of file speedhq.c.

◆ ff_dc_alpha_level_vlc_le

VLC ff_dc_alpha_level_vlc_le
static

Definition at line 160 of file speedhq.c.

◆ ff_speedhq_decoder

AVCodec ff_speedhq_decoder
Initial value:
= {
.name = "speedhq",
.long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"),
.priv_data_size = sizeof(SHQContext),
.capabilities = AV_CODEC_CAP_DR1,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int speedhq_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: speedhq.c:415
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold int speedhq_decode_init(AVCodecContext *avctx)
Definition: speedhq.c:611
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959

Definition at line 681 of file speedhq.c.