50 return value + (value >> 10);
60 int buf_size = avpkt->
size;
67 int magic_num, endian;
69 int w, h,
stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size;
71 unsigned int rgbBuffer;
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;
109 bits_per_color = buf[0];
115 switch (descriptor) {
127 switch (bits_per_color) {
134 source_packet_size = elements;
135 target_packet_size = elements;
139 target_packet_size = 6;
140 source_packet_size = 4;
149 target_packet_size = 6;
150 source_packet_size = elements * 2;
169 buf = avpkt->
data + offset;
174 if (source_packet_size*avctx->
width*avctx->
height > buf_end - buf) {
178 switch (bits_per_color) {
180 for (x = 0; x < avctx->
height; x++) {
181 uint16_t *dst = (uint16_t*)ptr;
182 for (y = 0; y < avctx->
width; y++) {
183 rgbBuffer =
read32(&buf, endian);
195 if (source_packet_size == target_packet_size) {
196 for (x = 0; x < avctx->
height; x++) {
197 memcpy(ptr, buf, target_packet_size*avctx->
width);
199 buf += source_packet_size*avctx->
width;
202 for (x = 0; x < avctx->
height; x++) {
204 for (y = 0; y < avctx->
width; y++) {
205 memcpy(dst, buf, target_packet_size);
206 dst += target_packet_size;
207 buf += source_packet_size;