1 #include "../libmpeg3.h"
2 #include "../mpeg3private.h"
3 #include "../mpeg3protos.h"
4 #include "mpeg3video.h"
5 #include "mpeg3videoprotos.h"
9 // "½Åµ¿ÈÆ" <doogle@shinbiro.com>
13 unsigned char mpeg3_zig_zag_scan_nommx
[64] =
15 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
16 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
17 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
18 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
22 unsigned char mpeg3_alternate_scan_nommx
[64] =
24 0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
25 41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
26 51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
27 53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
30 /* default intra quantization matrix */
31 unsigned char mpeg3_default_intra_quantizer_matrix
[64] =
33 8, 16, 19, 22, 26, 27, 29, 34,
34 16, 16, 22, 24, 27, 29, 34, 37,
35 19, 22, 26, 27, 29, 34, 34, 38,
36 22, 22, 26, 27, 29, 34, 37, 40,
37 22, 26, 27, 29, 32, 35, 40, 48,
38 26, 27, 29, 32, 35, 40, 48, 58,
39 26, 27, 29, 34, 38, 46, 56, 69,
40 27, 29, 35, 38, 46, 56, 69, 83
43 unsigned char mpeg3_non_linear_mquant_table
[32] =
45 0, 1, 2, 3, 4, 5, 6, 7,
46 8, 10, 12, 14, 16, 18, 20, 22,
47 24, 28, 32, 36, 40, 44, 48, 52,
48 56, 64, 72, 80, 88, 96, 104, 112
51 double mpeg3_frame_rate_table
[16] =
54 (double)24000.0/1001.0, /* Official frame rates */
57 (double)30000.0/1001.0,
60 (double)60000.0/1001.0,
63 1, /* Unofficial economy rates */
72 int mpeg3video_initdecoder(mpeg3video_t
*video
)
74 int blk_cnt_tab
[3] = {6, 8, 12};
77 long size
[4], padding
[2]; /* Size of Y, U, and V buffers */
81 /* force MPEG-1 parameters */
83 video
->prog_frame
= 1;
84 video
->pict_struct
= FRAME_PICTURE
;
85 video
->frame_pred_dct
= 1;
86 video
->chroma_format
= CHROMA420
;
87 video
->matrix_coefficients
= 5;
90 /* Get dimensions rounded to nearest multiple of coded macroblocks */
91 video
->mb_width
= (video
->horizontal_size
+ 15) / 16;
92 video
->mb_height
= (video
->mpeg2
&& !video
->prog_seq
) ?
93 (2 * ((video
->vertical_size
+ 31) / 32)) :
94 ((video
->vertical_size
+ 15) / 16);
95 video
->coded_picture_width
= 16 * video
->mb_width
;
96 video
->coded_picture_height
= 16 * video
->mb_height
;
97 video
->chrom_width
= (video
->chroma_format
== CHROMA444
) ?
98 video
->coded_picture_width
:
99 (video
->coded_picture_width
>> 1);
100 video
->chrom_height
= (video
->chroma_format
!= CHROMA420
) ?
101 video
->coded_picture_height
:
102 (video
->coded_picture_height
>> 1);
103 video
->blk_cnt
= blk_cnt_tab
[video
->chroma_format
- 1];
105 /* Get sizes of YUV buffers */
106 padding
[0] = 16 * video
->coded_picture_width
;
107 size
[0] = video
->coded_picture_width
* video
->coded_picture_height
+ padding
[0] * 2;
109 padding
[1] = 16 * video
->chrom_width
;
110 size
[1] = video
->chrom_width
* video
->chrom_height
+ 2 * padding
[1];
112 size
[2] = (video
->llw
* video
->llh
);
113 size
[3] = (video
->llw
* video
->llh
) / 4;
115 /* Allocate contiguous fragments for YUV buffers for hardware YUV decoding */
116 video
->yuv_buffer
[0] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
117 video
->yuv_buffer
[1] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
118 video
->yuv_buffer
[2] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
120 if(video
->scalable_mode
== SC_SPAT
)
122 video
->yuv_buffer
[3] = (unsigned char*)calloc(1, size
[2] + 2 * size
[3]);
123 video
->yuv_buffer
[4] = (unsigned char*)calloc(1, size
[2] + 2 * size
[3]);
126 /* Direct pointers to areas of contiguous fragments in YVU order per Microsoft */
127 for(cc
= 0; cc
< 3; cc
++)
129 video
->llframe0
[cc
] = 0;
130 video
->llframe1
[cc
] = 0;
131 video
->newframe
[cc
] = 0;
134 video
->refframe
[0] = video
->yuv_buffer
[0];
135 video
->oldrefframe
[0] = video
->yuv_buffer
[1];
136 video
->auxframe
[0] = video
->yuv_buffer
[2];
137 video
->refframe
[2] = video
->yuv_buffer
[0] + size
[0] + padding
[0];
138 video
->oldrefframe
[2] = video
->yuv_buffer
[1] + size
[0] + padding
[0];
139 video
->auxframe
[2] = video
->yuv_buffer
[2] + size
[0] + padding
[0];
140 video
->refframe
[1] = video
->yuv_buffer
[0] + size
[0] + padding
[0] + size
[1] + padding
[1];
141 video
->oldrefframe
[1] = video
->yuv_buffer
[1] + size
[0] + padding
[0] + size
[1] + padding
[1];
142 video
->auxframe
[1] = video
->yuv_buffer
[2] + size
[0] + padding
[0] + size
[1] + padding
[1];
144 if(video
->scalable_mode
== SC_SPAT
)
146 /* this assumes lower layer is 4:2:0 */
147 video
->llframe0
[0] = video
->yuv_buffer
[3] + padding
[0] ;
148 video
->llframe1
[0] = video
->yuv_buffer
[4] + padding
[0] ;
149 video
->llframe0
[2] = video
->yuv_buffer
[3] + padding
[1] + size
[2] ;
150 video
->llframe1
[2] = video
->yuv_buffer
[4] + padding
[1] + size
[2] ;
151 video
->llframe0
[1] = video
->yuv_buffer
[3] + padding
[1] + size
[2] + size
[3];
152 video
->llframe1
[1] = video
->yuv_buffer
[4] + padding
[1] + size
[2] + size
[3];
155 /* Initialize the YUV tables for software YUV decoding */
156 video
->cr_to_r
= malloc(sizeof(long) * 256);
157 video
->cr_to_g
= malloc(sizeof(long) * 256);
158 video
->cb_to_g
= malloc(sizeof(long) * 256);
159 video
->cb_to_b
= malloc(sizeof(long) * 256);
160 video
->cr_to_r_ptr
= video
->cr_to_r
+ 128;
161 video
->cr_to_g_ptr
= video
->cr_to_g
+ 128;
162 video
->cb_to_g_ptr
= video
->cb_to_g
+ 128;
163 video
->cb_to_b_ptr
= video
->cb_to_b
+ 128;
165 for(i
= -128; i
< 128; i
++)
167 video
->cr_to_r_ptr
[i
] = (long)( 1.371 * 65536 * i
);
168 video
->cr_to_g_ptr
[i
] = (long)(-0.698 * 65536 * i
);
169 video
->cb_to_g_ptr
[i
] = (long)(-0.336 * 65536 * i
);
170 video
->cb_to_b_ptr
[i
] = (long)( 1.732 * 65536 * i
);
176 int mpeg3video_deletedecoder(mpeg3video_t
*video
)
180 if(video
->yuv_buffer
[0]) free(video
->yuv_buffer
[0]);
181 if(video
->yuv_buffer
[1]) free(video
->yuv_buffer
[1]);
182 if(video
->yuv_buffer
[2]) free(video
->yuv_buffer
[2]);
184 if(video
->subtitle_frame
[0]) free(video
->subtitle_frame
[0]);
185 if(video
->subtitle_frame
[1]) free(video
->subtitle_frame
[1]);
186 if(video
->subtitle_frame
[2]) free(video
->subtitle_frame
[2]);
188 if(video
->llframe0
[0])
190 free(video
->yuv_buffer
[3]);
191 free(video
->yuv_buffer
[4]);
194 free(video
->cr_to_r
);
195 free(video
->cr_to_g
);
196 free(video
->cb_to_g
);
197 free(video
->cb_to_b
);
201 void mpeg3video_init_scantables(mpeg3video_t
*video
)
204 video
->mpeg3_zigzag_scan_table
= mpeg3_zig_zag_scan_nommx
;
205 video
->mpeg3_alternate_scan_table
= mpeg3_alternate_scan_nommx
;
209 mpeg3video_t
* mpeg3video_allocate_struct(mpeg3_t
*file
, mpeg3_vtrack_t
*track
)
212 mpeg3video_t
*video
= calloc(1, sizeof(mpeg3video_t
));
213 pthread_mutexattr_t mutex_attr
;
216 video
->track
= track
;
217 video
->vstream
= mpeg3bits_new_stream(file
, track
->demuxer
);
218 //printf("mpeg3video_allocate_struct %d\n", mpeg3bits_eof(video->vstream));
219 video
->last_number
= -1;
221 /* First frame is all green */
222 video
->framenum
= -1;
224 video
->byte_seek
= -1;
225 video
->frame_seek
= -1;
227 mpeg3video_init_scantables(video
);
228 mpeg3video_init_output();
230 pthread_mutexattr_init(&mutex_attr
);
231 // pthread_mutexattr_setkind_np(&mutex_attr, PTHREAD_MUTEX_FAST_NP);
232 pthread_mutex_init(&(video
->test_lock
), &mutex_attr
);
233 pthread_mutex_init(&(video
->slice_lock
), &mutex_attr
);
237 int mpeg3video_delete_struct(mpeg3video_t
*video
)
240 mpeg3bits_delete_stream(video
->vstream
);
241 pthread_mutex_destroy(&(video
->test_lock
));
242 pthread_mutex_destroy(&(video
->slice_lock
));
245 free(video
->x_table
);
246 free(video
->y_table
);
248 if(video
->total_slice_decoders
)
250 for(i
= 0; i
< video
->total_slice_decoders
; i
++)
251 mpeg3_delete_slice_decoder(&(video
->slice_decoders
[i
]));
253 for(i
= 0; i
< video
->slice_buffers_initialized
; i
++)
254 mpeg3_delete_slice_buffer(&(video
->slice_buffers
[i
]));
262 int mpeg3video_read_frame_backend(mpeg3video_t
*video
, int skip_bframes
)
265 int got_top
= 0, got_bottom
= 0;
267 mpeg3_vtrack_t
*track
= video
->track
;
268 mpeg3_t
*file
= (mpeg3_t
*)video
->file
;
270 //printf("mpeg3video_read_frame_backend 1\n");
274 if(mpeg3bits_eof(video
->vstream
)) result
= 1;
276 if(!result
) result
= mpeg3video_get_header(video
, 0);
279 /* skip_bframes is the number of bframes we can skip successfully. */
280 /* This is in case a skipped B-frame is repeated and the second repeat happens */
281 /* to be a B frame we need. */
282 video
->skip_bframes
= skip_bframes
;
285 result
= mpeg3video_getpicture(video
, video
->framenum
);
288 if(video
->pict_struct
== TOP_FIELD
)
293 if(video
->pict_struct
== BOTTOM_FIELD
)
296 video
->secondfield
= 0;
299 if(video
->pict_struct
== FRAME_PICTURE
)
301 got_top
= got_bottom
= 1;
307 video
->framenum
>= 0);
308 // The way they do field based encoding,
309 // the I frames have the top field but both the I frame and
310 // subsequent P frame are interlaced to make the keyframe.
314 //printf("mpeg3video_read_frame_backend 10\n");
316 // Composite subtitles
317 mpeg3_decode_subtitle(video
);
324 video
->last_number
= video
->framenum
;
327 //printf("mpeg3video_read_frame_backend 100\n");
332 int* mpeg3video_get_scaletable(int input_w
, int output_w
)
334 int *result
= malloc(sizeof(int) * output_w
);
336 float scale
= (float)input_w
/ output_w
;
337 for(i
= 0; i
< output_w
; i
++)
339 result
[(int)i
] = (int)(scale
* i
);
344 /* Get the first I frame. */
345 int mpeg3video_get_firstframe(mpeg3video_t
*video
)
348 video
->repeat_count
= video
->current_repeat
= 0;
349 result
= mpeg3video_read_frame_backend(video
, 0);
353 static long gop_to_frame(mpeg3video_t
*video
, mpeg3_timecode_t
*gop_timecode
)
355 int hour
, minute
, second
, frame
, fps
;
358 // Mirror of what mpeg2enc does
359 fps
= (int)(video
->frame_rate
+ 0.5);
362 hour
= gop_timecode
->hour
;
363 minute
= gop_timecode
->minute
;
364 second
= gop_timecode
->second
;
365 frame
= gop_timecode
->frame
;
367 result
= (long)hour
* 60 * 60 * fps
+
376 /* ======================================================================= */
378 /* ======================================================================= */
382 mpeg3video_t
* mpeg3video_new(mpeg3_t
*file
,
383 mpeg3_vtrack_t
*track
)
386 mpeg3_bits_t
*bitstream
;
387 mpeg3_demuxer_t
*demuxer
;
390 video
= mpeg3video_allocate_struct(file
, track
);
391 bitstream
= video
->vstream
;
392 demuxer
= bitstream
->demuxer
;
394 // Get encoding parameters from stream
397 result
= mpeg3video_get_header(video
, 1);
401 int hour
, minute
, second
, frame
;
404 mpeg3video_initdecoder(video
);
405 video
->decoder_initted
= 1;
406 track
->width
= video
->horizontal_size
;
407 track
->height
= video
->vertical_size
;
408 track
->frame_rate
= video
->frame_rate
;
410 /* Try to get the length of the file from GOP's */
411 if(!track
->frame_offsets
)
413 if(file
->is_video_stream
)
415 /* Load the first GOP */
416 mpeg3_rewind_video(video
);
417 result
= mpeg3video_next_code(bitstream
,
418 MPEG3_GOP_START_CODE
);
419 if(!result
) mpeg3bits_getbits(bitstream
, 32);
420 if(!result
) result
= mpeg3video_getgophdr(video
);
422 hour
= video
->gop_timecode
.hour
;
423 minute
= video
->gop_timecode
.minute
;
424 second
= video
->gop_timecode
.second
;
425 frame
= video
->gop_timecode
.frame
;
427 video
->first_frame
= gop_to_frame(video
, &video
->gop_timecode
);
430 * video->first_frame = (long)(hour * 3600 * video->frame_rate +
431 * minute * 60 * video->frame_rate +
432 * second * video->frame_rate +
436 /* GOPs are supposed to have 16 frames */
438 video
->frames_per_gop
= 16;
440 /* Read the last GOP in the file by seeking backward. */
441 mpeg3demux_seek_byte(demuxer
,
442 mpeg3demux_movie_size(demuxer
));
443 mpeg3demux_start_reverse(demuxer
);
444 result
= mpeg3video_prev_code(demuxer
,
445 MPEG3_GOP_START_CODE
);
446 mpeg3demux_start_forward(demuxer
);
450 mpeg3bits_reset(bitstream
);
451 mpeg3bits_getbits(bitstream
, 8);
452 if(!result
) result
= mpeg3video_getgophdr(video
);
454 hour
= video
->gop_timecode
.hour
;
455 minute
= video
->gop_timecode
.minute
;
456 second
= video
->gop_timecode
.second
;
457 frame
= video
->gop_timecode
.frame
;
459 video
->last_frame
= gop_to_frame(video
, &video
->gop_timecode
);
462 * video->last_frame = (long)((double)hour * 3600 * video->frame_rate +
463 * minute * 60 * video->frame_rate +
464 * second * video->frame_rate +
468 //printf("mpeg3video_new 3 %p\n", video);
470 /* Count number of frames to end */
473 result
= mpeg3video_next_code(bitstream
, MPEG3_PICTURE_START_CODE
);
476 mpeg3bits_getbyte_noptr(bitstream
);
481 track
->total_frames
= video
->last_frame
- video
->first_frame
+ 1;
482 //printf("mpeg3video_new 3 %ld\n", track->total_frames);
483 mpeg3_rewind_video(video
);
486 // Try to get the length of the file from the multiplexing.
487 // Need a table of contents
490 * video->first_frame = 0;
491 * track->total_frames = video->last_frame =
492 * (long)(mpeg3demux_length(video->vstream->demuxer) *
493 * video->frame_rate);
494 * video->first_frame = 0;
499 // Get length from table of contents
501 track
->total_frames
= track
->total_frame_offsets
;
506 video
->maxframe
= track
->total_frames
;
507 video
->repeat_count
= 0;
508 mpeg3_rewind_video(video
);
509 mpeg3video_get_firstframe(video
);
513 mpeg3video_delete(video
);
521 int mpeg3video_delete(mpeg3video_t
*video
)
523 if(video
->decoder_initted
)
525 mpeg3video_deletedecoder(video
);
527 mpeg3video_delete_struct(video
);
531 int mpeg3video_set_cpus(mpeg3video_t
*video
, int cpus
)
536 int mpeg3video_set_mmx(mpeg3video_t
*video
, int use_mmx
)
538 mpeg3video_init_scantables(video
);
542 /* Read all the way up to and including the next picture start code */
543 int mpeg3video_read_raw(mpeg3video_t
*video
,
544 unsigned char *output
,
549 mpeg3_bits_t
*vstream
= video
->vstream
;
552 while(code
!= MPEG3_PICTURE_START_CODE
&&
553 code
!= MPEG3_SEQUENCE_END_CODE
&&
555 !mpeg3bits_eof(vstream
))
558 *output
= mpeg3bits_getbyte_noptr(vstream
);
562 return mpeg3bits_eof(vstream
);
576 int mpeg3video_read_frame(mpeg3video_t
*video
,
577 unsigned char **output_rows
,
587 mpeg3_vtrack_t
*track
= video
->track
;
590 video
->output_rows
= output_rows
;
591 video
->color_model
= color_model
;
593 /* Get scaling tables */
594 if(video
->out_w
!= out_w
|| video
->out_h
!= out_h
||
595 video
->in_w
!= in_w
|| video
->in_h
!= in_h
||
596 video
->in_x
!= in_x
|| video
->in_y
!= in_y
)
600 free(video
->x_table
);
601 free(video
->y_table
);
607 video
->out_w
= out_w
;
608 video
->out_h
= out_h
;
616 video
->x_table
= mpeg3video_get_scaletable(video
->in_w
, video
->out_w
);
617 video
->y_table
= mpeg3video_get_scaletable(video
->in_h
, video
->out_h
);
619 //printf("mpeg3video_read_frame 1 %d\n", video->framenum);
622 // Recover from cache
623 unsigned char *y
, *u
, *v
;
624 int frame_number
= video
->frame_seek
>= 0 ? video
->frame_seek
: video
->framenum
;
625 if(mpeg3_cache_get_frame(track
->frame_cache
,
631 //printf("mpeg3video_read_frame 1 %d\n", frame_number);
632 // Swap output data for cache data
633 unsigned char *temp
[3];
634 temp
[0] = video
->output_src
[0];
635 temp
[1] = video
->output_src
[1];
636 temp
[2] = video
->output_src
[2];
638 video
->output_src
[0] = y
;
639 video
->output_src
[1] = u
;
640 video
->output_src
[2] = v
;
641 // Transfer with cropping
642 if(video
->output_src
[0]) mpeg3video_present_frame(video
);
643 video
->output_src
[0] = temp
[0];
644 video
->output_src
[1] = temp
[1];
645 video
->output_src
[2] = temp
[2];
647 // Advance either framenum or frame_seek
648 if(frame_number
== video
->framenum
)
649 video
->framenum
= ++frame_number
;
651 if(frame_number
== video
->frame_seek
)
652 video
->frame_seek
= ++frame_number
;
657 // Only decode if it's a different frame
658 if(video
->frame_seek
< 0 ||
659 video
->last_number
< 0 ||
660 video
->frame_seek
!= video
->last_number
)
662 if(!result
) result
= mpeg3video_seek(video
);
663 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
667 video
->framenum
= video
->frame_seek
+ 1;
668 video
->last_number
= video
->frame_seek
;
669 video
->frame_seek
= -1;
672 if(video
->output_src
[0]) mpeg3video_present_frame(video
);
678 int mpeg3video_read_yuvframe(mpeg3video_t
*video
,
688 mpeg3_vtrack_t
*track
= video
->track
;
690 //printf("mpeg3video_read_yuvframe 1 %d\n", video->framenum);
692 video
->y_output
= y_output
;
693 video
->u_output
= u_output
;
694 video
->v_output
= v_output
;
701 // Recover from cache if framenum exists
702 unsigned char *y
, *u
, *v
;
703 int frame_number
= video
->frame_seek
>= 0 ? video
->frame_seek
: video
->framenum
;
705 if(mpeg3_cache_get_frame(track
->frame_cache
, frame_number
, &y
, &u
, &v
))
707 int chroma_denominator
;
711 //printf("mpeg3video_read_yuvframe 1 %d\n", frame_number);
712 if(video
->chroma_format
== CHROMA420
)
713 chroma_denominator
= 2;
715 chroma_denominator
= 1;
716 size0
= video
->coded_picture_width
* video
->in_h
;
717 size1
= video
->chrom_width
* (int)((float)video
->in_h
/ chroma_denominator
+ 0.5);
720 // Swap output data for cache data
721 unsigned char *temp
[3];
722 temp
[0] = video
->output_src
[0];
723 temp
[1] = video
->output_src
[1];
724 temp
[2] = video
->output_src
[2];
726 video
->output_src
[0] = y
;
727 video
->output_src
[1] = u
;
728 video
->output_src
[2] = v
;
729 // Transfer with cropping
730 if(video
->output_src
[0]) mpeg3video_present_frame(video
);
731 video
->output_src
[0] = temp
[0];
732 video
->output_src
[1] = temp
[1];
733 video
->output_src
[2] = temp
[2];
735 // Advance either framenum or frame_seek
736 if(frame_number
== video
->framenum
)
737 video
->framenum
= ++frame_number
;
739 if(frame_number
== video
->frame_seek
)
740 video
->frame_seek
= ++frame_number
;
744 if(!result
) result
= mpeg3video_seek(video
);
745 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
746 if(video
->output_src
[0]) mpeg3video_present_frame(video
);
753 video
->byte_seek
= -1;
757 int mpeg3video_read_yuvframe_ptr(mpeg3video_t
*video
,
763 mpeg3_vtrack_t
*track
= video
->track
;
767 *y_output
= *u_output
= *v_output
= 0;
769 unsigned char *y
, *u
, *v
;
770 int frame_number
= video
->frame_seek
>= 0 ? video
->frame_seek
: video
->framenum
;
771 if(mpeg3_cache_get_frame(track
->frame_cache
, frame_number
, &y
, &u
, &v
))
773 *y_output
= (char*)y
;
774 *u_output
= (char*)u
;
775 *v_output
= (char*)v
;
777 // Advance either framenum or frame_seek
778 if(frame_number
== video
->framenum
)
779 video
->framenum
= ++frame_number
;
781 if(frame_number
== video
->frame_seek
)
782 video
->frame_seek
= ++frame_number
;
785 // Only decode if it's a different frame
786 if(video
->frame_seek
< 0 ||
787 video
->last_number
< 0 ||
788 video
->frame_seek
!= video
->last_number
)
790 if(!result
) result
= mpeg3video_seek(video
);
791 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
793 if(video
->output_src
[0])
795 *y_output
= (char*)video
->output_src
[0];
796 *u_output
= (char*)video
->output_src
[1];
797 *v_output
= (char*)video
->output_src
[2];
802 video
->framenum
= video
->frame_seek
+ 1;
803 video
->last_number
= video
->frame_seek
;
804 video
->frame_seek
= -1;
806 if(video
->output_src
[0])
808 *y_output
= (char*)video
->output_src
[0];
809 *u_output
= (char*)video
->output_src
[1];
810 *v_output
= (char*)video
->output_src
[2];
816 // Caching not used if byte seek
817 video
->byte_seek
= -1;
823 int mpeg3video_colormodel(mpeg3video_t
*video
)
825 switch(video
->chroma_format
)
828 return MPEG3_YUV422P
;
832 return MPEG3_YUV420P
;
836 return MPEG3_YUV420P
;
839 void mpeg3video_dump(mpeg3video_t
*video
)
841 printf("mpeg3video_dump 1\n");
842 printf(" *** sequence extension 1\n");
843 printf("prog_seq=%d\n", video
->prog_seq
);
844 printf(" *** picture header 1\n");
845 printf("pict_type=%d field_sequence=%d\n", video
->pict_type
, video
->field_sequence
);
846 printf(" *** picture coding extension 1\n");
847 printf("field_sequence=%d repeatfirst=%d prog_frame=%d pict_struct=%d\n",
848 video
->field_sequence
,