55 |
* |
* |
56 |
****************************************************************************/ |
****************************************************************************/ |
57 |
|
|
58 |
#include <string.h> // memcpy |
#include <string.h> /* memcpy */ |
59 |
|
|
60 |
#include "colorspace.h" |
#include "colorspace.h" |
61 |
#include "../divx4.h" // DEC_PICTURE |
#include "../divx4.h" /* DEC_PICTURE */ |
62 |
|
|
63 |
// function pointers |
/* function pointers */ |
64 |
|
|
65 |
/* input */ |
/* input */ |
66 |
color_inputFuncPtr rgb555_to_yv12; |
color_inputFuncPtr rgb555_to_yv12; |
142 |
|
|
143 |
|
|
144 |
for (y = height / 2; y; y--) { |
for (y = height / 2; y; y--) { |
145 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
146 |
for (x = 0; x < (uint32_t) width; x += 2) { |
for (x = 0; x < (uint32_t) width; x += 2) { |
147 |
int rgb, r, g, b, r4, g4, b4; |
int rgb, r, g, b, r4, g4, b4; |
148 |
|
|
227 |
|
|
228 |
|
|
229 |
for (y = height / 2; y; y--) { |
for (y = height / 2; y; y--) { |
230 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
231 |
for (x = 0; x < (uint32_t) width; x += 2) { |
for (x = 0; x < (uint32_t) width; x += 2) { |
232 |
int rgb, r, g, b, r4, g4, b4; |
int rgb, r, g, b, r4, g4, b4; |
233 |
|
|
499 |
|
|
500 |
for (x = width >> 1; x; x--) { |
for (x = width >> 1; x; x--) { |
501 |
*y_out++ = *src++; |
*y_out++ = *src++; |
502 |
//*u_out++ = *src++; |
/**u_out++ = *src++; */ |
503 |
*u_out++ = (*(src + width2) + *src) >> 1; |
*u_out++ = (*(src + width2) + *src) >> 1; |
504 |
src++; |
src++; |
505 |
*y_out++ = *src++; |
*y_out++ = *src++; |
506 |
//*v_out++ = *src++; |
/**v_out++ = *src++; */ |
507 |
*v_out++ = (*(src + width2) + *src) >> 1; |
*v_out++ = (*(src + width2) + *src) >> 1; |
508 |
src++; |
src++; |
509 |
|
|
551 |
|
|
552 |
for (x = width >> 1; x; x--) { |
for (x = width >> 1; x; x--) { |
553 |
*u_out++ = *src++; |
*u_out++ = *src++; |
554 |
// *u_out++ = (*(src+width2) + *src++) >> 1; |
/* *u_out++ = (*(src+width2) + *src++) >> 1; */ |
555 |
*y_out++ = *src++; |
*y_out++ = *src++; |
556 |
//*v_out++ = *src++; |
/**v_out++ = *src++; */ |
557 |
*v_out++ = (*(src + width2) + *src) >> 1; |
*v_out++ = (*(src + width2) + *src) >> 1; |
558 |
src++; |
src++; |
559 |
*y_out++ = *src++; |
*y_out++ = *src++; |
652 |
r = g = b = 0; |
r = g = b = 0; |
653 |
r2 = g2 = b2 = 0; |
r2 = g2 = b2 = 0; |
654 |
|
|
655 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
656 |
for (x = 0; x < (uint32_t) width / 2; x++) { |
for (x = 0; x < (uint32_t) width / 2; x++) { |
657 |
int u, v; |
int u, v; |
658 |
int b_u, g_uv, r_v, rgb_y; |
int b_u, g_uv, r_v, rgb_y; |
734 |
uint8_t *y_src2 = y_src + y_stride; |
uint8_t *y_src2 = y_src + y_stride; |
735 |
uint32_t x, y; |
uint32_t x, y; |
736 |
|
|
737 |
if (height < 0) { // flip image? |
if (height < 0) { /* flip image? */ |
738 |
height = -height; |
height = -height; |
739 |
y_src += (height - 1) * y_stride; |
y_src += (height - 1) * y_stride; |
740 |
y_src2 = y_src - y_stride; |
y_src2 = y_src - y_stride; |
751 |
r = g = b = 0; |
r = g = b = 0; |
752 |
r2 = g2 = b2 = 0; |
r2 = g2 = b2 = 0; |
753 |
|
|
754 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
755 |
for (x = 0; x < (uint32_t) width / 2; x++) { |
for (x = 0; x < (uint32_t) width / 2; x++) { |
756 |
int u, v; |
int u, v; |
757 |
int b_u, g_uv, r_v, rgb_y; |
int b_u, g_uv, r_v, rgb_y; |
828 |
uint8_t *y_src2 = y_src + y_stride; |
uint8_t *y_src2 = y_src + y_stride; |
829 |
uint32_t x, y; |
uint32_t x, y; |
830 |
|
|
831 |
if (height < 0) { // flip image? |
if (height < 0) { /* flip image? */ |
832 |
height = -height; |
height = -height; |
833 |
y_src += (height - 1) * y_stride; |
y_src += (height - 1) * y_stride; |
834 |
y_src2 = y_src - y_stride; |
y_src2 = y_src - y_stride; |
839 |
} |
} |
840 |
|
|
841 |
for (y = height / 2; y; y--) { |
for (y = height / 2; y; y--) { |
842 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
843 |
for (x = 0; x < (uint32_t) width / 2; x++) { |
for (x = 0; x < (uint32_t) width / 2; x++) { |
844 |
int u, v; |
int u, v; |
845 |
int b_u, g_uv, r_v, rgb_y; |
int b_u, g_uv, r_v, rgb_y; |
925 |
uint8_t *y_src2 = y_src + y_stride; |
uint8_t *y_src2 = y_src + y_stride; |
926 |
uint32_t x, y; |
uint32_t x, y; |
927 |
|
|
928 |
if (height < 0) { // flip image? |
if (height < 0) { /* flip image? */ |
929 |
height = -height; |
height = -height; |
930 |
y_src += (height - 1) * y_stride; |
y_src += (height - 1) * y_stride; |
931 |
y_src2 = y_src - y_stride; |
y_src2 = y_src - y_stride; |
936 |
} |
} |
937 |
|
|
938 |
for (y = height / 2; y; y--) { |
for (y = height / 2; y; y--) { |
939 |
// process one 2x2 block per iteration |
/* process one 2x2 block per iteration */ |
940 |
for (x = 0; x < (uint32_t) width / 2; x++) { |
for (x = 0; x < (uint32_t) width / 2; x++) { |
941 |
int u, v; |
int u, v; |
942 |
int b_u, g_uv, r_v, rgb_y; |
int b_u, g_uv, r_v, rgb_y; |