36#define CACHED_BITSTREAM_READER HAVE_FAST_64BIT
37#define UNCHECKED_BITSTREAM_READER 1
47#define FPS_TAG MKTAG('F', 'P', 'S', 'x')
81static int huff_cmp(
const void *va,
const void *vb)
83 const Node *
a = va, *
b = vb;
84 return (
a->count -
b->count)*256 +
a->sym -
b->sym;
91 int h,
const uint8_t *
src,
int size,
int Uoff,
99 for (
i = 0;
i < 256;
i++)
100 nodes[
i].count = bytestream_get_le32(&
src);
109 s->bdsp.bswap_buf((uint32_t *)
s->tmpbuf,
110 (
const uint32_t *)
src,
size >> 2);
115 for (j = 0; j <
h; j++) {
116 for (
i = 0;
i <
w*step;
i += step) {
140 const uint8_t *buf = avpkt->
data;
141 int buf_size = avpkt->
size;
143 unsigned int version,header_size;
144 const uint32_t *
buf32;
145 uint32_t *luma1,*luma2,*
cb,*
cr;
147 int i, j, ret, is_chroma;
159 is_pal = buf[1] == 2 &&
version == 1;
160 header_size = (
header & (1<<30))? 8 : 4;
170 unsigned needed_size = avctx->
width * avctx->
height + 1024;
171 needed_size += header_size;
172 if (buf_size != needed_size) {
174 "Invalid frame length %d (should be %d)\n",
175 buf_size, needed_size);
179 unsigned needed_size = avctx->
width * avctx->
height * 3;
180 if (
version == 0) needed_size /= 2;
181 needed_size += header_size;
187 if (buf_size != needed_size) {
189 "Invalid frame length %d (should be %d)\n",
190 buf_size, needed_size);
205 if (offs[
i] >= buf_size - header_size || (
i && offs[
i] <= offs[
i - 1] + 1024)) {
210 offs[
planes] = buf_size - header_size;
230 if (((avctx->
width % 8) != 0) || ((avctx->
height % 2) != 0)) {
236 buf32 = (
const uint32_t*)buf;
237 for (ptrdiff_t y = 0; y < avctx->
height / 2; y++) {
238 luma1 = (uint32_t*)&
f->data[0][ y * 2 *
f->linesize[0] ];
239 luma2 = (uint32_t*)&
f->data[0][ (y * 2 + 1) *
f->linesize[0] ];
240 cr = (uint32_t*)&
f->data[1][ y *
f->linesize[1] ];
241 cb = (uint32_t*)&
f->data[2][ y *
f->linesize[2] ];
242 for (ptrdiff_t x = 0; x < avctx->
width; x += 8) {
255 uint32_t *pal = (uint32_t *)
f->data[1];
257 for (
unsigned y = 0; y < 256; y++) {
258 pal[y] =
AV_RL32(buf) | 0xFF000000;
262 for (ptrdiff_t y = 0; y < avctx->
height; y++)
263 memcpy(&
f->data[0][y *
f->linesize[0]],
264 &buf[y * avctx->
width],
268 for (ptrdiff_t y = 0; y < avctx->
height; y++)
269 memcpy(&
f->data[0][(avctx->
height - y - 1) *
f->linesize[0]],
270 &buf[y * avctx->
width * 3],
284 avctx->
width >> is_chroma,
285 avctx->
height >> is_chroma,
286 buf + offs[
i], offs[
i + 1] - offs[
i],
287 is_chroma, 1)) < 0) {
299 buf + offs[
i], offs[
i + 1] - offs[
i], 0, 3)) < 0) {
306 for (j = 0; j < avctx->
height; j++) {
307 uint8_t *line_end =
out + 3*avctx->
width;
308 while (
out < line_end) {
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_fraps_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int(* init)(AVBSFContext *ctx)
static int huff_cmp(const void *va, const void *vb)
Comparator - our nodes should ascend by count but with preserved symbol order.
static av_cold int decode_init(AVCodecContext *avctx)
initializes decoder
static av_cold int decode_end(AVCodecContext *avctx)
closes decoder
static int decode_frame(AVCodecContext *avctx, AVFrame *f, int *got_frame, AVPacket *avpkt)
static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, int h, const uint8_t *src, int size, int Uoff, const int step)
decode Fraps v2 packed plane
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.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits, Node *nodes, HuffCmp cmp, int flags)
nodes size must be 2*nb_codes first nb_codes nodes.count must be set
huffman tree builder and VLC generator
#define FF_HUFFMAN_FLAG_ZERO_COUNT
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold int decode_end(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
Multithreading API for decoders.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static const struct @257111027162314367033347246032313251342043035002 planes[]
Memory handling functions.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
static const uint8_t header[24]
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
uint32_t buf32[PRNG_CACHE_SIZE > > 2]
static double cr(void *priv, double x, double y)
static double cb(void *priv, double x, double y)
void ff_vlc_free(VLC *vlc)