61 for (i = 0; i <
size; i++) {
65 if (buf[i + 1] ==
DQT) {
68 "Only 8-bit precision is supported.\n");
71 nb_qtables =
AV_RB16(&buf[i + 2]) / 65;
72 if (i + 4 + nb_qtables * 65 > size) {
77 qtables = &buf[i + 4];
78 }
else if (buf[i + 1] ==
SOF0) {
79 if (buf[i + 14] != 17 || buf[i + 17] != 17) {
81 "Only 1x1 chroma blocks are supported. Aborted!\n");
84 }
else if (buf[i + 1] ==
SOS) {
95 for (i = size - 2; i >= 0; i--) {
96 if (buf[i] == 0xff && buf[i + 1] ==
EOI) {
107 if (off == 0 && nb_qtables)
108 hdr_size += 4 + 64 * nb_qtables;
114 bytestream_put_byte(&p, 0);
115 bytestream_put_be24(&p, off);
116 bytestream_put_byte(&p, type);
117 bytestream_put_byte(&p, 255);
118 bytestream_put_byte(&p, w);
119 bytestream_put_byte(&p, h);
121 if (off == 0 && nb_qtables) {
123 bytestream_put_byte(&p, 0);
124 bytestream_put_byte(&p, 0);
125 bytestream_put_be16(&p, 64 * nb_qtables);
127 for (i = 0; i < nb_qtables; i++)