41 int * n_datum,
int is_big)
46 *lbuf =
read32(ptr, is_big);
50 *lbuf = (*lbuf << 10) | (*lbuf >> 22);
61 int buf_size = avpkt->
size;
66 int magic_num, endian;
68 int w, h, bits_per_color, descriptor, elements, packing, total_size;
70 unsigned int rgbBuffer = 0;
73 if (avpkt->
size <= 1634) {
83 if (magic_num ==
AV_RL32(
"SDPX")) {
85 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
92 offset =
read32(&buf, endian);
93 if (avpkt->
size <= offset) {
98 buf = avpkt->
data + 0x304;
114 bits_per_color = buf[0];
116 packing = *((uint16_t*)buf);
128 switch (descriptor) {
140 switch (bits_per_color) {
147 total_size = avctx->
width * avctx->
height * elements;
155 total_size = (avctx->
width * elements + 2) / 3 * 4 * avctx->
height;
167 total_size = 2 * avctx->
width * avctx->
height * elements;
175 total_size = 2 * avctx->
width * avctx->
height * elements;
191 if (total_size + (int64_t)offset > avpkt->
size) {
195 switch (bits_per_color) {
197 for (x = 0; x < avctx->
height; x++) {
198 uint16_t *dst[3] = {(uint16_t*)ptr[0],
201 for (y = 0; y < avctx->
width; y++) {
214 for (i = 0; i < 3; i++)
219 for (x = 0; x < avctx->
height; x++) {
220 uint16_t *dst[3] = {(uint16_t*)ptr[0],
223 for (y = 0; y < avctx->
width; y++) {
224 *dst[2] = *((uint16_t*)buf);
225 *dst[2] = (*dst[2] >> 4) | (*dst[2] << 12);
228 *dst[0] = *((uint16_t*)buf);
229 *dst[0] = (*dst[0] >> 4) | (*dst[0] << 12);
232 *dst[1] = *((uint16_t*)buf);
233 *dst[1] = (*dst[1] >> 4) | (*dst[1] << 12);
240 for (i = 0; i < 3; i++)
247 for (x = 0; x < avctx->
height; x++) {
248 memcpy(ptr[0], buf, elements*avctx->
width);
250 buf += elements*avctx->
width;