57 for (i = 0; i <
size; i++) {
61 if (buf[i + 1] ==
DQT) {
64 "Only 8-bit precision is supported.\n");
67 nb_qtables =
AV_RB16(&buf[i + 2]) / 65;
68 if (i + 4 + nb_qtables * 65 > size) {
73 qtables = &buf[i + 4];
74 }
else if (buf[i + 1] ==
SOF0) {
75 if (buf[i + 14] != 17 || buf[i + 17] != 17) {
77 "Only 1x1 chroma blocks are supported. Aborted!\n");
80 }
else if (buf[i + 1] ==
SOS) {
91 for (i = size - 2; i >= 0; i--) {
92 if (buf[i] == 0xff && buf[i + 1] ==
EOI) {
103 if (off == 0 && nb_qtables)
104 hdr_size += 4 + 64 * nb_qtables;
110 bytestream_put_byte(&p, 0);
111 bytestream_put_be24(&p, off);
112 bytestream_put_byte(&p, type);
113 bytestream_put_byte(&p, 255);
114 bytestream_put_byte(&p, w);
115 bytestream_put_byte(&p, h);
117 if (off == 0 && nb_qtables) {
119 bytestream_put_byte(&p, 0);
120 bytestream_put_byte(&p, 0);
121 bytestream_put_be16(&p, 64 * nb_qtables);
123 for (i = 0; i < nb_qtables; i++)