39#define CHROMA_DC_BITS 11
40#define LUMA_AC_BITS 10
41#define CHROMA_AC_BITS 10
95 for (
int i = 0;
i < 64;
i++)
100 const VLCElem * dc_table,
int dc_bits,
const VLCElem * ac_table,
int ac_bits,
101 int16_t * dc_pred,
const uint16_t *
dequant,
107 s->bdsp.clear_block(
block);
121 for (
int i = 1;
i < 64;
i++) {
122 int symbol =
get_vlc2(gb, ac_table, ac_bits, 2);
146 const uint8_t * buf = avpkt->
data;
149 int16_t dc_pred[3] = {0, 0, 0};
189 int blocks_per_mb = 2 + (1<<mb_size_log2)*(1<<mb_size_log2) / 64 - 2*yuv20p_half;
201 if (!
s->bitstream_buf)
205 for (
int i = 8;
i < avpkt->
size;
i++) {
206 int src = buf[
i] ^ 0x80;
208 if (
src == 0xFF &&
i + 1 < avpkt->
size && (buf[
i + 1] ^ 0x80) == 0x00)
217 for (
int mb_y = 0; mb_y < avctx->
height / 8; mb_y++)
218 for (
int mb_x = 0; mb_x < avctx->
width / 16; mb_x++)
219 for (
int b = 0;
b < 4;
b++) {
225 int plane =
b < luma_block ? 0 :
b - 1;
228 if (
b < luma_block) {
229 y = 8*mb_y + 8*(
b >> 1);
230 x = 16*mb_x + 8*(
b & 1);
235 yclip = y + 8 >= avctx->
height / 2;
242 for (
int yy = 0; yy < 8 && y + yy < avctx->
height / 2; yy++)
243 memcpy(
frame->data[plane] + (y+yy)*
frame->linesize[plane] + x,
tmp + yy, 8);
247 frame->data[plane] + y*
frame->linesize[plane] + x,
248 frame->linesize[plane]);
254 for (
int f = 0;
f < fields;
f++)
255 for (
int mb_y = 0; mb_y < (avctx->
height + 15) / 16 / fields; mb_y++)
256 for (
int mb_x = 0; mb_x < (avctx->
width + 15) / 16; mb_x++)
257 for (
int b = 0;
b < (yuv20p_half ? 4 : 6);
b++) {
258 int luma_block = yuv20p_half ? 2 : 4;
263 int plane =
b < luma_block ? 0 :
b - (yuv20p_half ? 1 : 3);
266 if (
b < luma_block) {
267 y = 16*mb_y + 8*(
b >> 1);
268 x = 16*mb_x + 8*(
b & 1);
276 frame->data[plane] + (
f + y*fields)*
frame->linesize[plane] + x,
277 (yuv20p_half &&
b < 2 ? 2 : 1) * fields *
frame->linesize[plane]);
281 if (yuv20p_half &&
b < 2)
283 frame->data[plane] + y*
frame->linesize[plane] + x,
284 2*
frame->linesize[plane], 2*
frame->linesize[plane], 8);
287 for (
int f = 0;
f < fields;
f++)
288 for (
int j = 0; j < (avctx->
height + 7) / fields / 8; j++)
289 for (
int i = 0;
i < (avctx->
width + 7) / 8;
i++)
290 for (
int plane = 0; plane < 3; plane++) {
297 dc_pred + plane,
dequant[!!plane],
298 frame->data[plane] + (
f + 8*j*fields)*
frame->linesize[plane] + 8*
i,
299 fields *
frame->linesize[plane]);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
const FFCodec ff_lead_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
static int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf, int16_t *dst, int mul, int shift, int coeff_num)
#define i(width, name, range_min, range_max)
static VLCElem dc_vlc[1104]
static VLCElem ac_vlc[554]
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AV_CEIL_RSHIFT(a, b)
static void copy_block8(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(* 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_bits_left(GetBitContext *gb)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_xbits(GetBitContext *s, int n)
Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
const uint8_t ff_mjpeg_std_luminance_quant_tbl[64]
const uint8_t ff_mjpeg_std_chrominance_quant_tbl[64]
const uint8_t ff_mjpeg_val_ac_chrominance[]
const uint8_t ff_mjpeg_val_ac_luminance[]
static const uint8_t luma_dc_len[]
static const uint8_t luma_ac_len[]
static const uint8_t chroma_dc_len[]
static const uint8_t chroma_ac_len[]
static VLCElem chroma_ac_vlc[1160]
static av_cold int lead_decode_end(AVCodecContext *avctx)
static VLCElem chroma_dc_vlc[1<< CHROMA_DC_BITS]
static av_cold int lead_decode_init(AVCodecContext *avctx)
static int lead_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static av_cold void lead_init_static_data(void)
static VLCElem luma_dc_vlc[1<< LUMA_DC_BITS]
static VLCElem luma_ac_vlc[1160]
static int decode_block(LeadContext *s, GetBitContext *gb, const VLCElem *dc_table, int dc_bits, const VLCElem *ac_table, int ac_bits, int16_t *dc_pred, const uint16_t *dequant, uint8_t *dst, int stride)
static void calc_dequant(uint16_t *dequant, const uint8_t *quant_tbl, int q)
av_cold void ff_blockdsp_init(BlockDSPContext *c)
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
Macro definitions for various function/variable attributes.
static int ff_thread_once(char *control, void(*routine)(void))
const uint8_t ff_zigzag_direct[64]
Memory handling functions.
#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)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define FF_ARRAY_ELEMS(a)
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.
uint8_t permutated_scantable[64]
unsigned int bitstream_buf_size
#define avpriv_request_sample(...)
#define VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, lens, lens_wrap, syms, syms_wrap, syms_size, offset, flags)