annotate sp5xdec.c @ 5062:2dd00b1cc94b libavcodec

Remove mdct.o and fft.o from fft-test prerequisites list. Both objects were added to the link command, resulting in multiple definitions of symbols. Now linking works in the general case when mdct.o and fft.o are compiled into libavcodec.a.
author diego
date Tue, 22 May 2007 07:08:38 +0000
parents 259b58518ecc
children bff60ecc02f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
1 /*
5042
259b58518ecc move sp5x decoder in its own file
aurel
parents: 5041
diff changeset
2 * Sunplus JPEG decoder (SP5X)
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
3 * Copyright (c) 2003 Alex Beregszaszi
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
4 *
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
5 * This file is part of FFmpeg.
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
6 *
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
11 *
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
15 * Lesser General Public License for more details.
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
16 *
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
20 */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
21
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
22 /**
5042
259b58518ecc move sp5x decoder in its own file
aurel
parents: 5041
diff changeset
23 * @file sp5xdec.c
259b58518ecc move sp5x decoder in its own file
aurel
parents: 5041
diff changeset
24 * Sunplus JPEG decoder (SP5X).
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
25 */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
26
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
27 #include "avcodec.h"
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
28 #include "mjpeg.h"
5041
01a165280429 allows to disable jpegls decoder
aurel
parents: 5039
diff changeset
29 #include "mjpegdec.h"
5042
259b58518ecc move sp5x decoder in its own file
aurel
parents: 5041
diff changeset
30 #include "sp5x.h"
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
31
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
32
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
33 static int sp5x_decode_frame(AVCodecContext *avctx,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
34 void *data, int *data_size,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
35 uint8_t *buf, int buf_size)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
36 {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
37 #if 0
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
38 MJpegDecodeContext *s = avctx->priv_data;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
39 #endif
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
40 const int qscale = 5;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
41 uint8_t *buf_ptr, *buf_end, *recoded;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
42 int i = 0, j = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
43
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
44 if (!avctx->width || !avctx->height)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
45 return -1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
46
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
47 buf_ptr = buf;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
48 buf_end = buf + buf_size;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
49
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
50 #if 1
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
51 recoded = av_mallocz(buf_size + 1024);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
52 if (!recoded)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
53 return -1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
54
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
55 /* SOI */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
56 recoded[j++] = 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
57 recoded[j++] = 0xD8;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
58
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
59 memcpy(recoded+j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt));
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
60 memcpy(recoded+j+5, &sp5x_quant_table[qscale * 2], 64);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
61 memcpy(recoded+j+70, &sp5x_quant_table[(qscale * 2) + 1], 64);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
62 j += sizeof(sp5x_data_dqt);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
63
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
64 memcpy(recoded+j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
65 j += sizeof(sp5x_data_dht);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
66
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
67 memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
68 recoded[j+5] = (avctx->coded_height >> 8) & 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
69 recoded[j+6] = avctx->coded_height & 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
70 recoded[j+7] = (avctx->coded_width >> 8) & 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
71 recoded[j+8] = avctx->coded_width & 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
72 j += sizeof(sp5x_data_sof);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
73
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
74 memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
75 j += sizeof(sp5x_data_sos);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
76
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
77 for (i = 14; i < buf_size && j < buf_size+1024-2; i++)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
78 {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
79 recoded[j++] = buf[i];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
80 if (buf[i] == 0xff)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
81 recoded[j++] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
82 }
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
83
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
84 /* EOI */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
85 recoded[j++] = 0xFF;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
86 recoded[j++] = 0xD9;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
87
5041
01a165280429 allows to disable jpegls decoder
aurel
parents: 5039
diff changeset
88 i = ff_mjpeg_decode_frame(avctx, data, data_size, recoded, j);
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
89
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
90 av_free(recoded);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
91
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
92 #else
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
93 /* SOF */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
94 s->bits = 8;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
95 s->width = avctx->coded_width;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
96 s->height = avctx->coded_height;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
97 s->nb_components = 3;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
98 s->component_id[0] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
99 s->h_count[0] = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
100 s->v_count[0] = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
101 s->quant_index[0] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
102 s->component_id[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
103 s->h_count[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
104 s->v_count[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
105 s->quant_index[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
106 s->component_id[2] = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
107 s->h_count[2] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
108 s->v_count[2] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
109 s->quant_index[2] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
110 s->h_max = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
111 s->v_max = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
112
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
113 s->qscale_table = av_mallocz((s->width+15)/16);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
114 avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
115 s->interlaced = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
116
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
117 s->picture.reference = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
118 if (avctx->get_buffer(avctx, &s->picture) < 0)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
119 {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
120 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
121 return -1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
122 }
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
123
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
124 s->picture.pict_type = I_TYPE;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
125 s->picture.key_frame = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
126
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
127 for (i = 0; i < 3; i++)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
128 s->linesize[i] = s->picture.linesize[i] << s->interlaced;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
129
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
130 /* DQT */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
131 for (i = 0; i < 64; i++)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
132 {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
133 j = s->scantable.permutated[i];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
134 s->quant_matrixes[0][j] = sp5x_quant_table[(qscale * 2) + i];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
135 }
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
136 s->qscale[0] = FFMAX(
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
137 s->quant_matrixes[0][s->scantable.permutated[1]],
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
138 s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
139
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
140 for (i = 0; i < 64; i++)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
141 {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
142 j = s->scantable.permutated[i];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
143 s->quant_matrixes[1][j] = sp5x_quant_table[(qscale * 2) + 1 + i];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
144 }
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
145 s->qscale[1] = FFMAX(
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
146 s->quant_matrixes[1][s->scantable.permutated[1]],
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
147 s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
148
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
149 /* DHT */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
150
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
151 /* SOS */
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
152 s->comp_index[0] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
153 s->nb_blocks[0] = s->h_count[0] * s->v_count[0];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
154 s->h_scount[0] = s->h_count[0];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
155 s->v_scount[0] = s->v_count[0];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
156 s->dc_index[0] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
157 s->ac_index[0] = 0;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
158
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
159 s->comp_index[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
160 s->nb_blocks[1] = s->h_count[1] * s->v_count[1];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
161 s->h_scount[1] = s->h_count[1];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
162 s->v_scount[1] = s->v_count[1];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
163 s->dc_index[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
164 s->ac_index[1] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
165
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
166 s->comp_index[2] = 2;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
167 s->nb_blocks[2] = s->h_count[2] * s->v_count[2];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
168 s->h_scount[2] = s->h_count[2];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
169 s->v_scount[2] = s->v_count[2];
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
170 s->dc_index[2] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
171 s->ac_index[2] = 1;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
172
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
173 for (i = 0; i < 3; i++)
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
174 s->last_dc[i] = 1024;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
175
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
176 s->mb_width = (s->width * s->h_max * 8 -1) / (s->h_max * 8);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
177 s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
178
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
179 init_get_bits(&s->gb, buf+14, (buf_size-14)*8);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
180
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
181 return mjpeg_decode_scan(s);
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
182 #endif
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
183
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
184 return i;
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
185 }
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
186
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
187 AVCodec sp5x_decoder = {
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
188 "sp5x",
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
189 CODEC_TYPE_VIDEO,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
190 CODEC_ID_SP5X,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
191 sizeof(MJpegDecodeContext),
5041
01a165280429 allows to disable jpegls decoder
aurel
parents: 5039
diff changeset
192 ff_mjpeg_decode_init,
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
193 NULL,
5041
01a165280429 allows to disable jpegls decoder
aurel
parents: 5039
diff changeset
194 ff_mjpeg_decode_end,
5020
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
195 sp5x_decode_frame,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
196 CODEC_CAP_DR1,
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
197 NULL
eb0ad6423405 split mjpeg.c into an encoder and a decoder file
aurel
parents:
diff changeset
198 };