Go to the documentation of this file.
36 #define CACHED_BITSTREAM_READER HAVE_FAST_64BIT
37 #define UNCHECKED_BITSTREAM_READER 1
46 #define FPS_TAG MKTAG('F', 'P', 'S', 'x')
80 static int huff_cmp(
const void *va,
const void *vb)
82 const Node *
a = va, *
b = vb;
83 return (
a->count -
b->count)*256 +
a->sym -
b->sym;
90 int h,
const uint8_t *
src,
int size,
int Uoff,
98 for (
i = 0;
i < 256;
i++)
99 nodes[
i].count = bytestream_get_le32(&
src);
108 s->bdsp.bswap_buf((uint32_t *)
s->tmpbuf,
109 (
const uint32_t *)
src,
size >> 2);
114 for (j = 0; j <
h; j++) {
139 const uint8_t *buf = avpkt->
data;
140 int buf_size = avpkt->
size;
142 unsigned int version,header_size;
143 const uint32_t *buf32;
144 uint32_t *luma1,*luma2,*
cb,*
cr;
146 int i, j,
ret, is_chroma;
158 is_pal = buf[1] == 2 &&
version == 1;
159 header_size = (
header & (1<<30))? 8 : 4;
169 unsigned needed_size = avctx->
width * avctx->
height + 1024;
170 needed_size += header_size;
171 if (buf_size != needed_size) {
173 "Invalid frame length %d (should be %d)\n",
174 buf_size, needed_size);
178 unsigned needed_size = avctx->
width * avctx->
height * 3;
179 if (
version == 0) needed_size /= 2;
180 needed_size += header_size;
186 if (buf_size != needed_size) {
188 "Invalid frame length %d (should be %d)\n",
189 buf_size, needed_size);
204 if (offs[
i] >= buf_size - header_size || (
i && offs[
i] <= offs[
i - 1] + 1024)) {
209 offs[
planes] = buf_size - header_size;
232 if (((avctx->
width % 8) != 0) || ((avctx->
height % 2) != 0)) {
238 buf32 = (
const uint32_t*)buf;
239 for (ptrdiff_t y = 0; y < avctx->
height / 2; y++) {
240 luma1 = (uint32_t*)&
f->data[0][ y * 2 *
f->linesize[0] ];
241 luma2 = (uint32_t*)&
f->data[0][ (y * 2 + 1) *
f->linesize[0] ];
242 cr = (uint32_t*)&
f->data[1][ y *
f->linesize[1] ];
243 cb = (uint32_t*)&
f->data[2][ y *
f->linesize[2] ];
244 for (ptrdiff_t x = 0; x < avctx->
width; x += 8) {
257 uint32_t *pal = (uint32_t *)
f->data[1];
259 for (
unsigned y = 0; y < 256; y++) {
260 pal[y] =
AV_RL32(buf) | 0xFF000000;
264 for (ptrdiff_t y = 0; y < avctx->
height; y++)
265 memcpy(&
f->data[0][y *
f->linesize[0]],
266 &buf[y * avctx->
width],
270 for (ptrdiff_t y = 0; y < avctx->
height; y++)
271 memcpy(&
f->data[0][(avctx->
height - y - 1) *
f->linesize[0]],
272 &buf[y * avctx->
width * 3],
286 avctx->
width >> is_chroma,
287 avctx->
height >> is_chroma,
288 buf + offs[
i], offs[
i + 1] - offs[
i],
289 is_chroma, 1)) < 0) {
301 buf + offs[
i], offs[
i + 1] - offs[
i], 0, 3)) < 0) {
308 for (j = 0; j < avctx->
height; j++) {
309 uint8_t *line_end =
out + 3*avctx->
width;
310 while (
out < line_end) {
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVColorSpace colorspace
YUV colorspace type.
static double cb(void *priv, double x, double y)
const FFCodec ff_fraps_decoder
This structure describes decoded (raw) audio or video data.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
@ AVCOL_RANGE_JPEG
Full range content.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
static av_cold int decode_end(AVCodecContext *avctx)
closes decoder
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in FFCodec caps_internal and use ff_thread_get_buffer() to allocate frames. Otherwise decode directly into the user-supplied frames. Call ff_thread_report_progress() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
AVCodec p
The public AVCodec.
#define FF_HUFFMAN_FLAG_ZERO_COUNT
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
#define CODEC_LONG_NAME(str)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
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
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AV_PICTURE_TYPE_I
Intra.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
@ AVCOL_RANGE_UNSPECIFIED
static int decode_frame(AVCodecContext *avctx, AVFrame *f, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
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 uint8_t header[24]
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
#define i(width, name, range_min, range_max)
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...
static const struct @363 planes[]
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
void ff_vlc_free(VLC *vlc)
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
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int huff_cmp(const void *va, const void *vb)
Comparator - our nodes should ascend by count but with preserved symbol order.
main external API structure.
static av_cold int decode_init(AVCodecContext *avctx)
initializes decoder
This structure stores compressed data.
static double cr(void *priv, double x, double y)
int width
picture width / height.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B