42 #define FPS_TAG MKTAG('F', 'P', 'S', 'x') 
   77 static int huff_cmp(
const void *va, 
const void *vb)
 
   79     const Node *
a = va, *
b = vb;
 
   80     return (a->
count - b->count)*256 + a->
sym - b->sym;
 
   95     for (i = 0; i < 256; i++)
 
   96         nodes[i].
count = bytestream_get_le32(&src);
 
  106                       (
const uint32_t *) src, size >> 2);
 
  109     for (j = 0; j < 
h; j++) {
 
  110         for (i = 0; i < w*step; i += step) {
 
  116                 dst[i] += dst[i - 
stride];
 
  131                         void *
data, 
int *got_frame,
 
  136     int buf_size           = avpkt->
size;
 
  140     unsigned int version,header_size;
 
  142     const uint32_t *buf32;
 
  143     uint32_t *luma1,*luma2,*
cb,*
cr;
 
  145     int i, j, 
ret, is_chroma;
 
  146     const int planes = 3;
 
  155     version     = header & 0xff;
 
  156     header_size = (header & (1<<30))? 8 : 4; 
 
  160                "This file is encoded with Fraps version %d. " \
 
  161                "This codec can only decode versions <= 5.\n", version);
 
  168         unsigned needed_size = avctx->
width * avctx->
height * 3;
 
  169         if (version == 0) needed_size /= 2;
 
  170         needed_size += header_size;
 
  172         if (header & (1
U<<31)) {
 
  176         if (buf_size != needed_size) {
 
  178                    "Invalid frame length %d (should be %d)\n",
 
  179                    buf_size, needed_size);
 
  192         for (i = 0; i < planes; i++) {
 
  193             offs[i] = 
AV_RL32(buf + 4 + i * 4);
 
  194             if (offs[i] >= buf_size - header_size || (i && offs[i] <= offs[i - 1] + 1024)) {
 
  199         offs[planes] = buf_size - header_size;
 
  200         for (i = 0; i < planes; i++) {
 
  222         if (((avctx->
width % 8) != 0) || ((avctx->
height % 2) != 0)) {
 
  228         buf32 = (
const uint32_t*)buf;
 
  229         for (y = 0; y < avctx->
height / 2; y++) {
 
  230             luma1 = (uint32_t*)&f->
data[0][  y * 2      * f->
linesize[0] ];
 
  231             luma2 = (uint32_t*)&f->
data[0][ (y * 2 + 1) * f->
linesize[0] ];
 
  234             for (x = 0; x < avctx->
width; x += 8) {
 
  247             for (y = 0; y<avctx->
height; y++)
 
  249                        &buf[y * avctx->
width * 3],
 
  259         for (i = 0; i < planes; i++) {
 
  262                                            avctx->
width  >> is_chroma,
 
  263                                            avctx->
height >> is_chroma,
 
  264                                            buf + offs[i], offs[i + 1] - offs[i],
 
  265                                            is_chroma, 1)) < 0) {
 
  274         for (i = 0; i < planes; i++) {
 
  277                                            buf + offs[i], offs[i + 1] - offs[i], 0, 3)) < 0) {
 
  284         for (j = 0; j < avctx->
height; j++) {
 
  286             while (out < line_end) {
 
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
 
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B 
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
 
This structure describes decoded (raw) audio or video data. 
 
ptrdiff_t const GLvoid * data
 
int ff_huff_build_tree(AVCodecContext *avctx, 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 
 
static av_cold int init(AVCodecContext *avctx)
 
enum AVColorRange color_range
MPEG vs JPEG YUV range. 
 
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx. 
 
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_BUFFER_PADDING_SIZE at the end w...
 
static double cb(void *priv, double x, double y)
 
Multithreading support functions. 
 
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators. 
 
bitstream reader API header. 
 
static const uint8_t header[24]
 
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 
 
static int get_bits_left(GetBitContext *gb)
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
#define FF_HUFFMAN_FLAG_ZERO_COUNT
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
const char * name
Name of the codec implementation. 
 
Libavcodec external API header. 
 
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
 
static int huff_cmp(const void *va, const void *vb)
Comparator - our nodes should ascend by count but with preserved symbol order. 
 
enum AVPictureType pict_type
Picture type of the frame. 
 
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
 
int width
picture width / height. 
 
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code. 
 
packed RGB 8:8:8, 24bpp, BGRBGR... 
 
the normal 2^n-1 "JPEG" YUV ranges 
 
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome. 
 
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
 
static av_cold int decode_end(AVCodecContext *avctx)
closes decoder 
 
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs. 
 
main external API structure. 
 
static av_cold int decode_init(AVCodecContext *avctx)
initializes decoder 
 
enum AVColorSpace colorspace
YUV colorspace type. 
 
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext. 
 
huffman tree builder and VLC generator 
 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
 
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
 
GLint GLenum GLboolean GLsizei stride
 
common internal api header. 
 
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading. 
 
VLC_TYPE(* table)[2]
code, bits 
 
int key_frame
1 -> keyframe, 0-> not 
 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
 
static double cr(void *priv, double x, double y)
 
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
 
This structure stores compressed data. 
 
void ff_free_vlc(VLC *vlc)