39 int default_huffman_tables = 0;
63 for (i = 0; i <
size; i++) {
67 if (buf[i + 1] ==
DQT) {
69 if (buf[i + 4] & 0xF0)
71 "Only 8-bit precision is supported.\n");
74 tables =
AV_RB16(&buf[i + 2]) / 65;
75 if (i + 5 + tables * 65 > size) {
79 if (nb_qtables + tables > 4) {
84 for (j = 0; j <
tables; j++)
85 qtables[nb_qtables + j] = buf + i + 5 + j * 65;
87 }
else if (buf[i + 1] ==
SOF0) {
88 if (buf[i + 14] != 17 || buf[i + 17] != 17) {
90 "Only 1x1 chroma blocks are supported. Aborted!\n");
93 }
else if (buf[i + 1] ==
DHT) {
94 int dht_size =
AV_RB16(&buf[i + 2]);
95 default_huffman_tables |= 1 << 4;
98 if (i + dht_size >= size)
101 switch (buf[i + 1]) {
106 default_huffman_tables |= 1;
118 default_huffman_tables |= 1 << 1;
130 default_huffman_tables |= 1 << 2;
142 default_huffman_tables |= 1 << 3;
155 }
else if (buf[i + 1] ==
SOS) {
160 "Insufficient data. Aborted!\n");
166 if (default_huffman_tables && default_huffman_tables != 31) {
168 "RFC 2435 requires standard Huffman tables for jpeg\n");
171 if (nb_qtables && nb_qtables != 2)
173 "RFC 2435 suggests two quantization tables, %d provided\n",
180 for (i = size - 2; i >= 0; i--) {
181 if (buf[i] == 0xff && buf[i + 1] ==
EOI) {
192 if (off == 0 && nb_qtables)
193 hdr_size += 4 + 64 * nb_qtables;
199 bytestream_put_byte(&p, 0);
200 bytestream_put_be24(&p, off);
201 bytestream_put_byte(&p, type);
202 bytestream_put_byte(&p, 255);
203 bytestream_put_byte(&p, w);
204 bytestream_put_byte(&p, h);
206 if (off == 0 && nb_qtables) {
208 bytestream_put_byte(&p, 0);
209 bytestream_put_byte(&p, 0);
210 bytestream_put_be16(&p, 64 * nb_qtables);
212 for (i = 0; i < nb_qtables; i++)
#define AV_LOG_WARNING
Something somehow does not look correct.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
MJPEG encoder and decoder.
AVStream ** streams
A list of all streams in the file.
const uint8_t avpriv_mjpeg_bits_dc_luminance[17]
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const uint8_t avpriv_mjpeg_bits_dc_chrominance[17]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
enum AVColorRange color_range
Video only.
the normal 2^n-1 "JPEG" YUV ranges
const uint8_t avpriv_mjpeg_val_dc[12]
const uint8_t avpriv_mjpeg_bits_ac_chrominance[17]
const uint8_t avpriv_mjpeg_val_ac_chrominance[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
const uint8_t avpriv_mjpeg_bits_ac_luminance[17]
const uint8_t avpriv_mjpeg_val_ac_luminance[]
void * priv_data
Format private data.
static ConstTables tables[2][NB_SUBBANDS]
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define AV_CEIL_RSHIFT(a, b)