Go to the documentation of this file.
64 int plane,
int x,
int y,
int ilace,
65 int16_t *block0, int16_t *
block1)
67 uint8_t *p = pic->
data[plane] + x;
69 c->hqhqadsp.idct_put(p + y * pic->
linesize[plane],
70 pic->
linesize[plane] << ilace, block0);
71 c->hqhqadsp.idct_put(p + (y + (ilace ? 1 : 8)) * pic->
linesize[plane],
76 int qsel,
int is_chroma,
int is_hqa)
115 for (
i = 0;
i < 8;
i++) {
130 int prof_num,
size_t data_size)
135 uint32_t slice_off[21];
136 int slice, start_off, next_off,
i,
ret;
150 ctx->avctx->bits_per_raw_sample = 8;
159 slice_off[
i] = bytestream2_get_be24(gbc) - 4;
162 for (slice = 0; slice <
profile->num_slices; slice++) {
163 start_off = next_off;
167 if (slice_off[slice] < (
profile->num_slices + 1) * 3 ||
168 slice_off[slice] >= slice_off[slice + 1] ||
169 slice_off[slice + 1] > data_size) {
175 (slice_off[slice + 1] - slice_off[slice]) * 8);
177 for (
i = 0;
i < (next_off - start_off) *
profile->tab_w;
i++) {
181 "Error decoding macroblock %d at slice %d.\n",
i, slice);
202 for (
i = 0;
i < 12;
i++)
203 memset(
c->block[
i], 0,
sizeof(*
c->block));
204 for (
i = 0;
i < 12;
i++)
205 c->block[
i][0] = -128 * (1 << 6);
215 for (
i = 0;
i < 12;
i++) {
216 if (!(cbp & (1 <<
i)))
235 int quant,
int slice_no,
int w,
int h)
240 for (
i = 0;
i <
h;
i += 16) {
241 off = (slice_no * 16 +
i * 3) & 0x70;
242 for (j = off; j <
w; j += 128) {
246 "Error decoding macroblock at %dx%d.\n",
i, j);
258 const int num_slices = 8;
259 uint32_t slice_off[9];
267 width = bytestream2_get_be16(gbc);
268 height = bytestream2_get_be16(gbc);
276 ctx->avctx->bits_per_raw_sample = 8;
281 quant = bytestream2_get_byte(gbc);
285 "Invalid quantization matrix %d.\n",
quant);
294 for (
i = 0;
i < num_slices + 1;
i++)
295 slice_off[
i] = bytestream2_get_be32(gbc) - 4;
297 for (slice = 0; slice < num_slices; slice++) {
298 if (slice_off[slice] < (num_slices + 1) * 3 ||
299 slice_off[slice] >= slice_off[slice + 1] ||
300 slice_off[slice + 1] > data_size) {
306 (slice_off[slice + 1] - slice_off[slice]) * 8);
322 unsigned int data_size;
332 info_tag = bytestream2_peek_le32(gbc);
333 if (info_tag ==
MKTAG(
'I',
'N',
'F',
'O')) {
336 info_size = bytestream2_get_le32(gbc);
355 tag = bytestream2_get_le32(gbc);
356 if ((
tag & 0x00FFFFFF) == (
MKTAG(
'U',
'V',
'C',
' ') & 0x00FFFFFF)) {
358 }
else if (
tag ==
MKTAG(
'H',
'Q',
'A',
'1')) {
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa)
static int get_bits_left(GetBitContext *gb)
static const uint8_t hq_ac_bits[NUM_HQ_AC_ENTRIES]
static int hq_decode_mb(HQContext *c, AVFrame *pic, GetBitContext *gb, int x, int y)
This structure describes decoded (raw) audio or video data.
#define AV_LOG_VERBOSE
Detailed information.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
static const int16_t hq_ac_syms[NUM_HQ_AC_ENTRIES]
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic, int *got_frame, AVPacket *avpkt)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
int ff_canopus_parse_info_tag(AVCodecContext *avctx, const uint8_t *src, size_t size)
static double val(void *priv, double ch)
static int hq_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, int prof_num, size_t data_size)
static const uint8_t hq_ac_skips[NUM_HQ_AC_ENTRIES]
static const uint8_t quant[64]
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define FF_CODEC_DECODE_CB(func)
static int hqa_decode_slice(HQContext *ctx, AVFrame *pic, GetBitContext *gb, int quant, int slice_no, int w, int h)
static VLCElem hq_ac_vlc[1184]
static int get_sbits(GetBitContext *s, int n)
static const int32_t *const hq_quants[NUM_HQ_QUANTS][2][4]
static av_cold void hq_init_vlcs(void)
#define CODEC_LONG_NAME(str)
static const uint8_t cbp_vlc_lens[16]
static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup, GetBitContext *gb, int x, int y)
static VLCElem hqa_cbp_vlc[32]
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
static const uint8_t cbp_vlc_bits[16]
static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, size_t data_size)
static const uint16_t hq_ac_codes[NUM_HQ_AC_ENTRIES]
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define DECLARE_ALIGNED(n, t, v)
static int16_t block1[64]
#define NUM_HQ_AC_ENTRIES
av_cold void ff_hqdsp_init(HQDSPContext *c)
#define i(width, name, range_min, range_max)
static const HQProfile hq_profile[NUM_HQ_PROFILES]
static void put_blocks(HQContext *c, AVFrame *pic, int plane, int x, int y, int ilace, int16_t *block0, int16_t *block1)
const char * name
Name of the codec implementation.
const uint8_t ff_zigzag_direct[64]
main external API structure.
#define VLC_INIT_STATIC_TABLE(vlc_table, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define avpriv_request_sample(...)
This structure stores compressed data.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
const FFCodec ff_hq_hqa_decoder
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)