Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "decode.h"
Private typedef
cinfo
jerr
jpeg_decode(FIL *, uint32_t, uint8_t *, uint8_t (*)(uint8_t *, uint32_t))
Files
loading...
SourceVuSTM32 Libraries and SamplesLibJPEG_EncodingSrc/decode.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file LibJPEG/LibJPEG_Encoding/Src/decode.c * @author MCD Application Team * @brief This file contain the decompress method. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "decode.h" Includes /* Private typedef -----------------------------------------------------------*/ /* This struct contains the JPEG decompression parameters */ struct jpeg_decompress_struct cinfo; /* This struct represents a JPEG error handler */ struct jpeg_error_mgr jerr; Private typedef /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Jpeg Decode * @param callback: line decoding callback * @param file1: pointer to the jpg file * @param width: image width * @param buff: pointer to the image line * @retval None *//* ... */ void jpeg_decode(JFILE *file, uint32_t width, uint8_t * buff, uint8_t (*callback)(uint8_t*, uint32_t)) { /* Decode JPEG Image */ JSAMPROW buffer[2] = {0}; /* Output row buffer */ uint32_t row_stride = 0; /* physical row width in image buffer */ buffer[0] = buff; /* Step 1: allocate and initialize JPEG decompression object */ cinfo.err = jpeg_std_error(&jerr); /* Initialize the JPEG decompression object */ jpeg_create_decompress(&cinfo); jpeg_stdio_src (&cinfo, file); /* Step 3: read image parameters with jpeg_read_header() */ jpeg_read_header(&cinfo, TRUE); /* Step 4: set parameters for decompression */ cinfo.dct_method = JDCT_FLOAT; /* Step 5: start decompressor */ jpeg_start_decompress(&cinfo); row_stride = width * 3; while (cinfo.output_scanline < cinfo.output_height) { (void) jpeg_read_scanlines(&cinfo, buffer, 1); if (callback(buffer[0], row_stride) != 0) { break; }if (callback(buffer[0], row_stride) != 0) { ... } }while (cinfo.output_scanline < cinfo.output_height) { ... } /* Step 6: Finish decompression */ jpeg_finish_decompress(&cinfo); /* Step 7: Release JPEG decompression object */ jpeg_destroy_decompress(&cinfo); }{ ... }
Details