annotate mjpegdec.h @ 10888:427070f45916 libavcodec

Support 2Vuy in mov, fixes issue 1690. Patch by ami_stuff, ami_stuff o2 pl
author cehoyos
date Sat, 16 Jan 2010 00:32:09 +0000
parents 3e404d2520a7
children 34a65026fa06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
1 /*
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
2 * MJPEG decoder
8629
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 8287
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
4 * Copyright (c) 2003 Alex Beregszaszi
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
5 * Copyright (c) 2003-2004 Michael Niedermayer
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
6 *
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
7 * This file is part of FFmpeg.
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
8 *
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
13 *
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
17 * Lesser General Public License for more details.
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
18 *
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
22 */
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
23
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
24 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8629
diff changeset
25 * @file libavcodec/mjpegdec.h
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
26 * MJPEG decoder.
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
27 */
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
28
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6571
diff changeset
29 #ifndef AVCODEC_MJPEGDEC_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6571
diff changeset
30 #define AVCODEC_MJPEGDEC_H
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
31
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
32 #include "avcodec.h"
9428
0dce4fe6e6f3 Rename bitstream.h to get_bits.h.
stefano
parents: 9355
diff changeset
33 #include "get_bits.h"
5045
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
34 #include "dsputil.h"
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
35
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
36 #define MAX_COMPONENTS 4
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
37
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
38 typedef struct MJpegDecodeContext {
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
39 AVCodecContext *avctx;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
40 GetBitContext gb;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
41
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
42 int start_code; /* current start code */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
43 int buffer_size;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
44 uint8_t *buffer;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
45
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
46 int16_t quant_matrixes[4][64];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
47 VLC vlcs[2][4];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
48 int qscale[4]; ///< quantizer scale calculated from quant_matrixes
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
49
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
50 int org_height; /* size given at codec init */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
51 int first_picture; /* true if decoding first picture */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
52 int interlaced; /* true if interlaced */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
53 int bottom_field; /* true if bottom field */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
54 int lossless;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
55 int ls;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
56 int progressive;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
57 int rgb;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
58 int rct; /* standard rct */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
59 int pegasus_rct; /* pegasus reversible colorspace transform */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
60 int bits; /* bits per component */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
61
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
62 int maxval;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
63 int near; ///< near lossless bound (si 0 for lossless)
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
64 int t1,t2,t3;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
65 int reset; ///< context halfing intervall ?rename
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
66
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
67 int width, height;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
68 int mb_width, mb_height;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
69 int nb_components;
8287
7a1d037482c4 fix progressive jpeg:
lorenm
parents: 7760
diff changeset
70 int block_stride[MAX_COMPONENTS];
5045
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
71 int component_id[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
72 int h_count[MAX_COMPONENTS]; /* horizontal and vertical count for each component */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
73 int v_count[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
74 int comp_index[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
75 int dc_index[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
76 int ac_index[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
77 int nb_blocks[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
78 int h_scount[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
79 int v_scount[MAX_COMPONENTS];
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
80 int h_max, v_max; /* maximum h and v counts */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
81 int quant_index[4]; /* quant table index for each component */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
82 int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
83 AVFrame picture; /* picture structure */
9913
b73796e93571 Add a got_picture flag to MJpegDecodeContext which indicates if its picture
reimar
parents: 9428
diff changeset
84 int got_picture; ///< we found a SOF and picture is valid, too.
5045
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
85 int linesize[MAX_COMPONENTS]; ///< linesize << interlaced
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
86 int8_t *qscale_table;
6571
ad0c77d2b6ee Increase alignment for DCT block arrays from 8 to 16
superdump
parents: 6448
diff changeset
87 DECLARE_ALIGNED_16(DCTELEM, block[64]);
8287
7a1d037482c4 fix progressive jpeg:
lorenm
parents: 7760
diff changeset
88 DCTELEM (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode)
7a1d037482c4 fix progressive jpeg:
lorenm
parents: 7760
diff changeset
89 uint8_t *last_nnz[MAX_COMPONENTS];
7a1d037482c4 fix progressive jpeg:
lorenm
parents: 7760
diff changeset
90 uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
5045
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
91 ScanTable scantable;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
92 DSPContext dsp;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
93
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
94 int restart_interval;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
95 int restart_count;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
96
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
97 int buggy_avid;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
98 int cs_itu601;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
99 int interlace_polarity;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
100
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
101 int mjpb_skiptosod;
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
102
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
103 int cur_scan; /* current scan, used by JPEG-LS */
10438
710e226783f0 Flip (M)JPEG frames encoded by Intel JPEG library.
cehoyos
parents: 9913
diff changeset
104 int flipped; /* true if picture is flipped */
10487
3e404d2520a7 Avoid huge array for rgb ljpeg on the stack.
michael
parents: 10438
diff changeset
105
3e404d2520a7 Avoid huge array for rgb ljpeg on the stack.
michael
parents: 10438
diff changeset
106 uint16_t (*ljpeg_buffer)[4];
3e404d2520a7 Avoid huge array for rgb ljpeg on the stack.
michael
parents: 10438
diff changeset
107 unsigned int ljpeg_buffer_size;
5045
f0e079daad30 move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents: 5044
diff changeset
108 } MJpegDecodeContext;
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
109
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
110 int ff_mjpeg_decode_init(AVCodecContext *avctx);
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
111 int ff_mjpeg_decode_end(AVCodecContext *avctx);
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
112 int ff_mjpeg_decode_frame(AVCodecContext *avctx,
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
113 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8718
diff changeset
114 AVPacket *avpkt);
5044
924fdd6175b1 move mjpeg-b decoder in its own file
aurel
parents: 5043
diff changeset
115 int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
924fdd6175b1 move mjpeg-b decoder in its own file
aurel
parents: 5043
diff changeset
116 int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
924fdd6175b1 move mjpeg-b decoder in its own file
aurel
parents: 5043
diff changeset
117 int ff_mjpeg_decode_sof(MJpegDecodeContext *s);
924fdd6175b1 move mjpeg-b decoder in its own file
aurel
parents: 5043
diff changeset
118 int ff_mjpeg_decode_sos(MJpegDecodeContext *s);
5043
41d1e47e30e0 10l: forgot to svn add mjpegdec.h
aurel
parents:
diff changeset
119
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6571
diff changeset
120 #endif /* AVCODEC_MJPEGDEC_H */