90 const unsigned char *end,
int q)
95 uint8_t precision =
GET_BYTE(pckt_data);
98 MSG(VERBOSE + dec->jpeg.not_first_run,
99 "JPEG quant hdr mbz=%" PRIu8
" prec=%" PRIu8
" len=%" PRIu16
"\n",
100 mbz, precision, length);
102 if (dec->jpeg.quantization_table_set[q] ||
104 *pckt_data += length;
109 assert(precision == 0);
111 const ptrdiff_t remaining_bytes = end - *pckt_data;
112 if (length > remaining_bytes) {
114 "Bogus JPEG packet (q table len %" PRIu16
115 " > %td remaining bytes! "
116 "Dropping packet...\n",
117 length, remaining_bytes);
118 *pckt_data += remaining_bytes;;
123 dec->jpeg.quantization_tables[q];
125 memcpy(quant_table[0], *pckt_data,
sizeof quant_table[0]);
126 *pckt_data +=
sizeof quant_table[0];
128 memcpy(quant_table[1], *pckt_data,
sizeof quant_table[1]);
129 *pckt_data +=
sizeof quant_table[1];
135 "Single quantization table includedd (len=64)!\n");
136 memcpy(quant_table[1], quant_table[0],
sizeof quant_table[1]);
138 dec->jpeg.quantization_table_set[q] =
true;
211 16, 11, 10, 16, 24, 40, 51, 61,
212 12, 12, 14, 19, 26, 58, 60, 55,
213 14, 13, 16, 24, 40, 57, 69, 56,
214 14, 17, 22, 29, 51, 87, 80, 62,
215 18, 22, 37, 56, 68, 109, 103, 77,
216 24, 35, 55, 64, 81, 104, 113, 92,
217 49, 64, 78, 87, 103, 121, 120, 101,
218 72, 92, 95, 98, 112, 100, 103, 99
225 17, 18, 24, 47, 99, 99, 99, 99,
226 18, 21, 26, 66, 99, 99, 99, 99,
227 24, 26, 56, 99, 99, 99, 99, 99,
228 47, 66, 99, 99, 99, 99, 99, 99,
229 99, 99, 99, 99, 99, 99, 99, 99,
230 99, 99, 99, 99, 99, 99, 99, 99,
231 99, 99, 99, 99, 99, 99, 99, 99,
232 99, 99, 99, 99, 99, 99, 99, 99
275 unsigned received_bytes = 0;
276 unsigned frame_max_len = 0;
278 while (cdata != NULL) {
280 unsigned char *pckt_data = (
unsigned char *) pckt->data;
283 memcpy(&hdr, pckt_data,
sizeof hdr);
284 const unsigned off = ntohl(hdr) & 0xFFFFFFU;
285 memcpy(&q, pckt_data + 5,
sizeof q);
290 if (hdr_end == NULL) {
300 const unsigned char *end =
301 (
unsigned char *) pckt->data + pckt->data_len;
305 const long payload_hdr_len =
306 pckt_data - (
unsigned char *) pckt->data;
307 const long data_len = pckt->data_len - payload_hdr_len;
308 const unsigned frame_off = off + dec_data->
offset_len;
311 received_bytes += data_len;
312 frame_max_len =
MAX(frame_max_len, off + data_len);
326 "Dropping frame - missing quantization tables for Q=%d!\n",
339 if (received_bytes != frame_max_len) {
340 MSG(
DEBUG,
"Frame incomplete - expected %u bytes, got %u B!\n",
341 frame_max_len, received_bytes);