66 int plane,
int x,
int y,
int ilace,
67 int16_t *block0, int16_t *
block1)
69 uint8_t *p = pic->
data[plane] + x;
71 c->hqhqadsp.idct_put(p + y * pic->
linesize[plane],
72 pic->
linesize[plane] << ilace, block0);
73 c->hqhqadsp.idct_put(p + (y + (ilace ? 1 : 8)) * pic->
linesize[plane],
78 int qsel,
int is_chroma,
int is_hqa)
116 memset(
c->block, 0, 8 *
sizeof(
c->block[0]));
121 for (
i = 0;
i < 8;
i++) {
136 int prof_num,
size_t data_size)
141 uint32_t slice_off[21];
142 int slice, start_off, next_off,
i, ret;
159 ctx->avctx->bits_per_raw_sample = 8;
168 slice_off[
i] = bytestream2_get_be24u(gbc) - 4;
172 for (slice = 0; slice <
profile->num_slices; slice++) {
173 start_off = next_off;
176 if (slice_off[slice] < (
profile->num_slices + 1) * 3 ||
177 slice_off[slice] >= slice_off[slice + 1] ||
178 slice_off[slice + 1] > data_size) {
180 "Invalid slice size %zu.\n", data_size);
184 (slice_off[slice + 1] - slice_off[slice]) * 8);
186 for (
i = 0;
i < (next_off - start_off) *
profile->tab_w;
i++) {
190 "Error decoding macroblock %d at slice %d.\n",
i, slice);
209 memset(
c->block, 0, 12 *
sizeof(
c->block[0]));
210 for (
i = 0;
i < 12;
i++)
211 c->block[
i][0] = -128 * (1 << 6);
221 for (
i = 0;
i < 12;
i++) {
222 if (!(cbp & (1 <<
i)))
241 int quant,
int slice_no,
int w,
int h)
246 for (
i = 0;
i <
h;
i += 16) {
247 off = (slice_no * 16 +
i * 3) & 0x70;
248 for (j = off; j <
w; j += 128) {
252 "Error decoding macroblock at %dx%d.\n",
i, j);
264 const int num_slices = 8;
265 uint32_t slice_off[9];
272 int width = bytestream2_get_be16u(gbc);
273 int height = bytestream2_get_be16u(gbc);
281 ctx->avctx->bits_per_raw_sample = 8;
286 int quant = bytestream2_get_byteu(gbc);
290 "Invalid quantization matrix %d.\n",
quant);
299 for (
i = 0;
i < num_slices + 1;
i++)
300 slice_off[
i] = bytestream2_get_be32u(gbc) - 4;
302 for (slice = 0; slice < num_slices; slice++) {
303 if (slice_off[slice] < (num_slices + 1) * 3 ||
304 slice_off[slice] >= slice_off[slice + 1] ||
305 slice_off[slice + 1] > data_size) {
307 "Invalid slice size %zu.\n", data_size);
311 (slice_off[slice + 1] - slice_off[slice]) * 8);
326 unsigned int data_size;
329 if (avpkt->
size < 4 + 4) {
335 uint32_t info_tag = bytestream2_peek_le32u(gbc);
336 if (info_tag ==
MKTAG(
'I',
'N',
'F',
'O')) {
338 int info_size = bytestream2_get_le32u(gbc);
357 unsigned tag = bytestream2_get_le32u(gbc);
358 if ((
tag & 0x00FFFFFF) == (
MKTAG(
'U',
'V',
'C',
' ') & 0x00FFFFFF)) {
360 }
else if (
tag ==
MKTAG(
'H',
'Q',
'A',
'1')) {
const FFCodec ff_hq_hqa_decoder
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int ff_canopus_parse_info_tag(AVCodecContext *avctx, const uint8_t *src, size_t size)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
static int16_t block1[64]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
int(* init)(AVBSFContext *ctx)
bitstream reader API header.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_sbits(GetBitContext *s, int n)
#define CLOSE_READER(name, gb)
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
#define OPEN_READER(name, gb)
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#define UPDATE_CACHE(name, gb)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const VLCElem ff_hq_cbp_vlc[1<< HQ_CBP_VLC_BITS]
static int hq_decode_mb(HQContext *c, AVFrame *pic, GetBitContext *gb, int x, int y)
static const int32_t * hq_quants[NUM_HQ_QUANTS][2][4]
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa)
static av_cold void hq_init_static(void)
static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, size_t data_size)
static int hq_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, int prof_num, size_t data_size)
static RL_VLC_ELEM hq_ac_rvlc[1184]
static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic, int *got_frame, AVPacket *avpkt)
static void put_blocks(HQContext *c, AVFrame *pic, int plane, int x, int y, int ilace, int16_t *block0, int16_t *block1)
static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup, GetBitContext *gb, int x, int y)
static int hqa_decode_slice(HQContext *ctx, AVFrame *pic, GetBitContext *gb, int quant, int slice_no, int w, int h)
static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)
static const uint8_t hq_quant_map[NUM_HQ_QUANTS][2][4]
static const uint8_t hq_ac_lens[NUM_HQ_AC_ENTRIES]
#define NUM_HQ_AC_ENTRIES
#define HQ_AC_INVALID_RUN
static const HQProfile hq_profile[NUM_HQ_PROFILES]
static const int32_t qmats[NUM_QMATS][MAT_SIZE]
static const uint8_t hq_perms[]
static const int16_t hq_ac_sym[NUM_HQ_AC_ENTRIES]
av_cold void ff_hqdsp_init(HQDSPContext *c)
HQ/HQA variant of AAN IDCT It differs from the standard AAN IDCT in precision and in the second stage...
Macro definitions for various function/variable attributes.
static int ff_thread_once(char *control, void(*routine)(void))
#define MKTAG(a, b, c, d)
const uint8_t ff_zigzag_direct[64]
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define FF_ARRAY_ELEMS(a)
main external API structure.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This structure stores compressed data.
#define avpriv_request_sample(...)
static AVFormatContext * ctx
#define VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, lens, lens_wrap, syms, syms_wrap, syms_size, offset, flags)
static const uint8_t quant[64]