]> git.sesse.net Git - ffmpeg/blob - libavcodec/utvideo.h
asvenc: free avctx->coded_frame on codec close
[ffmpeg] / libavcodec / utvideo.h
1 /*
2  * Common Ut Video header
3  * Copyright (c) 2011 Konstantin Shishkov
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #ifndef AVCODEC_UTVIDEO_H
23 #define AVCODEC_UTVIDEO_H
24
25 /**
26  * @file
27  * Common Ut Video header
28  */
29
30 #include "libavutil/common.h"
31 #include "avcodec.h"
32 #include "dsputil.h"
33
34 enum {
35     PRED_NONE = 0,
36     PRED_LEFT,
37     PRED_GRADIENT,
38     PRED_MEDIAN,
39 };
40
41 enum {
42     COMP_NONE = 0,
43     COMP_HUFF,
44 };
45
46 /*
47  * "Original format" markers.
48  * Based on values gotten from the official VFW encoder.
49  * They are not used during decoding, but they do have
50  * an informative role on seeing what was input
51  * to the encoder.
52  */
53 enum {
54     UTVIDEO_RGB  = MKTAG(0x00, 0x00, 0x01, 0x18),
55     UTVIDEO_RGBA = MKTAG(0x00, 0x00, 0x02, 0x18),
56     UTVIDEO_420  = MKTAG('Y', 'V', '1', '2'),
57     UTVIDEO_422  = MKTAG('Y', 'U', 'Y', '2'),
58 };
59
60 /* Mapping of libavcodec prediction modes to Ut Video's */
61 extern const int ff_ut_pred_order[5];
62
63 /* Order of RGB(A) planes in Ut Video */
64 extern const int ff_ut_rgb_order[4];
65
66 typedef struct UtvideoContext {
67     AVCodecContext *avctx;
68     DSPContext     dsp;
69
70     uint32_t frame_info_size, flags, frame_info;
71     int      planes;
72     int      slices;
73     int      compression;
74     int      interlaced;
75     int      frame_pred;
76
77     int      slice_stride;
78     uint8_t *slice_bits, *slice_buffer[4];
79     int      slice_bits_size;
80 } UtvideoContext;
81
82 typedef struct HuffEntry {
83     uint8_t  sym;
84     uint8_t  len;
85     uint32_t code;
86 } HuffEntry;
87
88 /* Compare huffman tree nodes */
89 int ff_ut_huff_cmp_len(const void *a, const void *b);
90
91 #endif /* AVCODEC_UTVIDEO_H */