62 for (i = 0; i <
size; i++) {
66 if (buf[i + 1] ==
DQT) {
68 if (buf[i + 4] & 0xF0)
70 "Only 8-bit precision is supported.\n");
73 tables =
AV_RB16(&buf[i + 2]) / 65;
74 if (i + 5 + tables * 65 > size) {
78 if (nb_qtables + tables > 4) {
83 for (j = 0; j <
tables; j++)
84 qtables[nb_qtables + j] = buf + i + 5 + j * 65;
86 }
else if (buf[i + 1] ==
SOF0) {
87 if (buf[i + 14] != 17 || buf[i + 17] != 17) {
89 "Only 1x1 chroma blocks are supported. Aborted!\n");
92 }
else if (buf[i + 1] ==
DHT) {
96 || buf[i + 33] != 0x01
97 || buf[i + 62] != 0x10
98 || buf[i + 241] != 0x11
108 "RFC 2435 requires standard Huffman tables for jpeg\n");
111 }
else if (buf[i + 1] ==
SOS) {
116 "Insufficient data. Aborted!\n");
122 if (nb_qtables && nb_qtables != 2)
124 "RFC 2435 suggests two quantization tables, %d provided\n",
131 for (i = size - 2; i >= 0; i--) {
132 if (buf[i] == 0xff && buf[i + 1] ==
EOI) {
143 if (off == 0 && nb_qtables)
144 hdr_size += 4 + 64 * nb_qtables;
150 bytestream_put_byte(&p, 0);
151 bytestream_put_be24(&p, off);
152 bytestream_put_byte(&p, type);
153 bytestream_put_byte(&p, 255);
154 bytestream_put_byte(&p, w);
155 bytestream_put_byte(&p, h);
157 if (off == 0 && nb_qtables) {
159 bytestream_put_byte(&p, 0);
160 bytestream_put_byte(&p, 0);
161 bytestream_put_be16(&p, 64 * nb_qtables);
163 for (i = 0; i < nb_qtables; i++)
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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]
static const uint8_t *const tables[]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
AVCodecContext * codec
Codec context associated with this stream.
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)
int width
picture width / height.
#define FF_CEIL_RSHIFT(a, b)
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.