46 int * n_datum,
int is_big)
51 *lbuf =
read32(ptr, is_big);
55 *lbuf = (*lbuf << 10) | (*lbuf >> 22);
66 int buf_size = avpkt->
size;
73 int magic_num, endian;
75 int w, h, bits_per_color, descriptor, elements, packing, total_size;
77 unsigned int rgbBuffer = 0;
80 if (avpkt->
size <= 1634) {
90 if (magic_num ==
AV_RL32(
"SDPX")) {
92 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
99 offset =
read32(&buf, endian);
100 if (avpkt->
size <= offset) {
105 buf = avpkt->
data + 0x304;
121 bits_per_color = buf[0];
123 packing = *((uint16_t*)buf);
135 switch (descriptor) {
147 switch (bits_per_color) {
154 total_size = avctx->
width * avctx->
height * elements;
162 total_size = (4 * avctx->
width * avctx->
height * elements) / 3;
174 total_size = 2 * avctx->
width * avctx->
height * elements;
182 total_size = 2 * avctx->
width * avctx->
height * elements;
202 if (total_size > avpkt->
size) {
206 switch (bits_per_color) {
208 for (x = 0; x < avctx->
height; x++) {
209 uint16_t *
dst[3] = {(uint16_t*)ptr[0],
212 for (y = 0; y < avctx->
width; y++) {
224 for (i = 0; i < 3; i++)
229 for (x = 0; x < avctx->
height; x++) {
230 uint16_t *dst[3] = {(uint16_t*)ptr[0],
233 for (y = 0; y < avctx->
width; y++) {
234 *dst[2] = *((uint16_t*)buf);
235 *dst[2] = (*dst[2] >> 4) | (*dst[2] << 12);
238 *dst[0] = *((uint16_t*)buf);
239 *dst[0] = (*dst[0] >> 4) | (*dst[0] << 12);
242 *dst[1] = *((uint16_t*)buf);
243 *dst[1] = (*dst[1] >> 4) | (*dst[1] << 12);
250 for (i = 0; i < 3; i++)
257 for (x = 0; x < avctx->
height; x++) {
258 memcpy(ptr[0], buf, elements*avctx->
width);
260 buf += elements*avctx->
width;