summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-07-01 10:27:48 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-07-01 10:27:48 +0000
commitf3d9b1791bef682bb78b502299daa1ba9bc76695 (patch)
tree3c43ddd7de5a648291ee305301f236fa7f9b87ef
parentb81271ed3e7cd3717a1b36c5dcffe8f786336077 (diff)
downloadrockbox-f3d9b1791bef682bb78b502299daa1ba9bc76695.tar.gz
rockbox-f3d9b1791bef682bb78b502299daa1ba9bc76695.zip
Bring libmpeg2 portions that we use up to date with the latest libmpeg2 CVS. Fix up some file headers and add a revision history to the libmpeg2 files detailing to which CVS file revisions things were synced. This makes it easier to start in the right place by hand in the future. Hopefully no mistakes and everything works. :-)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17904 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/mpegplayer/alloc.c4
-rw-r--r--apps/plugins/mpegplayer/attributes.h4
-rw-r--r--apps/plugins/mpegplayer/decode.c35
-rw-r--r--apps/plugins/mpegplayer/header.c261
-rw-r--r--apps/plugins/mpegplayer/idct.c4
-rw-r--r--apps/plugins/mpegplayer/motion_comp.c3
-rw-r--r--apps/plugins/mpegplayer/motion_comp.h2
-rw-r--r--apps/plugins/mpegplayer/motion_comp_arm_c.c2
-rw-r--r--apps/plugins/mpegplayer/motion_comp_arm_s.S2
-rw-r--r--apps/plugins/mpegplayer/motion_comp_c.c2
-rw-r--r--apps/plugins/mpegplayer/mpeg2.h29
-rw-r--r--apps/plugins/mpegplayer/mpeg2_internal.h7
-rw-r--r--apps/plugins/mpegplayer/mpeg_alloc.h20
-rw-r--r--apps/plugins/mpegplayer/slice.c16
-rw-r--r--apps/plugins/mpegplayer/video_out.h4
-rw-r--r--apps/plugins/mpegplayer/vlc.h152
16 files changed, 363 insertions, 184 deletions
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index 7ad8644e59..0feabdbbed 100644
--- a/apps/plugins/mpegplayer/alloc.c
+++ b/apps/plugins/mpegplayer/alloc.c
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.13
22 */ 26 */
23 27
24#include "plugin.h" 28#include "plugin.h"
diff --git a/apps/plugins/mpegplayer/attributes.h b/apps/plugins/mpegplayer/attributes.h
index eefbc0dd1b..9d708061c0 100644
--- a/apps/plugins/mpegplayer/attributes.h
+++ b/apps/plugins/mpegplayer/attributes.h
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.5
22 */ 26 */
23 27
24/* use gcc attribs to align critical data structures */ 28/* use gcc attribs to align critical data structures */
diff --git a/apps/plugins/mpegplayer/decode.c b/apps/plugins/mpegplayer/decode.c
index 1c85fa7a92..80a396d15b 100644
--- a/apps/plugins/mpegplayer/decode.c
+++ b/apps/plugins/mpegplayer/decode.c
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.114
22 */ 26 */
23 27
24#include "plugin.h" 28#include "plugin.h"
@@ -155,16 +159,14 @@ static inline mpeg2_state_t seek_chunk (mpeg2dec_t * mpeg2dec)
155 mpeg2dec->bytes_since_tag += skipped; 159 mpeg2dec->bytes_since_tag += skipped;
156 mpeg2dec->code = mpeg2dec->buf_start[-1]; 160 mpeg2dec->code = mpeg2dec->buf_start[-1];
157 161
158 return (mpeg2_state_t)-1; 162 return STATE_INTERNAL_NORETURN;
159} 163}
160 164
161mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec) 165mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec)
162{ 166{
163 while (mpeg2dec->code != 0xb3 && 167 while (!(mpeg2dec->code == 0xb3 ||
164 ((mpeg2dec->code != 0xb7 && 168 ((mpeg2dec->code == 0xb7 || mpeg2dec->code == 0xb8 ||
165 mpeg2dec->code != 0xb8 && 169 !mpeg2dec->code) && mpeg2dec->sequence.width != (unsigned)-1)))
166 mpeg2dec->code) ||
167 mpeg2dec->sequence.width == (unsigned)-1))
168 { 170 {
169 if (seek_chunk (mpeg2dec) == STATE_BUFFER) 171 if (seek_chunk (mpeg2dec) == STATE_BUFFER)
170 return STATE_BUFFER; 172 return STATE_BUFFER;
@@ -175,9 +177,8 @@ mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec)
175 177
176 mpeg2dec->user_data_len = 0; 178 mpeg2dec->user_data_len = 0;
177 179
178 return mpeg2dec->code ? 180 return ((mpeg2dec->code == 0xb7) ?
179 mpeg2_parse_header(mpeg2dec) : 181 mpeg2_header_end(mpeg2dec) : mpeg2_parse_header(mpeg2dec));
180 mpeg2_header_picture_start(mpeg2dec);
181} 182}
182 183
183#define RECEIVED(code,state) (((state) << 8) + (code)) 184#define RECEIVED(code,state) (((state) << 8) + (code))
@@ -192,7 +193,7 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec)
192 193
193 state = mpeg2dec->action (mpeg2dec); 194 state = mpeg2dec->action (mpeg2dec);
194 195
195 if ((int)state >= 0) 196 if ((int)state > (int)STATE_INTERNAL_NORETURN)
196 return state; 197 return state;
197 } 198 }
198 199
@@ -244,24 +245,20 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec)
244 return STATE_BUFFER; 245 return STATE_BUFFER;
245 } 246 }
246 247
248 mpeg2dec->action = mpeg2_seek_header;
249
247 switch (mpeg2dec->code) 250 switch (mpeg2dec->code)
248 { 251 {
249 case 0x00: 252 case 0x00:
250 mpeg2dec->action = mpeg2_header_picture_start;
251 return mpeg2dec->state; 253 return mpeg2dec->state;
252 case 0xb7:
253 mpeg2dec->action = mpeg2_header_end;
254 break;
255 case 0xb3: 254 case 0xb3:
255 case 0xb7:
256 case 0xb8: 256 case 0xb8:
257 mpeg2dec->action = mpeg2_parse_header; 257 return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID;
258 break;
259 default: 258 default:
260 mpeg2dec->action = seek_chunk; 259 mpeg2dec->action = seek_chunk;
261 return STATE_INVALID; 260 return STATE_INVALID;
262 } 261 }
263
264 return (mpeg2dec->state == STATE_SLICE) ? STATE_SLICE : STATE_INVALID;
265} 262}
266 263
267mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) 264mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
@@ -331,7 +328,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
331 { 328 {
332 /* state transition after a sequence header */ 329 /* state transition after a sequence header */
333 case RECEIVED (0x00, STATE_SEQUENCE): 330 case RECEIVED (0x00, STATE_SEQUENCE):
334 mpeg2dec->action = mpeg2_header_picture_start;
335 case RECEIVED (0xb8, STATE_SEQUENCE): 331 case RECEIVED (0xb8, STATE_SEQUENCE):
336 mpeg2_header_sequence_finalize (mpeg2dec); 332 mpeg2_header_sequence_finalize (mpeg2dec);
337 break; 333 break;
@@ -339,7 +335,6 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
339 /* other legal state transitions */ 335 /* other legal state transitions */
340 case RECEIVED (0x00, STATE_GOP): 336 case RECEIVED (0x00, STATE_GOP):
341 mpeg2_header_gop_finalize (mpeg2dec); 337 mpeg2_header_gop_finalize (mpeg2dec);
342 mpeg2dec->action = mpeg2_header_picture_start;
343 break; 338 break;
344 case RECEIVED (0x01, STATE_PICTURE): 339 case RECEIVED (0x01, STATE_PICTURE):
345 case RECEIVED (0x01, STATE_PICTURE_2ND): 340 case RECEIVED (0x01, STATE_PICTURE_2ND):
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c
index d8d005b692..f5571835c1 100644
--- a/apps/plugins/mpegplayer/header.c
+++ b/apps/plugins/mpegplayer/header.c
@@ -20,6 +20,10 @@
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * $Id$
25 * libmpeg2 sync history:
26 * 2008-07-01 - CVS revision 1.101
23 */ 27 */
24 28
25#include "plugin.h" 29#include "plugin.h"
@@ -325,14 +329,14 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec)
325{ 329{
326 uint8_t * buffer = mpeg2dec->chunk_start; 330 uint8_t * buffer = mpeg2dec->chunk_start;
327 mpeg2_sequence_t * sequence = &mpeg2dec->new_sequence; 331 mpeg2_sequence_t * sequence = &mpeg2dec->new_sequence;
328 uint32_t flags; 332 int x;
329 333
330 flags = (sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | 334 sequence->flags = (sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) |
331 ((buffer[0] << 4) & SEQ_MASK_VIDEO_FORMAT); 335 ((buffer[0] << 4) & SEQ_MASK_VIDEO_FORMAT);
332 336
333 if (buffer[0] & 1) 337 if (buffer[0] & 1)
334 { 338 {
335 flags |= SEQ_FLAG_COLOUR_DESCRIPTION; 339 sequence->flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
336 sequence->colour_primaries = buffer[1]; 340 sequence->colour_primaries = buffer[1];
337 sequence->transfer_characteristics = buffer[2]; 341 sequence->transfer_characteristics = buffer[2];
338 sequence->matrix_coefficients = buffer[3]; 342 sequence->matrix_coefficients = buffer[3];
@@ -342,15 +346,36 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec)
342 if (!(buffer[2] & 2)) /* missing marker_bit */ 346 if (!(buffer[2] & 2)) /* missing marker_bit */
343 return 1; 347 return 1;
344 348
345 sequence->display_width = 349 x = (buffer[1] << 6) | (buffer[2] >> 2);
346 (buffer[1] << 6) | (buffer[2] >> 2); 350 if (x)
351 sequence->display_width = x;
347 352
348 sequence->display_height = 353 x = ((buffer[2] & 1) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
349 ((buffer[2] & 1) << 13) | (buffer[3] << 5) | (buffer[4] >> 3); 354 if (x)
355 sequence->display_height = x;
350 356
351 return 0; 357 return 0;
352} 358}
353 359
360static inline void simplify (unsigned int * u, unsigned int * v)
361{
362 unsigned int a, b, tmp;
363
364 a = *u;
365 b = *v;
366
367 /* find greatest common divisor */
368 while (a)
369 {
370 tmp = a;
371 a = b % tmp;
372 b = tmp;
373 }
374
375 *u /= b;
376 *v /= b;
377}
378
354static inline void finalize_sequence (mpeg2_sequence_t * sequence) 379static inline void finalize_sequence (mpeg2_sequence_t * sequence)
355{ 380{
356 int width; 381 int width;
@@ -411,9 +436,13 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence)
411 sequence->pixel_width = 32; 436 sequence->pixel_width = 32;
412 sequence->pixel_height = 27; 437 sequence->pixel_height = 27;
413 return; 438 return;
414 case 12: /* 720*480 4:3 */ 439 case 8: /* BT.601 625 lines 4:3 */
415 sequence->pixel_width = 8; 440 sequence->pixel_width = 59;
416 sequence->pixel_height = 9; 441 sequence->pixel_height = 54;
442 return;
443 case 12: /* BT.601 525 lines 4:3 */
444 sequence->pixel_width = 10;
445 sequence->pixel_height = 11;
417 return; 446 return;
418 default: 447 default:
419 height = 88 * sequence->pixel_width + 1171; 448 height = 88 * sequence->pixel_width + 1171;
@@ -424,17 +453,113 @@ static inline void finalize_sequence (mpeg2_sequence_t * sequence)
424 sequence->pixel_width = width; 453 sequence->pixel_width = width;
425 sequence->pixel_height = height; 454 sequence->pixel_height = height;
426 455
427 /* find greatest common divisor */ 456 simplify(&sequence->pixel_width, &sequence->pixel_height);
428 while (width) 457}
458
459int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
460 unsigned int * pixel_width,
461 unsigned int * pixel_height)
462{
463 static const struct
464 {
465 unsigned int width, height;
466 } video_modes[] =
467 {
468 {720, 576}, /* 625 lines, 13.5 MHz (D1, DV, DVB, DVD) */
469 {704, 576}, /* 625 lines, 13.5 MHz (1/1 D1, DVB, DVD, 4CIF) */
470 {544, 576}, /* 625 lines, 10.125 MHz (DVB, laserdisc) */
471 {528, 576}, /* 625 lines, 10.125 MHz (3/4 D1, DVB, laserdisc) */
472 {480, 576}, /* 625 lines, 9 MHz (2/3 D1, DVB, SVCD) */
473 {352, 576}, /* 625 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVB, DVD) */
474 {352, 288}, /* 625 lines, 6.75 MHz, 1 field (D4, VCD, DVB, DVD, CIF) */
475 {176, 144}, /* 625 lines, 3.375 MHz, half field (QCIF) */
476 {720, 486}, /* 525 lines, 13.5 MHz (D1) */
477 {704, 486}, /* 525 lines, 13.5 MHz */
478 {720, 480}, /* 525 lines, 13.5 MHz (DV, DSS, DVD) */
479 {704, 480}, /* 525 lines, 13.5 MHz (1/1 D1, ATSC, DVD) */
480 {544, 480}, /* 525 lines. 10.125 MHz (DSS, laserdisc) */
481 {528, 480}, /* 525 lines. 10.125 MHz (3/4 D1, laserdisc) */
482 {480, 480}, /* 525 lines, 9 MHz (2/3 D1, SVCD) */
483 {352, 480}, /* 525 lines, 6.75 MHz (D2, 1/2 D1, CVD, DVD) */
484 {352, 240} /* 525 lines. 6.75 MHz, 1 field (D4, VCD, DSS, DVD) */
485 };
486 unsigned int width, height, pix_width, pix_height, i, DAR_16_9;
487
488 *pixel_width = sequence->pixel_width;
489 *pixel_height = sequence->pixel_height;
490 width = sequence->picture_width;
491 height = sequence->picture_height;
492
493 for (i = 0; i < sizeof (video_modes) / sizeof (video_modes[0]); i++)
494 {
495 if (width == video_modes[i].width && height == video_modes[i].height)
496 break;
497 }
498
499 if (i == ARRAYLEN(video_modes) ||
500 (sequence->pixel_width == 1 && sequence->pixel_height == 1) ||
501 width != sequence->display_width || height != sequence->display_height)
502 {
503 return 0;
504 }
505
506 for (pix_height = 1; height * pix_height < 480; pix_height <<= 1);
507 height *= pix_height;
508
509 for (pix_width = 1; width * pix_width <= 352; pix_width <<= 1);
510 width *= pix_width;
511
512 if (!(sequence->flags & SEQ_FLAG_MPEG2))
429 { 513 {
430 int tmp = width; 514 static unsigned int mpeg1_check[2][2] = {{11, 54}, {27, 45}};
431 width = height % tmp; 515 DAR_16_9 = (sequence->pixel_height == 27 ||
432 height = tmp; 516 sequence->pixel_height == 45);
517 if (width < 704 ||
518 sequence->pixel_height != mpeg1_check[DAR_16_9][height == 576])
519 return 0;
520 }
521 else
522 {
523 DAR_16_9 = (3 * sequence->picture_width * sequence->pixel_width >
524 4 * sequence->picture_height * sequence->pixel_height);
525 switch (width)
526 {
527 case 528:
528 case 544:
529 pix_width *= 4;
530 pix_height *= 3;
531 break;
532 case 480:
533 pix_width *= 3;
534 pix_height *= 2;
535 break;
536 }
433 } 537 }
434 538
435 sequence->pixel_width /= height; 539 if (DAR_16_9)
436 sequence->pixel_height /= height; 540 {
437} 541 pix_width *= 4;
542 pix_height *= 3;
543 }
544
545 if (height == 576)
546 {
547 pix_width *= 59;
548 pix_height *= 54;
549 }
550 else
551 {
552 pix_width *= 10;
553 pix_height *= 11;
554 }
555
556 *pixel_width = pix_width;
557 *pixel_height = pix_height;
558
559 simplify (pixel_width, pixel_height);
560
561 return (height == 576) ? 1 : 2;
562}
438 563
439static void copy_matrix (mpeg2dec_t * mpeg2dec, int index) 564static void copy_matrix (mpeg2dec_t * mpeg2dec, int index)
440{ 565{
@@ -506,36 +631,33 @@ void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec)
506 631
507 if (mpeg2dec->sequence.width != (unsigned)-1) 632 if (mpeg2dec->sequence.width != (unsigned)-1)
508 { 633 {
509 unsigned int new_byte_rate;
510
511 /* 634 /*
512 * According to 6.1.1.6, repeat sequence headers should be 635 * According to 6.1.1.6, repeat sequence headers should be
513 * identical to the original. However some DVDs dont respect 636 * identical to the original. However some encoders don't
514 * that and have different bitrates in the repeat sequence 637 * respect that and change various fields (including bitrate
515 * headers. So we'll ignore that in the comparison and still 638 * and aspect ratio) in the repeat sequence headers. So we
516 * consider these as repeat sequence headers. 639 * choose to be as conservative as possible and only restart
517 * 640 * the decoder if the width, height, chroma_width,
518 * However, be careful not to alter the current sequence when 641 * chroma_height or low_delay flag are modified.
519 * returning STATE_INVALID_END.
520 */ 642 */
521 new_byte_rate = sequence->byte_rate; 643 if (sequence->width != mpeg2dec->sequence.width ||
522 sequence->byte_rate = mpeg2dec->sequence.byte_rate; 644 sequence->height != mpeg2dec->sequence.height ||
523 645 sequence->chroma_width != mpeg2dec->sequence.chroma_width ||
524 if (rb->memcmp(&mpeg2dec->sequence, sequence, 646 sequence->chroma_height != mpeg2dec->sequence.chroma_height ||
525 sizeof (mpeg2_sequence_t))) 647 ((sequence->flags ^ mpeg2dec->sequence.flags) &
648 SEQ_FLAG_LOW_DELAY))
526 { 649 {
527 decoder->stride_frame = sequence->width; 650 decoder->stride_frame = sequence->width;
528 sequence->byte_rate = new_byte_rate;
529
530 mpeg2_header_end (mpeg2dec); 651 mpeg2_header_end (mpeg2dec);
531
532 mpeg2dec->action = invalid_end_action; 652 mpeg2dec->action = invalid_end_action;
533 mpeg2dec->state = STATE_INVALID_END; 653 mpeg2dec->state = STATE_INVALID_END;
534 return; 654 return;
535 } 655 }
536 656
537 sequence->byte_rate = new_byte_rate; 657 mpeg2dec->state = rb->memcmp(&mpeg2dec->sequence, sequence,
538 mpeg2dec->state = STATE_SEQUENCE_REPEATED; 658 sizeof (mpeg2_sequence_t)) ?
659 STATE_SEQUENCE_MODIFIED :
660 STATE_SEQUENCE_REPEATED;
539 } 661 }
540 else 662 else
541 { 663 {
@@ -601,70 +723,61 @@ void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type)
601 } 723 }
602} 724}
603 725
604mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec) 726int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)
605{ 727{
728 uint8_t * buffer = mpeg2dec->chunk_start;
606 mpeg2_picture_t * picture = &mpeg2dec->new_picture; 729 mpeg2_picture_t * picture = &mpeg2dec->new_picture;
730 mpeg2_decoder_t * decoder = &mpeg2dec->decoder;
731 int type;
607 732
608 mpeg2dec->state = (mpeg2dec->state != STATE_SLICE_1ST) ? 733 mpeg2dec->state = (mpeg2dec->state != STATE_SLICE_1ST) ?
609 STATE_PICTURE : STATE_PICTURE_2ND; 734 STATE_PICTURE : STATE_PICTURE_2ND;
610 picture->flags = 0; 735 mpeg2dec->ext_state = PIC_CODING_EXT;
736
737 picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
738
739 type = (buffer [1] >> 3) & 7;
740
741 if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B)
742 {
743 /* forward_f_code and backward_f_code - used in mpeg1 only */
744 decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1;
745 decoder->f_motion.f_code[0] =
746 (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
747 decoder->b_motion.f_code[1] = (buffer[4] >> 6) & 1;
748 decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
749 }
750
751 picture->flags = PIC_FLAG_PROGRESSIVE_FRAME | type;
611 picture->tag = picture->tag2 = 0; 752 picture->tag = picture->tag2 = 0;
612 753
613 if (mpeg2dec->num_tags) 754 if (mpeg2dec->num_tags)
614 { 755 {
615 if (mpeg2dec->bytes_since_tag >= 4) 756 if (mpeg2dec->bytes_since_tag >= mpeg2dec->chunk_ptr - buffer + 4)
616 { 757 {
617 mpeg2dec->num_tags = 0; 758 mpeg2dec->num_tags = 0;
618 picture->tag = mpeg2dec->tag_current; 759 picture->tag = mpeg2dec->tag_current;
619 picture->tag2 = mpeg2dec->tag2_current; 760 picture->tag2 = mpeg2dec->tag2_current;
620 picture->flags = PIC_FLAG_TAGS; 761 picture->flags |= PIC_FLAG_TAGS;
621 } 762 }
622 else if (mpeg2dec->num_tags > 1) 763 else if (mpeg2dec->num_tags > 1)
623 { 764 {
624 mpeg2dec->num_tags = 1; 765 mpeg2dec->num_tags = 1;
625 picture->tag = mpeg2dec->tag_previous; 766 picture->tag = mpeg2dec->tag_previous;
626 picture->tag2 = mpeg2dec->tag2_previous; 767 picture->tag2 = mpeg2dec->tag2_previous;
627 picture->flags = PIC_FLAG_TAGS; 768 picture->flags |= PIC_FLAG_TAGS;
628 } 769 }
629 } 770 }
630 771
772 picture->nb_fields = 2;
631 picture->display_offset[0].x = picture->display_offset[1].x = 773 picture->display_offset[0].x = picture->display_offset[1].x =
632 picture->display_offset[2].x = mpeg2dec->display_offset_x; 774 picture->display_offset[2].x = mpeg2dec->display_offset_x;
633 775
634 picture->display_offset[0].y = picture->display_offset[1].y = 776 picture->display_offset[0].y = picture->display_offset[1].y =
635 picture->display_offset[2].y = mpeg2dec->display_offset_y; 777 picture->display_offset[2].y = mpeg2dec->display_offset_y;
636 778
637 return mpeg2_parse_header (mpeg2dec);
638}
639
640int mpeg2_header_picture (mpeg2dec_t * mpeg2dec)
641{
642 uint8_t * buffer = mpeg2dec->chunk_start;
643 mpeg2_picture_t * picture = &mpeg2dec->new_picture;
644 mpeg2_decoder_t * decoder = &mpeg2dec->decoder;
645 int type;
646
647 type = (buffer [1] >> 3) & 7;
648 mpeg2dec->ext_state = PIC_CODING_EXT;
649
650 picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
651
652 picture->flags |= type;
653
654 if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B)
655 {
656 /* forward_f_code and backward_f_code - used in mpeg1 only */
657 decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1;
658 decoder->f_motion.f_code[0] =
659 (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
660 decoder->b_motion.f_code[1] = (buffer[4] >> 6) & 1;
661 decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
662 }
663
664 /* XXXXXX decode extra_information_picture as well */ 779 /* XXXXXX decode extra_information_picture as well */
665 780
666 picture->nb_fields = 2;
667
668 mpeg2dec->q_scale_type = 0; 781 mpeg2dec->q_scale_type = 0;
669 decoder->intra_dc_precision = 7; 782 decoder->intra_dc_precision = 7;
670 decoder->frame_pred_frame_dct = 1; 783 decoder->frame_pred_frame_dct = 1;
@@ -722,7 +835,9 @@ static int picture_coding_ext (mpeg2dec_t * mpeg2dec)
722 mpeg2dec->q_scale_type = buffer[3] & 16; 835 mpeg2dec->q_scale_type = buffer[3] & 16;
723 decoder->intra_vlc_format = (buffer[3] >> 3) & 1; 836 decoder->intra_vlc_format = (buffer[3] >> 3) & 1;
724 decoder->scan = (buffer[3] & 4) ? mpeg2_scan_alt : mpeg2_scan_norm; 837 decoder->scan = (buffer[3] & 4) ? mpeg2_scan_alt : mpeg2_scan_norm;
725 flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0; 838
839 if (!(buffer[4] & 0x80))
840 flags &= ~PIC_FLAG_PROGRESSIVE_FRAME;
726 841
727 if (buffer[4] & 0x40) 842 if (buffer[4] & 0x40)
728 { 843 {
@@ -1120,7 +1235,7 @@ mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec)
1120 1235
1121 mpeg2dec->action = NULL; 1236 mpeg2dec->action = NULL;
1122 1237
1123 return (mpeg2_state_t)-1; 1238 return STATE_INTERNAL_NORETURN;
1124} 1239}
1125 1240
1126static mpeg2_state_t seek_sequence (mpeg2dec_t * mpeg2dec) 1241static mpeg2_state_t seek_sequence (mpeg2dec_t * mpeg2dec)
diff --git a/apps/plugins/mpegplayer/idct.c b/apps/plugins/mpegplayer/idct.c
index f9e3b7d664..7f0b9a3c12 100644
--- a/apps/plugins/mpegplayer/idct.c
+++ b/apps/plugins/mpegplayer/idct.c
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.36
22 */ 26 */
23 27
24#include "plugin.h" 28#include "plugin.h"
diff --git a/apps/plugins/mpegplayer/motion_comp.c b/apps/plugins/mpegplayer/motion_comp.c
index e76b65f6f0..d6968f68ce 100644
--- a/apps/plugins/mpegplayer/motion_comp.c
+++ b/apps/plugins/mpegplayer/motion_comp.c
@@ -21,6 +21,9 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 22 *
23 * $Id$ 23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.17 - lost compatibility previously to
26 * provide simplified and CPU-optimized motion compensation.
24 */ 27 */
25 28
26#include "plugin.h" 29#include "plugin.h"
diff --git a/apps/plugins/mpegplayer/motion_comp.h b/apps/plugins/mpegplayer/motion_comp.h
index 2823cc6da1..4737e72cab 100644
--- a/apps/plugins/mpegplayer/motion_comp.h
+++ b/apps/plugins/mpegplayer/motion_comp.h
@@ -19,6 +19,8 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
22 */ 24 */
23 25
24 26
diff --git a/apps/plugins/mpegplayer/motion_comp_arm_c.c b/apps/plugins/mpegplayer/motion_comp_arm_c.c
index 1d0f9d22fc..dcf1df53e9 100644
--- a/apps/plugins/mpegplayer/motion_comp_arm_c.c
+++ b/apps/plugins/mpegplayer/motion_comp_arm_c.c
@@ -18,6 +18,8 @@
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * $Id$
21 */ 23 */
22#include <inttypes.h> 24#include <inttypes.h>
23#include "mpeg2.h" 25#include "mpeg2.h"
diff --git a/apps/plugins/mpegplayer/motion_comp_arm_s.S b/apps/plugins/mpegplayer/motion_comp_arm_s.S
index e515f8b516..36c3fec06a 100644
--- a/apps/plugins/mpegplayer/motion_comp_arm_s.S
+++ b/apps/plugins/mpegplayer/motion_comp_arm_s.S
@@ -17,6 +17,8 @@
17@ You should have received a copy of the GNU General Public License 17@ You should have received a copy of the GNU General Public License
18@ along with this program; if not, write to the Free Software 18@ along with this program; if not, write to the Free Software
19@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20@
21@ $Id$
20 22
21 .text 23 .text
22 24
diff --git a/apps/plugins/mpegplayer/motion_comp_c.c b/apps/plugins/mpegplayer/motion_comp_c.c
index 6a93a86e43..9a8640e7e6 100644
--- a/apps/plugins/mpegplayer/motion_comp_c.c
+++ b/apps/plugins/mpegplayer/motion_comp_c.c
@@ -19,6 +19,8 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
22 */ 24 */
23#include <inttypes.h> 25#include <inttypes.h>
24#include "mpeg2.h" 26#include "mpeg2.h"
diff --git a/apps/plugins/mpegplayer/mpeg2.h b/apps/plugins/mpegplayer/mpeg2.h
index 48e4aab66a..2a63f399f9 100644
--- a/apps/plugins/mpegplayer/mpeg2.h
+++ b/apps/plugins/mpegplayer/mpeg2.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * mpeg2.h 2 * mpeg2.h
3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> 3 * Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> 4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
5 * 5 *
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. 6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.67
22 */ 26 */
23 27
24#ifndef MPEG2_H 28#ifndef MPEG2_H
@@ -27,7 +31,7 @@
27#include "mpeg2dec_config.h" 31#include "mpeg2dec_config.h"
28 32
29#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) 33#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
30#define MPEG2_RELEASE MPEG2_VERSION (0, 4, 0) /* 0.4.0 */ 34#define MPEG2_RELEASE MPEG2_VERSION (0, 5, 0) /* 0.5.0 */
31 35
32#define SEQ_FLAG_MPEG2 1 36#define SEQ_FLAG_MPEG2 1
33#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2 37#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
@@ -129,14 +133,15 @@ typedef enum
129 STATE_BUFFER = 0, 133 STATE_BUFFER = 0,
130 STATE_SEQUENCE = 1, 134 STATE_SEQUENCE = 1,
131 STATE_SEQUENCE_REPEATED = 2, 135 STATE_SEQUENCE_REPEATED = 2,
132 STATE_GOP = 3, 136 STATE_SEQUENCE_MODIFIED = 3,
133 STATE_PICTURE = 4, 137 STATE_GOP = 4,
134 STATE_SLICE_1ST = 5, 138 STATE_PICTURE = 5,
135 STATE_PICTURE_2ND = 6, 139 STATE_SLICE_1ST = 6,
136 STATE_SLICE = 7, 140 STATE_PICTURE_2ND = 7,
137 STATE_END = 8, 141 STATE_SLICE = 8,
138 STATE_INVALID = 9, 142 STATE_END = 9,
139 STATE_INVALID_END = 10 143 STATE_INVALID = 10,
144 STATE_INVALID_END = 11,
140} mpeg2_state_t; 145} mpeg2_state_t;
141 146
142typedef struct mpeg2_convert_init_s 147typedef struct mpeg2_convert_init_s
@@ -184,6 +189,10 @@ void mpeg2_init_fbuf (mpeg2_decoder_t * decoder,
184 uint8_t * backward_fbuf[MPEG2_COMPONENTS]); 189 uint8_t * backward_fbuf[MPEG2_COMPONENTS]);
185void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer); 190void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer);
186 191
192int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
193 unsigned int * pixel_width,
194 unsigned int * pixel_height);
195
187typedef enum 196typedef enum
188{ 197{
189 MPEG2_ALLOC_MPEG2DEC = 0, 198 MPEG2_ALLOC_MPEG2DEC = 0,
diff --git a/apps/plugins/mpegplayer/mpeg2_internal.h b/apps/plugins/mpegplayer/mpeg2_internal.h
index 062100c85a..cbc3e24a2d 100644
--- a/apps/plugins/mpegplayer/mpeg2_internal.h
+++ b/apps/plugins/mpegplayer/mpeg2_internal.h
@@ -19,12 +19,18 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.89
22 */ 26 */
23#ifndef MPEG2_INTERNAL_H 27#ifndef MPEG2_INTERNAL_H
24#define MPEG2_INTERNAL_H 28#define MPEG2_INTERNAL_H
25 29
26#include "config.h" /* for Rockbox CPU_ #defines */ 30#include "config.h" /* for Rockbox CPU_ #defines */
27 31
32#define STATE_INTERNAL_NORETURN ((mpeg2_state_t)-1)
33
28/* macroblock modes */ 34/* macroblock modes */
29#define MACROBLOCK_INTRA 1 35#define MACROBLOCK_INTRA 1
30#define MACROBLOCK_PATTERN 2 36#define MACROBLOCK_PATTERN 2
@@ -233,7 +239,6 @@ void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec);
233void mpeg2_reset_info (mpeg2_info_t * info); 239void mpeg2_reset_info (mpeg2_info_t * info);
234int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec); 240int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec);
235int mpeg2_header_gop (mpeg2dec_t * mpeg2dec); 241int mpeg2_header_gop (mpeg2dec_t * mpeg2dec);
236mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec);
237int mpeg2_header_picture (mpeg2dec_t * mpeg2dec); 242int mpeg2_header_picture (mpeg2dec_t * mpeg2dec);
238int mpeg2_header_extension (mpeg2dec_t * mpeg2dec); 243int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);
239int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec); 244int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
diff --git a/apps/plugins/mpegplayer/mpeg_alloc.h b/apps/plugins/mpegplayer/mpeg_alloc.h
index 9a08fd5308..9acfbc5dec 100644
--- a/apps/plugins/mpegplayer/mpeg_alloc.h
+++ b/apps/plugins/mpegplayer/mpeg_alloc.h
@@ -1,3 +1,23 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
1#ifndef MPEG_ALLOC_H 21#ifndef MPEG_ALLOC_H
2#define MPEG_ALLOC_H 22#define MPEG_ALLOC_H
3 23
diff --git a/apps/plugins/mpegplayer/slice.c b/apps/plugins/mpegplayer/slice.c
index a98e85baa5..926333d5d0 100644
--- a/apps/plugins/mpegplayer/slice.c
+++ b/apps/plugins/mpegplayer/slice.c
@@ -20,6 +20,10 @@
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * $Id$
25 * libmpeg2 sync history:
26 * 2008-07-01 - CVS revision 1.55
23 */ 27 */
24 28
25#include "plugin.h" 29#include "plugin.h"
@@ -488,7 +492,7 @@ static void get_intra_block_B14 (mpeg2_decoder_t * const decoder,
488 } 492 }
489 493
490 dest[63] ^= mismatch & 16; 494 dest[63] ^= mismatch & 16;
491 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ 495 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
492 decoder->bitstream_buf = bit_buf; 496 decoder->bitstream_buf = bit_buf;
493 decoder->bitstream_bits = bits; 497 decoder->bitstream_bits = bits;
494 decoder->bitstream_ptr = bit_ptr; 498 decoder->bitstream_ptr = bit_ptr;
@@ -601,7 +605,7 @@ static void get_intra_block_B15 (mpeg2_decoder_t * const decoder,
601 } 605 }
602 606
603 dest[63] ^= mismatch & 16; 607 dest[63] ^= mismatch & 16;
604 DUMPBITS (bit_buf, bits, 4); /* dump end of block code */ 608 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
605 decoder->bitstream_buf = bit_buf; 609 decoder->bitstream_buf = bit_buf;
606 decoder->bitstream_bits = bits; 610 decoder->bitstream_bits = bits;
607 decoder->bitstream_ptr = bit_ptr; 611 decoder->bitstream_ptr = bit_ptr;
@@ -728,7 +732,7 @@ static int get_non_intra_block (mpeg2_decoder_t * const decoder,
728 } 732 }
729 733
730 dest[63] ^= mismatch & 16; 734 dest[63] ^= mismatch & 16;
731 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ 735 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
732 decoder->bitstream_buf = bit_buf; 736 decoder->bitstream_buf = bit_buf;
733 decoder->bitstream_bits = bits; 737 decoder->bitstream_bits = bits;
734 decoder->bitstream_ptr = bit_ptr; 738 decoder->bitstream_ptr = bit_ptr;
@@ -852,7 +856,7 @@ static void get_mpeg1_intra_block (mpeg2_decoder_t * const decoder)
852 break; /* illegal, check needed to avoid buffer overflow */ 856 break; /* illegal, check needed to avoid buffer overflow */
853 } 857 }
854 858
855 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ 859 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
856 decoder->bitstream_buf = bit_buf; 860 decoder->bitstream_buf = bit_buf;
857 decoder->bitstream_bits = bits; 861 decoder->bitstream_bits = bits;
858 decoder->bitstream_ptr = bit_ptr; 862 decoder->bitstream_ptr = bit_ptr;
@@ -989,7 +993,7 @@ static int get_mpeg1_non_intra_block (mpeg2_decoder_t * const decoder)
989 break; /* illegal, check needed to avoid buffer overflow */ 993 break; /* illegal, check needed to avoid buffer overflow */
990 } 994 }
991 995
992 DUMPBITS (bit_buf, bits, 2); /* dump end of block code */ 996 DUMPBITS (bit_buf, bits, tab->len); /* dump end of block code */
993 decoder->bitstream_buf = bit_buf; 997 decoder->bitstream_buf = bit_buf;
994 decoder->bitstream_bits = bits; 998 decoder->bitstream_bits = bits;
995 decoder->bitstream_ptr = bit_ptr; 999 decoder->bitstream_ptr = bit_ptr;
@@ -1924,7 +1928,7 @@ static void skip_chroma_intra (mpeg2_decoder_t * const decoder)
1924 { \ 1928 { \
1925 table[4] (decoder->dest[1] + decoder->offset, \ 1929 table[4] (decoder->dest[1] + decoder->offset, \
1926 ref[1] + offset, decoder->stride, 16); \ 1930 ref[1] + offset, decoder->stride, 16); \
1927 table[4] (decoder->dest[2] + (decoder->offset >> 1), \ 1931 table[4] (decoder->dest[2] + decoder->offset, \
1928 ref[2] + offset, decoder->stride, 16); \ 1932 ref[2] + offset, decoder->stride, 16); \
1929 } 1933 }
1930 1934
diff --git a/apps/plugins/mpegplayer/video_out.h b/apps/plugins/mpegplayer/video_out.h
index 0b521b40b3..808f233ac1 100644
--- a/apps/plugins/mpegplayer/video_out.h
+++ b/apps/plugins/mpegplayer/video_out.h
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.22
22 */ 26 */
23 27
24#ifndef VIDEO_OUT_H 28#ifndef VIDEO_OUT_H
diff --git a/apps/plugins/mpegplayer/vlc.h b/apps/plugins/mpegplayer/vlc.h
index 90245cc8ea..d1b6a98cde 100644
--- a/apps/plugins/mpegplayer/vlc.h
+++ b/apps/plugins/mpegplayer/vlc.h
@@ -19,6 +19,10 @@
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * $Id$
24 * libmpeg2 sync history:
25 * 2008-07-01 - CVS revision 1.12
22 */ 26 */
23 27
24#define GETWORD(bit_buf, shift, bit_ptr) \ 28#define GETWORD(bit_buf, shift, bit_ptr) \
@@ -121,7 +125,7 @@ static const MBtab MB_P [] ICONST_ATTR = {
121#define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD 125#define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD
122 126
123static const MBtab MB_B [] ICONST_ATTR = { 127static const MBtab MB_B [] ICONST_ATTR = {
124 {0, 0}, {INTRA|QUANT, 6}, 128 {0, 6}, {INTRA|QUANT, 6},
125 {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6}, 129 {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6},
126 {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5}, 130 {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5},
127 {INTRA, 5}, {INTRA, 5}, 131 {INTRA, 5}, {INTRA, 5},
@@ -201,7 +205,7 @@ static const CBPtab CBP_7 [] ICONST_ATTR = {
201}; 205};
202 206
203static const CBPtab CBP_9 [] ICONST_ATTR = { 207static const CBPtab CBP_9 [] ICONST_ATTR = {
204 {0, 0}, {0x00, 9}, {0x39, 9}, {0x36, 9}, 208 {0, 9}, {0x00, 9}, {0x39, 9}, {0x36, 9},
205 {0x37, 9}, {0x3b, 9}, {0x3d, 9}, {0x3e, 9}, 209 {0x37, 9}, {0x3b, 9}, {0x3d, 9}, {0x3e, 9},
206 {0x17, 8}, {0x17, 8}, {0x1b, 8}, {0x1b, 8}, 210 {0x17, 8}, {0x17, 8}, {0x1b, 8}, {0x1b, 8},
207 {0x1d, 8}, {0x1d, 8}, {0x1e, 8}, {0x1e, 8}, 211 {0x1d, 8}, {0x1d, 8}, {0x1e, 8}, {0x1e, 8},
@@ -289,15 +293,15 @@ static const DCTtab DCT_B14_10 [] ICONST_ATTR = {
289}; 293};
290 294
291static const DCTtab DCT_B14_8 [] ICONST_ATTR = { 295static const DCTtab DCT_B14_8 [] ICONST_ATTR = {
292 { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, 296 { 65, 0, 12}, { 65, 0, 12}, { 65, 0, 12}, { 65, 0, 12},
293 { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7}, 297 { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7},
294 { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7}, 298 { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7},
295 { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, 299 { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6},
296 { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6}, 300 { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6},
297 { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6}, 301 { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6},
298 { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, 302 { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
299 { 14, 1, 8}, { 1, 6, 8}, { 13, 1, 8}, { 12, 1, 8}, 303 { 14, 1, 8}, { 1, 6, 8}, { 13, 1, 8}, { 12, 1, 8},
300 { 4, 2, 8}, { 2, 3, 8}, { 1, 5, 8}, { 11, 1, 8} 304 { 4, 2, 8}, { 2, 3, 8}, { 1, 5, 8}, { 11, 1, 8}
301}; 305};
302 306
303static const DCTtab DCT_B14AC_5 [] ICONST_ATTR = { 307static const DCTtab DCT_B14AC_5 [] ICONST_ATTR = {
@@ -326,69 +330,69 @@ static const DCTtab DCT_B15_10 [] ICONST_ATTR = {
326}; 330};
327 331
328static const DCTtab DCT_B15_8 [] ICONST_ATTR = { 332static const DCTtab DCT_B15_8 [] ICONST_ATTR = {
329 { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, 333 { 65, 0, 12}, { 65, 0, 12}, { 65, 0, 12}, { 65, 0, 12},
330 { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7}, 334 { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7},
331 { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7}, 335 { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7},
332 { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, 336 { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6},
333 { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, 337 { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6},
334 { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, 338 { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6},
335 { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, 339 { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
336 { 2, 5, 8}, { 12, 1, 8}, { 1,11, 8}, { 1,10, 8}, 340 { 2, 5, 8}, { 12, 1, 8}, { 1,11, 8}, { 1,10, 8},
337 { 14, 1, 8}, { 13, 1, 8}, { 4, 2, 8}, { 2, 4, 8}, 341 { 14, 1, 8}, { 13, 1, 8}, { 4, 2, 8}, { 2, 4, 8},
338 { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, 342 { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
339 { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, 343 { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
340 { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, 344 { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
341 { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, 345 { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
342 { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, 346 { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
343 { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, 347 { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
344 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 348 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
345 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 349 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
346 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 350 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
347 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 351 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
348 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 352 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
349 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 353 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
350 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 354 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
351 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, 355 { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
352 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, 356 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
353 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, 357 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
354 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, 358 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
355 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, 359 {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
356 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, 360 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
357 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, 361 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
358 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, 362 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
359 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, 363 { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
360 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 364 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
361 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 365 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
362 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 366 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
363 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 367 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
364 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 368 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
365 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 369 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
366 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 370 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
367 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 371 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
368 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 372 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
369 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 373 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
370 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 374 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
371 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 375 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
372 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 376 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
373 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 377 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
374 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 378 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
375 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, 379 { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
376 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 380 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
377 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 381 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
378 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 382 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
379 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 383 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
380 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 384 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
381 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 385 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
382 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 386 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
383 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, 387 { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
384 { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, 388 { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
385 { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, 389 { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
386 { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, 390 { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
387 { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, 391 { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
388 { 10, 1, 7}, { 10, 1, 7}, { 2, 3, 7}, { 2, 3, 7}, 392 { 10, 1, 7}, { 10, 1, 7}, { 2, 3, 7}, { 2, 3, 7},
389 { 11, 1, 7}, { 11, 1, 7}, { 1, 8, 7}, { 1, 8, 7}, 393 { 11, 1, 7}, { 11, 1, 7}, { 1, 8, 7}, { 1, 8, 7},
390 { 1, 9, 7}, { 1, 9, 7}, { 1,12, 8}, { 1,13, 8}, 394 { 1, 9, 7}, { 1, 9, 7}, { 1,12, 8}, { 1,13, 8},
391 { 3, 3, 8}, { 5, 2, 8}, { 1,14, 8}, { 1,15, 8} 395 { 3, 3, 8}, { 5, 2, 8}, { 1,14, 8}, { 1,15, 8}
392}; 396};
393 397
394 398