FastLED 3.9.15
Loading...
Searching...
No Matches

◆ create_qt_tbl()

static JRESULT fl::third_party::create_qt_tbl ( JDEC * jd,
const uint8_t * data,
size_t ndata )
static

Definition at line 167 of file tjpgd.cpp.hpp.

172{
173 unsigned int i, zi;
174 uint8_t d;
175 int32_t *pb;
176
177
178 while (ndata) { /* Process all tables in the segment */
179 if (ndata < 65) return JDR_FMT1; /* Err: table size is unaligned */
180 ndata -= 65;
181 d = *data++; /* Get table property */
182 if (d & 0xF0) return JDR_FMT1; /* Err: not 8-bit resolution */
183 i = d & 3; /* Get table ID */
184 pb = (int32_t*)alloc_pool(jd, 64 * sizeof (int32_t));/* Allocate a memory block for the table */
185 if (!pb) return JDR_MEM1; /* Err: not enough memory */
186 jd->qttbl[i] = pb; /* Register the table */
187 for (i = 0; i < 64; i++) { /* Load the table */
188 zi = Zig[i]; /* Zigzag-order to raster-order conversion */
189 pb[zi] = (int32_t)((uint32_t)*data++ * Ipsf[zi]); /* Apply scale factor of Arai algorithm to the de-quantizers */
190 }
191 }
192
193 return JDR_OK;
194}
fl::u32 uint32_t
Definition coder.h:219
static const uint8_t Zig[64]
Definition tjpgd.cpp.hpp:50
static void * alloc_pool(JDEC *jd, size_t ndata) FL_NOEXCEPT
fl::i32 int32_t
Definition coder.h:220
unsigned char uint8_t
Definition coder.h:209
static const uint16_t Ipsf[64]
Definition tjpgd.cpp.hpp:64
int32_t * qttbl[4]
Definition tjpgd.h:65

References alloc_pool(), FL_NOEXCEPT, Ipsf, JDR_FMT1, JDR_MEM1, JDR_OK, and Zig.

Referenced by jd_prepare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: