зеркало из https://github.com/mozilla/gecko-dev.git
Bug 493140. Use Theora x/y offset information if present. r=doublec
This commit is contained in:
Родитель
0719504584
Коммит
ba13940408
|
@ -17,3 +17,4 @@ endian: pick up NSPR's little/big endian defines in oggplay's config.h.
|
|||
trac466: Fix for infinite loop in liboggplay when running decoder on its own thread. Cherry picked from liboggplay git commit e6871f.
|
||||
|
||||
bug492436: Fix for that bug cherry picked from liboggplay git commit 4b97ad.
|
||||
bug493140: Fix for offsets not being used.
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
diff --git a/media/liboggplay/src/liboggplay/oggplay_callback.c b/media/liboggplay/src/liboggplay/oggplay_callback.c
|
||||
index 593691f..7683b80 100644
|
||||
--- a/media/liboggplay/src/liboggplay/oggplay_callback.c
|
||||
+++ b/media/liboggplay/src/liboggplay/oggplay_callback.c
|
||||
@@ -107,6 +107,11 @@ oggplay_callback_theora (OGGZ * oggz, ogg_packet * op, long serialno,
|
||||
decoder->uv_width = decoder->uv_stride = decoder->video_info.frame_width / 2;
|
||||
decoder->uv_height = decoder->video_info.frame_height / 2;
|
||||
if (--(decoder->remaining_header_packets) == 0) {
|
||||
+ /* Ensure the offsets do not push the viewable area outside of the decoded frame. */
|
||||
+ if (((decoder->video_info.height - decoder->video_info.offset_y)<decoder->video_info.frame_height)||
|
||||
+ ((decoder->video_info.width - decoder->video_info.offset_x)<decoder->video_info.frame_width))
|
||||
+ return -1;
|
||||
+
|
||||
theora_decode_init(&(decoder->video_handle), &(decoder->video_info));
|
||||
}
|
||||
return 0;
|
||||
diff --git a/media/liboggplay/src/liboggplay/oggplay_data.c b/media/liboggplay/src/liboggplay/oggplay_data.c
|
||||
index 57a9458..c519d59 100644
|
||||
--- a/media/liboggplay/src/liboggplay/oggplay_data.c
|
||||
+++ b/media/liboggplay/src/liboggplay/oggplay_data.c
|
||||
@@ -323,6 +323,7 @@ oggplay_data_handle_theora_frame (OggPlayTheoraDecode *decode,
|
||||
|
||||
int size = sizeof (OggPlayVideoRecord);
|
||||
int i;
|
||||
+ int uv_offset;
|
||||
unsigned char * p;
|
||||
unsigned char * q;
|
||||
unsigned char * p2;
|
||||
@@ -359,17 +360,20 @@ oggplay_data_handle_theora_frame (OggPlayTheoraDecode *decode,
|
||||
* a row-by-row copy (stride may be negative)
|
||||
*/
|
||||
p = data->y;
|
||||
- q = buffer->y;
|
||||
+ q = buffer->y + (decode->video_info.offset_x&~1)+buffer->y_stride*(decode->video_info.offset_y&~1);
|
||||
for (i = 0; i < decode->y_height; i++) {
|
||||
memcpy(p, q, decode->y_width);
|
||||
p += decode->y_width;
|
||||
q += buffer->y_stride;
|
||||
}
|
||||
|
||||
+ uv_offset = (decode->video_info.offset_x/(decode->y_width/decode->uv_width)) +
|
||||
+ (buffer->uv_stride) *(decode->video_info.offset_y/(decode->y_height/decode->uv_height));
|
||||
+
|
||||
p = data->u;
|
||||
- q = buffer->u;
|
||||
+ q = buffer->u + uv_offset;
|
||||
p2 = data->v;
|
||||
- q2 = buffer->v;
|
||||
+ q2 = buffer->v + uv_offset;
|
||||
for (i = 0; i < decode->uv_height; i++) {
|
||||
memcpy(p, q, decode->uv_width);
|
||||
memcpy(p2, q2, decode->uv_width);
|
|
@ -107,6 +107,11 @@ oggplay_callback_theora (OGGZ * oggz, ogg_packet * op, long serialno,
|
|||
decoder->uv_width = decoder->uv_stride = decoder->video_info.frame_width / 2;
|
||||
decoder->uv_height = decoder->video_info.frame_height / 2;
|
||||
if (--(decoder->remaining_header_packets) == 0) {
|
||||
/* Ensure the offsets do not push the viewable area outside of the decoded frame. */
|
||||
if (((decoder->video_info.height - decoder->video_info.offset_y)<decoder->video_info.frame_height)||
|
||||
((decoder->video_info.width - decoder->video_info.offset_x)<decoder->video_info.frame_width))
|
||||
return -1;
|
||||
|
||||
theora_decode_init(&(decoder->video_handle), &(decoder->video_info));
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -323,6 +323,7 @@ oggplay_data_handle_theora_frame (OggPlayTheoraDecode *decode,
|
|||
|
||||
int size = sizeof (OggPlayVideoRecord);
|
||||
int i;
|
||||
int uv_offset;
|
||||
unsigned char * p;
|
||||
unsigned char * q;
|
||||
unsigned char * p2;
|
||||
|
@ -359,17 +360,20 @@ oggplay_data_handle_theora_frame (OggPlayTheoraDecode *decode,
|
|||
* a row-by-row copy (stride may be negative)
|
||||
*/
|
||||
p = data->y;
|
||||
q = buffer->y;
|
||||
q = buffer->y + (decode->video_info.offset_x&~1)+buffer->y_stride*(decode->video_info.offset_y&~1);
|
||||
for (i = 0; i < decode->y_height; i++) {
|
||||
memcpy(p, q, decode->y_width);
|
||||
p += decode->y_width;
|
||||
q += buffer->y_stride;
|
||||
}
|
||||
|
||||
uv_offset = (decode->video_info.offset_x/(decode->y_width/decode->uv_width)) +
|
||||
(buffer->uv_stride) *(decode->video_info.offset_y/(decode->y_height/decode->uv_height));
|
||||
|
||||
p = data->u;
|
||||
q = buffer->u;
|
||||
q = buffer->u + uv_offset;
|
||||
p2 = data->v;
|
||||
q2 = buffer->v;
|
||||
q2 = buffer->v + uv_offset;
|
||||
for (i = 0; i < decode->uv_height; i++) {
|
||||
memcpy(p, q, decode->uv_width);
|
||||
memcpy(p2, q2, decode->uv_width);
|
||||
|
|
|
@ -48,3 +48,4 @@ patch -p3 < bug485291_yuv_align.patch
|
|||
patch -p3 < endian.patch
|
||||
patch -p3 < trac466.patch
|
||||
patch -p3 < bug492436.patch
|
||||
patch -p3 < bug493140.patch
|
||||
|
|
Загрузка…
Ссылка в новой задаче