Lines Matching refs:stream

174 static void print_SOF(const unsigned char *stream)
187 precision = stream[2];
188 height = be16_to_cpu(stream+3);
189 width = be16_to_cpu(stream+5);
190 nr_components = stream[7];
199 static int parse_DQT(struct jdec_private *priv, const unsigned char *stream)
205 dqt_block_end = stream + be16_to_cpu(stream);
206 stream += 2; /* Skip length */
208 while (stream < dqt_block_end)
210 qi = *stream++;
217 memcpy(priv->Q_tables[qi&0x0F], stream, 64);
219 stream += 64;
225 static int parse_SOF(struct jdec_private *priv, const unsigned char *stream)
232 print_SOF(stream);
234 height = be16_to_cpu(stream+3);
235 width = be16_to_cpu(stream+5);
236 nr_components = stream[7];
239 if (stream[2] != 8)
250 stream += 8;
252 cid = *stream++;
253 sampling_factor = *stream++;
254 Q_table = *stream++;
274 static int parse_SOS(struct jdec_private *priv, const unsigned char *stream)
277 unsigned int nr_components = stream[2];
283 stream += 3;
285 cid = *stream++;
286 table = *stream++;
301 priv->stream = stream+3;
306 int tinyjpeg_parse_SOS(struct jdec_private *priv, const unsigned char *stream)
308 return parse_SOS(priv, stream);
312 static int parse_DHT(struct jdec_private *priv, const unsigned char *stream)
318 length = be16_to_cpu(stream) - 2;
319 stream += 2; /* Skip length */
324 index = *stream++;
329 memcpy(priv->HTAC[index & 0xf].bits, stream, 16);
332 memcpy(priv->HTDC[index & 0xf].bits, stream, 16);
337 count += *stream++;
349 memcpy(priv->HTAC[index & 0xf].values, stream, count);
353 memcpy(priv->HTDC[index & 0xf].values, stream, count);
360 stream += count;
365 static int parse_DRI(struct jdec_private *priv, const unsigned char *stream)
371 length = be16_to_cpu(stream);
378 priv->restart_interval = be16_to_cpu(stream+2);
389 static int findEOI(struct jdec_private *priv,const unsigned char *stream)
391 while (!(*stream == 0xff && *(stream+1) == 0xd9 )&& stream<=priv->stream_end) //searching for the end of image marker
393 stream++;
396 priv->stream_scan=stream;
400 static int findSOI(struct jdec_private *priv,const unsigned char *stream)
402 while (!(*stream == 0xff && *(stream+1) == 0xd8 ) ) //searching for the start of image marker
404 if(stream<=priv->stream_end)
406 stream++;
412 priv->stream=stream+2;
416 static int parse_JFIF(struct jdec_private *priv, const unsigned char *stream)
425 next_image_found = findSOI(priv,stream);
426 stream=priv->stream;
428 while (!sos_marker_found && stream<=priv->stream_end)
430 while((*stream == 0xff))
431 stream++;
433 marker = *stream++;
434 chuck_len = be16_to_cpu(stream);
435 next_chunck = stream + chuck_len;
439 if (parse_SOF(priv, stream) < 0)
443 if (parse_DQT(priv, stream) < 0)
448 if (parse_SOS(priv, stream) < 0)
453 if (parse_DHT(priv, stream) < 0)
458 if (parse_DRI(priv, stream) < 0)
466 stream = next_chunck;
491 findEOI(priv,stream);
532 * Initialize the tinyjpeg object and prepare the decoding of the stream.
549 priv->stream = priv->stream_begin;
550 ret = parse_JFIF(priv, priv->stream);
776 slice_param.slice_data_size = (priv->stream_scan - priv->stream);
800 priv->stream_scan - priv->stream,
802 (void*)priv->stream, // jpeg_clip,
848 parse_JFIF(priv,priv->stream);