Mercurial > libavcodec.hg
annotate mjpegdec.h @ 7462:5cbf11f56c02 libavcodec
Picture.ref_count/ref_poc have to be stored per field (actually also per
slice but thats a seperate bug)
Fixes at least:
CABREF3_Sand_D.264
camp_mot_fld0_full.26l
CVFI2_Sony_H.jsv
CVNLFI2_Sony_H.jsv
author | michael |
---|---|
date | Sat, 02 Aug 2008 23:13:27 +0000 |
parents | ad0c77d2b6ee |
children | c4a4495715dd |
rev | line source |
---|---|
5043 | 1 /* |
2 * MJPEG decoder | |
3 * Copyright (c) 2000, 2001 Fabrice Bellard. | |
4 * Copyright (c) 2003 Alex Beregszaszi | |
5 * Copyright (c) 2003-2004 Michael Niedermayer | |
6 * | |
7 * This file is part of FFmpeg. | |
8 * | |
9 * FFmpeg is free software; you can redistribute it and/or | |
10 * modify it under the terms of the GNU Lesser General Public | |
11 * License as published by the Free Software Foundation; either | |
12 * version 2.1 of the License, or (at your option) any later version. | |
13 * | |
14 * FFmpeg is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * Lesser General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU Lesser General Public | |
20 * License along with FFmpeg; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22 */ | |
23 | |
24 /** | |
25 * @file mjpegdec.h | |
26 * MJPEG decoder. | |
27 */ | |
28 | |
5830
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5045
diff
changeset
|
29 #ifndef FFMPEG_MJPEGDEC_H |
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5045
diff
changeset
|
30 #define FFMPEG_MJPEGDEC_H |
5043 | 31 |
32 #include "avcodec.h" | |
5045
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
33 #include "bitstream.h" |
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; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
70 int component_id[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
71 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
|
72 int v_count[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
73 int comp_index[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
74 int dc_index[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
75 int ac_index[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
76 int nb_blocks[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
77 int h_scount[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
78 int v_scount[MAX_COMPONENTS]; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
79 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
|
80 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
|
81 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
|
82 AVFrame picture; /* picture structure */ |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
83 int linesize[MAX_COMPONENTS]; ///< linesize << interlaced |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
84 int8_t *qscale_table; |
6571
ad0c77d2b6ee
Increase alignment for DCT block arrays from 8 to 16
superdump
parents:
6448
diff
changeset
|
85 DECLARE_ALIGNED_16(DCTELEM, block[64]); |
5045
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
86 ScanTable scantable; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
87 DSPContext dsp; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
88 |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
89 int restart_interval; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
90 int restart_count; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
91 |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
92 int buggy_avid; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
93 int cs_itu601; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
94 int interlace_polarity; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
95 |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
96 int mjpb_skiptosod; |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
97 |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
98 int cur_scan; /* current scan, used by JPEG-LS */ |
f0e079daad30
move MJpegDecodeContext declaration from mjpeg.h to mjpegdec.h
aurel
parents:
5044
diff
changeset
|
99 } MJpegDecodeContext; |
5043 | 100 |
101 int ff_mjpeg_decode_init(AVCodecContext *avctx); | |
102 int ff_mjpeg_decode_end(AVCodecContext *avctx); | |
103 int ff_mjpeg_decode_frame(AVCodecContext *avctx, | |
104 void *data, int *data_size, | |
6222 | 105 const uint8_t *buf, int buf_size); |
5044 | 106 int ff_mjpeg_decode_dqt(MJpegDecodeContext *s); |
107 int ff_mjpeg_decode_dht(MJpegDecodeContext *s); | |
108 int ff_mjpeg_decode_sof(MJpegDecodeContext *s); | |
109 int ff_mjpeg_decode_sos(MJpegDecodeContext *s); | |
5043 | 110 |
5830
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5045
diff
changeset
|
111 #endif /* FFMPEG_MJPEGDEC_H */ |