зеркало из https://github.com/mozilla/pjs.git
Bug 452698. Ensure that YUV to RGB conversion puts bytes in the right order for big-endian machines (PPC). r+sr=roc
--HG-- extra : rebase_source : 8939f59496da5548509ebd64a515947b071c204d
This commit is contained in:
Родитель
1705ca54df
Коммит
116e326570
|
@ -594,7 +594,11 @@ void nsOggDecodeStateMachine::HandleVideoData(FrameData* aFrame, int aTrackNum,
|
||||||
rgb.rgb_width = aFrame->mVideoWidth;
|
rgb.rgb_width = aFrame->mVideoWidth;
|
||||||
rgb.rgb_height = aFrame->mVideoHeight;
|
rgb.rgb_height = aFrame->mVideoHeight;
|
||||||
|
|
||||||
|
#ifdef IS_BIG_ENDIAN
|
||||||
|
oggplay_yuv2argb(&yuv, &rgb);
|
||||||
|
#else
|
||||||
oggplay_yuv2bgr(&yuv, &rgb);
|
oggplay_yuv2bgr(&yuv, &rgb);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsOggDecodeStateMachine::HandleAudioData(FrameData* aFrame, OggPlayAudioData* aAudioData, int aSize) {
|
void nsOggDecodeStateMachine::HandleAudioData(FrameData* aFrame, OggPlayAudioData* aAudioData, int aSize) {
|
||||||
|
|
|
@ -4,4 +4,6 @@ were those applied by update.sh and the addition/upate of Makefile.in
|
||||||
files for the Mozilla build system.
|
files for the Mozilla build system.
|
||||||
|
|
||||||
Some files are renamed during the copy to prevent clashes with object
|
Some files are renamed during the copy to prevent clashes with object
|
||||||
file names with other Mozilla libraries.
|
file names with other Mozilla libraries.
|
||||||
|
|
||||||
|
endian.patch is applied to fix Bug 45269.
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
diff --git a/media/libfishsound/include/fishsound/config.h b/media/libfishsound/include/fishsound/config.h
|
||||||
|
index 573822f..b7cae62 100644
|
||||||
|
--- a/media/libfishsound/include/fishsound/config.h
|
||||||
|
+++ b/media/libfishsound/include/fishsound/config.h
|
||||||
|
@@ -104,3 +104,8 @@
|
||||||
|
#undef HAVE_VORBISENC
|
||||||
|
#define HAVE_VORBISENC 0
|
||||||
|
#undef DEBUG
|
||||||
|
+
|
||||||
|
+#include "prcpucfg.h"
|
||||||
|
+#ifdef IS_BIG_ENDIAN
|
||||||
|
+#define WORDS_BIGENDIAN
|
||||||
|
+#endif
|
||||||
|
diff --git a/media/libfishsound/src/libfishsound/config.h b/media/libfishsound/src/libfishsound/config.h
|
||||||
|
index 573822f..b7cae62 100644
|
||||||
|
--- a/media/libfishsound/src/libfishsound/config.h
|
||||||
|
+++ b/media/libfishsound/src/libfishsound/config.h
|
||||||
|
@@ -104,3 +104,8 @@
|
||||||
|
#undef HAVE_VORBISENC
|
||||||
|
#define HAVE_VORBISENC 0
|
||||||
|
#undef DEBUG
|
||||||
|
+
|
||||||
|
+#include "prcpucfg.h"
|
||||||
|
+#ifdef IS_BIG_ENDIAN
|
||||||
|
+#define WORDS_BIGENDIAN
|
||||||
|
+#endif
|
|
@ -104,3 +104,8 @@
|
||||||
#undef HAVE_VORBISENC
|
#undef HAVE_VORBISENC
|
||||||
#define HAVE_VORBISENC 0
|
#define HAVE_VORBISENC 0
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
|
||||||
|
#include "prcpucfg.h"
|
||||||
|
#ifdef IS_BIG_ENDIAN
|
||||||
|
#define WORDS_BIGENDIAN
|
||||||
|
#endif
|
||||||
|
|
|
@ -104,3 +104,8 @@
|
||||||
#undef HAVE_VORBISENC
|
#undef HAVE_VORBISENC
|
||||||
#define HAVE_VORBISENC 0
|
#define HAVE_VORBISENC 0
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
|
||||||
|
#include "prcpucfg.h"
|
||||||
|
#ifdef IS_BIG_ENDIAN
|
||||||
|
#define WORDS_BIGENDIAN
|
||||||
|
#endif
|
||||||
|
|
|
@ -37,4 +37,5 @@ cp $1/src/libfishsound/encode.c ./src/libfishsound/fishsound_encode.c
|
||||||
cp $1/src/libfishsound/fs_vector.h ./src/libfishsound/fs_vector.h
|
cp $1/src/libfishsound/fs_vector.h ./src/libfishsound/fs_vector.h
|
||||||
cp $1/src/libfishsound/fs_vector.c ./src/libfishsound/fs_vector.c
|
cp $1/src/libfishsound/fs_vector.c ./src/libfishsound/fs_vector.c
|
||||||
cp $1/src/libfishsound/convert.h ./src/libfishsound/convert.h
|
cp $1/src/libfishsound/convert.h ./src/libfishsound/convert.h
|
||||||
cp $1/AUTHORS ./AUTHORS
|
cp $1/AUTHORS ./AUTHORS
|
||||||
|
patch -p4 <endian.patch
|
||||||
|
|
|
@ -13,5 +13,8 @@ The patch from Annodex trac ticket 421 is applied to fix bug 459938:
|
||||||
The patch from Bug 468327 (yuv_disable_optimized.patch) is applied
|
The patch from Bug 468327 (yuv_disable_optimized.patch) is applied
|
||||||
to disable optimized yuv to rgb routines.
|
to disable optimized yuv to rgb routines.
|
||||||
|
|
||||||
|
The patch from Bug 452698 (yuv2argb.patch) is applied to fix
|
||||||
|
yuv to rgb conversion on PPC Mac OS X.
|
||||||
|
|
||||||
The patch from Bug 464007 (bug464007.patch) is applied
|
The patch from Bug 464007 (bug464007.patch) is applied
|
||||||
to fix oggplay issues.
|
to fix oggplay issues.
|
||||||
|
|
|
@ -75,6 +75,9 @@ void
|
||||||
oggplay_yuv2rgb(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
oggplay_yuv2rgb(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
oggplay_yuv2argb(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
|
||||||
|
void
|
||||||
oggplay_yuv2bgr(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
oggplay_yuv2bgr(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
|
||||||
ogg_int64_t
|
ogg_int64_t
|
||||||
|
|
|
@ -86,3 +86,8 @@
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
/* #undef const */
|
/* #undef const */
|
||||||
#undef HAVE_GLUT
|
#undef HAVE_GLUT
|
||||||
|
|
||||||
|
#include "prcpucfg.h"
|
||||||
|
#ifdef IS_BIG_ENDIAN
|
||||||
|
#define WORDS_BIGENDIAN
|
||||||
|
#endif
|
||||||
|
|
|
@ -396,6 +396,57 @@ void oggplay_yuv2rgb(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Vanilla implementation if YUV->ARGB conversion */
|
||||||
|
void oggplay_yuv2argb(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
|
|
||||||
|
unsigned char * ptry = yuv->ptry;
|
||||||
|
unsigned char * ptru = yuv->ptru;
|
||||||
|
unsigned char * ptrv = yuv->ptrv;
|
||||||
|
unsigned char * ptro = rgb->ptro;
|
||||||
|
unsigned char * ptro2;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < yuv->y_height; i++) {
|
||||||
|
ptro2 = ptro;
|
||||||
|
for (j = 0; j < yuv->y_width; j += 2) {
|
||||||
|
|
||||||
|
short pr, pg, pb, y;
|
||||||
|
short r, g, b;
|
||||||
|
|
||||||
|
pr = (-56992 + ptrv[j/2] * 409) >> 8;
|
||||||
|
pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
|
||||||
|
pb = (-70688 + ptru[j/2] * 516) >> 8;
|
||||||
|
|
||||||
|
y = 298*ptry[j] >> 8;
|
||||||
|
r = y + pr;
|
||||||
|
g = y + pg;
|
||||||
|
b = y + pb;
|
||||||
|
|
||||||
|
*ptro2++ = 255;
|
||||||
|
*ptro2++ = CLAMP(r);
|
||||||
|
*ptro2++ = CLAMP(g);
|
||||||
|
*ptro2++ = CLAMP(b);
|
||||||
|
|
||||||
|
y = 298*ptry[j + 1] >> 8;
|
||||||
|
r = y + pr;
|
||||||
|
g = y + pg;
|
||||||
|
b = y + pb;
|
||||||
|
|
||||||
|
*ptro2++ = 255;
|
||||||
|
*ptro2++ = CLAMP(r);
|
||||||
|
*ptro2++ = CLAMP(g);
|
||||||
|
*ptro2++ = CLAMP(b);
|
||||||
|
}
|
||||||
|
ptry += yuv->y_width;
|
||||||
|
if (i & 1) {
|
||||||
|
ptru += yuv->uv_width;
|
||||||
|
ptrv += yuv->uv_width;
|
||||||
|
}
|
||||||
|
ptro += rgb->rgb_width * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Vanilla implementation of YUV->BGR conversion*/
|
/* Vanilla implementation of YUV->BGR conversion*/
|
||||||
void oggplay_yuv2bgr(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
void oggplay_yuv2bgr(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
|
|
||||||
|
|
|
@ -38,4 +38,5 @@ cd ./src/liboggplay
|
||||||
patch <../../yuv2rgb-vanilla-fix.patch
|
patch <../../yuv2rgb-vanilla-fix.patch
|
||||||
patch <../../yuv_disable_optimized.patch
|
patch <../../yuv_disable_optimized.patch
|
||||||
cd ../..
|
cd ../..
|
||||||
|
patch -p4 <yuv2argb.patch
|
||||||
patch -p3 <bug464007.patch
|
patch -p3 <bug464007.patch
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
diff --git a/media/liboggplay/include/oggplay/oggplay_tools.h b/media/liboggplay/include/oggplay/oggplay_tools.h
|
||||||
|
index 30531a4..19fe709 100644
|
||||||
|
--- a/media/liboggplay/include/oggplay/oggplay_tools.h
|
||||||
|
+++ b/media/liboggplay/include/oggplay/oggplay_tools.h
|
||||||
|
@@ -75,6 +75,9 @@ void
|
||||||
|
oggplay_yuv2rgb(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
|
||||||
|
void
|
||||||
|
+oggplay_yuv2argb(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
oggplay_yuv2bgr(OggPlayYUVChannels* yuv, OggPlayRGBChannels * rgb);
|
||||||
|
|
||||||
|
ogg_int64_t
|
||||||
|
diff --git a/media/liboggplay/src/liboggplay/config.h b/media/liboggplay/src/liboggplay/config.h
|
||||||
|
index e1754e4..46faa8a 100644
|
||||||
|
--- a/media/liboggplay/src/liboggplay/config.h
|
||||||
|
+++ b/media/liboggplay/src/liboggplay/config.h
|
||||||
|
@@ -86,3 +86,8 @@
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
/* #undef const */
|
||||||
|
#undef HAVE_GLUT
|
||||||
|
+
|
||||||
|
+#include "prcpucfg.h"
|
||||||
|
+#ifdef IS_BIG_ENDIAN
|
||||||
|
+#define WORDS_BIGENDIAN
|
||||||
|
+#endif
|
||||||
|
diff --git a/media/liboggplay/src/liboggplay/oggplay_yuv2rgb.c b/media/liboggplay/src/liboggplay/oggplay_yuv2rgb.c
|
||||||
|
index 0e2cef0..e070dc7 100644
|
||||||
|
--- a/media/liboggplay/src/liboggplay/oggplay_yuv2rgb.c
|
||||||
|
+++ b/media/liboggplay/src/liboggplay/oggplay_yuv2rgb.c
|
||||||
|
@@ -396,6 +396,57 @@ void oggplay_yuv2rgb(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Vanilla implementation if YUV->ARGB conversion */
|
||||||
|
+void oggplay_yuv2argb(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
|
+
|
||||||
|
+ unsigned char * ptry = yuv->ptry;
|
||||||
|
+ unsigned char * ptru = yuv->ptru;
|
||||||
|
+ unsigned char * ptrv = yuv->ptrv;
|
||||||
|
+ unsigned char * ptro = rgb->ptro;
|
||||||
|
+ unsigned char * ptro2;
|
||||||
|
+ int i, j;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < yuv->y_height; i++) {
|
||||||
|
+ ptro2 = ptro;
|
||||||
|
+ for (j = 0; j < yuv->y_width; j += 2) {
|
||||||
|
+
|
||||||
|
+ short pr, pg, pb, y;
|
||||||
|
+ short r, g, b;
|
||||||
|
+
|
||||||
|
+ pr = (-56992 + ptrv[j/2] * 409) >> 8;
|
||||||
|
+ pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
|
||||||
|
+ pb = (-70688 + ptru[j/2] * 516) >> 8;
|
||||||
|
+
|
||||||
|
+ y = 298*ptry[j] >> 8;
|
||||||
|
+ r = y + pr;
|
||||||
|
+ g = y + pg;
|
||||||
|
+ b = y + pb;
|
||||||
|
+
|
||||||
|
+ *ptro2++ = 255;
|
||||||
|
+ *ptro2++ = CLAMP(r);
|
||||||
|
+ *ptro2++ = CLAMP(g);
|
||||||
|
+ *ptro2++ = CLAMP(b);
|
||||||
|
+
|
||||||
|
+ y = 298*ptry[j + 1] >> 8;
|
||||||
|
+ r = y + pr;
|
||||||
|
+ g = y + pg;
|
||||||
|
+ b = y + pb;
|
||||||
|
+
|
||||||
|
+ *ptro2++ = 255;
|
||||||
|
+ *ptro2++ = CLAMP(r);
|
||||||
|
+ *ptro2++ = CLAMP(g);
|
||||||
|
+ *ptro2++ = CLAMP(b);
|
||||||
|
+ }
|
||||||
|
+ ptry += yuv->y_width;
|
||||||
|
+ if (i & 1) {
|
||||||
|
+ ptru += yuv->uv_width;
|
||||||
|
+ ptrv += yuv->uv_width;
|
||||||
|
+ }
|
||||||
|
+ ptro += rgb->rgb_width * 4;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
/* Vanilla implementation of YUV->BGR conversion*/
|
||||||
|
void oggplay_yuv2bgr(OggPlayYUVChannels * yuv, OggPlayRGBChannels * rgb) {
|
||||||
|
|
|
@ -17,3 +17,5 @@ The oggz_off_t.patch fixes a compile error on Solaris see bug 449754
|
||||||
for details
|
for details
|
||||||
|
|
||||||
The wince.patch addresses the lack of posix file IO suppor on windows ce see bug 461844 for details.
|
The wince.patch addresses the lack of posix file IO suppor on windows ce see bug 461844 for details.
|
||||||
|
|
||||||
|
endian.patch is applied to fix bug 452698.
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/media/liboggz/include/oggz/config.h b/media/liboggz/include/oggz/config.h
|
||||||
|
index d645685..19d20f5 100644
|
||||||
|
--- a/media/liboggz/include/oggz/config.h
|
||||||
|
+++ b/media/liboggz/include/oggz/config.h
|
||||||
|
@@ -126,3 +126,8 @@
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
#undef DEBUG
|
||||||
|
+
|
||||||
|
+#include "prcpucfg.h"
|
||||||
|
+#ifdef IS_BIG_ENDIAN
|
||||||
|
+#define WORDS_BIGENDIAN
|
||||||
|
+#endif
|
|
@ -126,3 +126,8 @@
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
/* #undef size_t */
|
/* #undef size_t */
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
|
||||||
|
#include "prcpucfg.h"
|
||||||
|
#ifdef IS_BIG_ENDIAN
|
||||||
|
#define WORDS_BIGENDIAN
|
||||||
|
#endif
|
||||||
|
|
|
@ -45,3 +45,4 @@ patch -p4 <seek.patch
|
||||||
patch -p4 <warning.patch
|
patch -p4 <warning.patch
|
||||||
patch -p3 <oggz_off_t.patch
|
patch -p3 <oggz_off_t.patch
|
||||||
patch -p3 <wince.patch
|
patch -p3 <wince.patch
|
||||||
|
patch -p4 <endian.patch
|
||||||
|
|
Загрузка…
Ссылка в новой задаче