32#define BITSTREAM_READER_LE
70 for (
i = 1;
i < 64;) {
87 for (j = 0; j <
value; j++)
92 block[scantable[
i]] = -
s->qtable[scantable[
i]];
97 block[scantable[
i]] =
s->qtable[scantable[
i]];
113 block[0] += 128 << 4;
120 ptrdiff_t linesize =
frame->linesize[0];
121 uint8_t *dest_y =
frame->data[0] + (mb_y * 16 * linesize) + mb_x * 16;
122 uint8_t *dest_cb =
frame->data[1] + (mb_y * 8 *
frame->linesize[1]) + mb_x * 8;
123 uint8_t *dest_cr =
frame->data[2] + (mb_y * 8 *
frame->linesize[2]) + mb_x * 8;
136 ptrdiff_t dst_stride,
int dc)
140 for (j = 0; j < 8; j++)
141 memset(
dst + j * dst_stride,
level, 8);
145 int mb_x,
int mb_y,
const int8_t *dc)
147 ptrdiff_t linesize =
frame->linesize[0];
148 uint8_t *dest_y =
frame->data[0] + (mb_y * 16 * linesize) + mb_x * 16;
149 uint8_t *dest_cb =
frame->data[1] + (mb_y * 8 *
frame->linesize[1]) + mb_x * 8;
150 uint8_t *dest_cr =
frame->data[2] + (mb_y * 8 *
frame->linesize[2]) + mb_x * 8;
153 tgq_dconly(
s, dest_y + 8 * linesize, linesize, dc[2]);
154 tgq_dconly(
s, dest_y + 8 * linesize + 8, linesize, dc[3]);
167 mode = bytestream2_get_byte(gbyte);
174 for (
i = 0;
i < 6;
i++) {
185 int mv = bytestream2_get_byte(gbyte);
187 int mv_y =
mv & 0x0F;
188 if (!
s->last_frame->data[0]) {
192 if (mv_x >= 8) mv_x -= 16;
193 if (mv_y >= 8) mv_y -= 16;
194 x = mb_x * 16 - mv_x;
195 y = mb_y * 16 - mv_y;
196 if (x < 0 || x + 16 >
s->width || y < 0 || y + 16 >
s->height) {
201 s->last_frame->data[0] + y *
s->last_frame->linesize[0] + x,
202 frame->linesize[0],
s->last_frame->linesize[0], 16);
203 for (
int p = 1; p < 3; p++)
205 s->last_frame->data[p] + (y >> 1) *
s->last_frame->linesize[p] + (x >> 1),
206 frame->linesize[p],
s->last_frame->linesize[p], 8);
209 }
else if (
mode == 3) {
210 memset(dc, bytestream2_get_byte(gbyte), 4);
211 dc[4] = bytestream2_get_byte(gbyte);
212 dc[5] = bytestream2_get_byte(gbyte);
213 }
else if (
mode == 6) {
216 }
else if (
mode == 12) {
217 for (
i = 0;
i < 6;
i++) {
218 dc[
i] = bytestream2_get_byte(gbyte);
233 const int a = (14 * (100 -
quant)) / 100 + 1;
234 const int b = (11 * (100 -
quant)) / 100 + 4;
235 for (j = 0; j < 8; j++)
236 for (
i = 0;
i < 8;
i++)
237 s->qtable[j * 8 +
i] = ((
a * (j +
i) / (7 + 7) +
b) *
244 const uint8_t *buf = avpkt->
data;
245 int buf_size = avpkt->
size;
255 big_endian =
AV_RL32(&buf[4]) > 0x000FFFFF;
258 s->width = bytestream2_get_be16u(&gbyte);
259 s->height = bytestream2_get_be16u(&gbyte);
261 s->width = bytestream2_get_le16u(&gbyte);
262 s->height = bytestream2_get_le16u(&gbyte);
265 if (
s->avctx->width !=
s->width ||
s->avctx->height !=
s->height) {
const uint16_t ff_inv_aanscales[64]
AAN (Arai, Agui and Nakajima) (I)DCT tables.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_eatgq_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
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)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
static void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
static void copy_block16(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
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)
void ff_ea_idct_put_c(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
static void tgq_calculate_qtable(TgqContext *s, int quant)
static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static void tgq_dconly(TgqContext *s, unsigned char *dst, ptrdiff_t dst_stride, int dc)
static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
static int tgq_decode_mb(TgqContext *s, GetByteContext *gbyte, AVFrame *frame, int mb_y, int mb_x)
static av_cold int tgq_decode_init(AVCodecContext *avctx)
static av_cold int tgq_decode_close(AVCodecContext *avctx)
static void tgq_idct_put_mb_dconly(TgqContext *s, AVFrame *frame, int mb_x, int mb_y, const int8_t *dc)
static void tgq_idct_put_mb(TgqContext *s, int16_t(*block)[64], AVFrame *frame, int mb_x, int mb_y)
bitstream reader API header.
static int get_sbits(GetBitContext *s, int n)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int8_t mv[256][2]
Macro definitions for various function/variable attributes.
const uint8_t ff_zigzag_direct[64]
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
static const uint8_t quant[64]