1 #include "../libmpeg3.h"
2 #include "../mpeg3private.h"
3 #include "../mpeg3protos.h"
4 #include "mpeg3video.h"
5 #include "mpeg3videoprotos.h"
9 // "½Åµ¿ÈÆ" <doogle@shinbiro.com>
11 unsigned char mpeg3_zig_zag_scan_mmx
[64] =
13 0*8+0 /* 0*/, 1*8+0 /* 1*/, 0*8+1 /* 8*/, 0*8+2 /*16*/, 1*8+1 /* 9*/, 2*8+0 /* 2*/, 3*8+0 /* 3*/, 2*8+1 /*10*/,
14 1*8+2 /*17*/, 0*8+3 /*24*/, 0*8+4 /*32*/, 1*8+3 /*25*/, 2*8+2 /*18*/, 3*8+1 /*11*/, 4*8+0 /* 4*/, 5*8+0 /* 5*/,
15 4*8+1 /*12*/, 3*8+2 /*19*/, 2*8+3 /*26*/, 1*8+4 /*33*/, 0*8+5 /*40*/, 0*8+6 /*48*/, 1*8+5 /*41*/, 2*8+4 /*34*/,
16 3*8+3 /*27*/, 4*8+2 /*20*/, 5*8+1 /*13*/, 6*8+0 /* 6*/, 7*8+0 /* 7*/, 6*8+1 /*14*/, 5*8+2 /*21*/, 4*8+3 /*28*/,
17 3*8+4 /*35*/, 2*8+5 /*42*/, 1*8+6 /*49*/, 0*8+7 /*56*/, 1*8+7 /*57*/, 2*8+6 /*50*/, 3*8+5 /*43*/, 4*8+4 /*36*/,
18 5*8+3 /*29*/, 6*8+2 /*22*/, 7*8+1 /*15*/, 7*8+2 /*23*/, 6*8+3 /*30*/, 5*8+4 /*37*/, 4*8+5 /*44*/, 3*8+6 /*51*/,
19 2*8+7 /*58*/, 3*8+7 /*59*/, 4*8+6 /*52*/, 5*8+5 /*45*/, 6*8+4 /*38*/, 7*8+3 /*31*/, 7*8+4 /*39*/, 6*8+5 /*46*/,
20 5*8+6 /*53*/, 4*8+7 /*60*/, 5*8+7 /*61*/, 6*8+6 /*54*/, 7*8+5 /*47*/, 7*8+6 /*55*/, 6*8+7 /*62*/, 7*8+7 /*63*/
24 unsigned char mpeg3_alternate_scan_mmx
[64] =
26 0*8+0 /*0 */, 0*8+1 /* 8*/, 0*8+2 /*16*/, 0*8+3 /*24*/, 1*8+0 /* 1*/, 1*8+1 /* 9*/, 2*8+0 /* 2*/, 2*8+1 /*10*/,
27 1*8+2 /*17*/, 1*8+3 /*25*/, 0*8+4 /*32*/, 0*8+5 /*40*/, 0*8+6 /*48*/, 0*8+7 /*56*/, 1*8+7 /*57*/, 1*8+6 /*49*/,
28 1*8+5 /*41*/, 1*8+4 /*33*/, 2*8+3 /*26*/, 2*8+2 /*18*/, 3*8+0 /* 3*/, 3*8+1 /*11*/, 4*8+0 /* 4*/, 4*8+1 /*12*/,
29 3*8+2 /*19*/, 3*8+3 /*27*/, 2*8+4 /*34*/, 2*8+5 /*42*/, 2*8+6 /*50*/, 2*8+7 /*58*/, 3*8+4 /*35*/, 3*8+5 /*43*/,
30 3*8+6 /*51*/, 3*8+7 /*59*/, 4*8+2 /*20*/, 4*8+3 /*28*/, 5*8+0 /* 5*/, 5*8+1 /*13*/, 6*8+0 /* 6*/, 6*8+1 /*14*/,
31 5*8+2 /*21*/, 5*8+3 /*29*/, 4*8+4 /*36*/, 4*8+5 /*44*/, 4*8+6 /*52*/, 4*8+7 /*60*/, 5*8+4 /*37*/, 5*8+5 /*45*/,
32 5*8+6 /*53*/, 5*8+7 /*61*/, 6*8+2 /*22*/, 6*8+3 /*30*/, 7*8+0 /* 7*/, 7*8+1 /*15*/, 7*8+2 /*23*/, 7*8+3 /*31*/,
33 6*8+4 /*38*/, 6*8+5 /*46*/, 6*8+6 /*54*/, 6*8+7 /*62*/, 7*8+4 /*39*/, 7*8+5 /*47*/, 7*8+6 /*55*/, 7*8+7 /*63*/
38 unsigned char mpeg3_zig_zag_scan_nommx
[64] =
40 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
41 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
42 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
43 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
47 unsigned char mpeg3_alternate_scan_nommx
[64] =
49 0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
50 41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
51 51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
52 53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
55 /* default intra quantization matrix */
56 unsigned char mpeg3_default_intra_quantizer_matrix
[64] =
58 8, 16, 19, 22, 26, 27, 29, 34,
59 16, 16, 22, 24, 27, 29, 34, 37,
60 19, 22, 26, 27, 29, 34, 34, 38,
61 22, 22, 26, 27, 29, 34, 37, 40,
62 22, 26, 27, 29, 32, 35, 40, 48,
63 26, 27, 29, 32, 35, 40, 48, 58,
64 26, 27, 29, 34, 38, 46, 56, 69,
65 27, 29, 35, 38, 46, 56, 69, 83
68 unsigned char mpeg3_non_linear_mquant_table
[32] =
70 0, 1, 2, 3, 4, 5, 6, 7,
71 8, 10, 12, 14, 16, 18, 20, 22,
72 24, 28, 32, 36, 40, 44, 48, 52,
73 56, 64, 72, 80, 88, 96, 104, 112
76 double mpeg3_frame_rate_table
[16] =
79 (double)24000.0/1001.0, /* Official frame rates */
82 (double)30000.0/1001.0,
85 (double)60000.0/1001.0,
88 1, /* Unofficial economy rates */
97 int mpeg3video_initdecoder(mpeg3video_t
*video
)
99 int blk_cnt_tab
[3] = {6, 8, 12};
102 long size
[4], padding
[2]; /* Size of Y, U, and V buffers */
106 /* force MPEG-1 parameters */
108 video
->prog_frame
= 1;
109 video
->pict_struct
= FRAME_PICTURE
;
110 video
->frame_pred_dct
= 1;
111 video
->chroma_format
= CHROMA420
;
112 video
->matrix_coefficients
= 5;
115 /* Get dimensions rounded to nearest multiple of coded macroblocks */
116 video
->mb_width
= (video
->horizontal_size
+ 15) / 16;
117 video
->mb_height
= (video
->mpeg2
&& !video
->prog_seq
) ?
118 (2 * ((video
->vertical_size
+ 31) / 32)) :
119 ((video
->vertical_size
+ 15) / 16);
120 video
->coded_picture_width
= 16 * video
->mb_width
;
121 video
->coded_picture_height
= 16 * video
->mb_height
;
122 video
->chrom_width
= (video
->chroma_format
== CHROMA444
) ?
123 video
->coded_picture_width
:
124 (video
->coded_picture_width
>> 1);
125 video
->chrom_height
= (video
->chroma_format
!= CHROMA420
) ?
126 video
->coded_picture_height
:
127 (video
->coded_picture_height
>> 1);
128 video
->blk_cnt
= blk_cnt_tab
[video
->chroma_format
- 1];
130 /* Get sizes of YUV buffers */
131 padding
[0] = 16 * video
->coded_picture_width
;
132 size
[0] = video
->coded_picture_width
* video
->coded_picture_height
+ padding
[0] * 2;
134 padding
[1] = 16 * video
->chrom_width
;
135 size
[1] = video
->chrom_width
* video
->chrom_height
+ 2 * padding
[1];
137 size
[2] = (video
->llw
* video
->llh
);
138 size
[3] = (video
->llw
* video
->llh
) / 4;
140 /* Allocate contiguous fragments for YUV buffers for hardware YUV decoding */
141 video
->yuv_buffer
[0] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
142 video
->yuv_buffer
[1] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
143 video
->yuv_buffer
[2] = (unsigned char*)calloc(1, (size
[0] + padding
[0]) + 2 * (size
[1] + padding
[1]));
145 if(video
->scalable_mode
== SC_SPAT
)
147 video
->yuv_buffer
[3] = (unsigned char*)calloc(1, size
[2] + 2 * size
[3]);
148 video
->yuv_buffer
[4] = (unsigned char*)calloc(1, size
[2] + 2 * size
[3]);
151 /* Direct pointers to areas of contiguous fragments in YVU order per Microsoft */
152 for(cc
= 0; cc
< 3; cc
++)
154 video
->llframe0
[cc
] = 0;
155 video
->llframe1
[cc
] = 0;
156 video
->newframe
[cc
] = 0;
159 video
->refframe
[0] = video
->yuv_buffer
[0];
160 video
->oldrefframe
[0] = video
->yuv_buffer
[1];
161 video
->auxframe
[0] = video
->yuv_buffer
[2];
162 video
->refframe
[2] = video
->yuv_buffer
[0] + size
[0] + padding
[0];
163 video
->oldrefframe
[2] = video
->yuv_buffer
[1] + size
[0] + padding
[0];
164 video
->auxframe
[2] = video
->yuv_buffer
[2] + size
[0] + padding
[0];
165 video
->refframe
[1] = video
->yuv_buffer
[0] + size
[0] + padding
[0] + size
[1] + padding
[1];
166 video
->oldrefframe
[1] = video
->yuv_buffer
[1] + size
[0] + padding
[0] + size
[1] + padding
[1];
167 video
->auxframe
[1] = video
->yuv_buffer
[2] + size
[0] + padding
[0] + size
[1] + padding
[1];
169 if(video
->scalable_mode
== SC_SPAT
)
171 /* this assumes lower layer is 4:2:0 */
172 video
->llframe0
[0] = video
->yuv_buffer
[3] + padding
[0] ;
173 video
->llframe1
[0] = video
->yuv_buffer
[4] + padding
[0] ;
174 video
->llframe0
[2] = video
->yuv_buffer
[3] + padding
[1] + size
[2] ;
175 video
->llframe1
[2] = video
->yuv_buffer
[4] + padding
[1] + size
[2] ;
176 video
->llframe0
[1] = video
->yuv_buffer
[3] + padding
[1] + size
[2] + size
[3];
177 video
->llframe1
[1] = video
->yuv_buffer
[4] + padding
[1] + size
[2] + size
[3];
180 /* Initialize the YUV tables for software YUV decoding */
181 video
->cr_to_r
= malloc(sizeof(long) * 256);
182 video
->cr_to_g
= malloc(sizeof(long) * 256);
183 video
->cb_to_g
= malloc(sizeof(long) * 256);
184 video
->cb_to_b
= malloc(sizeof(long) * 256);
185 video
->cr_to_r_ptr
= video
->cr_to_r
+ 128;
186 video
->cr_to_g_ptr
= video
->cr_to_g
+ 128;
187 video
->cb_to_g_ptr
= video
->cb_to_g
+ 128;
188 video
->cb_to_b_ptr
= video
->cb_to_b
+ 128;
190 for(i
= -128; i
< 128; i
++)
192 video
->cr_to_r_ptr
[i
] = (long)( 1.371 * 65536 * i
);
193 video
->cr_to_g_ptr
[i
] = (long)(-0.698 * 65536 * i
);
194 video
->cb_to_g_ptr
[i
] = (long)(-0.336 * 65536 * i
);
195 video
->cb_to_b_ptr
[i
] = (long)( 1.732 * 65536 * i
);
201 int mpeg3video_deletedecoder(mpeg3video_t
*video
)
205 free(video
->yuv_buffer
[0]);
206 free(video
->yuv_buffer
[1]);
207 free(video
->yuv_buffer
[2]);
209 if(video
->llframe0
[0])
211 free(video
->yuv_buffer
[3]);
212 free(video
->yuv_buffer
[4]);
215 free(video
->cr_to_r
);
216 free(video
->cr_to_g
);
217 free(video
->cb_to_g
);
218 free(video
->cb_to_b
);
222 void mpeg3video_init_scantables(mpeg3video_t
*video
)
227 video
->mpeg3_zigzag_scan_table
= mpeg3_zig_zag_scan_mmx
;
228 video
->mpeg3_alternate_scan_table
= mpeg3_alternate_scan_mmx
;
233 video
->mpeg3_zigzag_scan_table
= mpeg3_zig_zag_scan_nommx
;
234 video
->mpeg3_alternate_scan_table
= mpeg3_alternate_scan_nommx
;
238 mpeg3video_t
* mpeg3video_allocate_struct(mpeg3_t
*file
, mpeg3_vtrack_t
*track
)
241 mpeg3video_t
*video
= calloc(1, sizeof(mpeg3video_t
));
242 pthread_mutexattr_t mutex_attr
;
245 video
->track
= track
;
246 video
->vstream
= mpeg3bits_new_stream(file
, track
->demuxer
);
247 //printf("mpeg3video_allocate_struct %d\n", mpeg3bits_eof(video->vstream));
248 video
->last_number
= -1;
250 /* First frame is all green */
251 video
->framenum
= -1;
252 video
->have_mmx
= file
->have_mmx
;
254 video
->percentage_seek
= -1;
255 video
->frame_seek
= -1;
257 mpeg3video_init_scantables(video
);
258 mpeg3video_init_output();
260 pthread_mutexattr_init(&mutex_attr
);
261 // pthread_mutexattr_setkind_np(&mutex_attr, PTHREAD_MUTEX_FAST_NP);
262 pthread_mutex_init(&(video
->test_lock
), &mutex_attr
);
263 pthread_mutex_init(&(video
->slice_lock
), &mutex_attr
);
267 int mpeg3video_delete_struct(mpeg3video_t
*video
)
270 mpeg3bits_delete_stream(video
->vstream
);
271 pthread_mutex_destroy(&(video
->test_lock
));
272 pthread_mutex_destroy(&(video
->slice_lock
));
275 free(video
->x_table
);
276 free(video
->y_table
);
278 if(video
->total_slice_decoders
)
280 for(i
= 0; i
< video
->total_slice_decoders
; i
++)
281 mpeg3_delete_slice_decoder(&(video
->slice_decoders
[i
]));
283 for(i
= 0; i
< video
->slice_buffers_initialized
; i
++)
284 mpeg3_delete_slice_buffer(&(video
->slice_buffers
[i
]));
291 int mpeg3video_read_frame_backend(mpeg3video_t
*video
, int skip_bframes
)
294 int got_top
= 0, got_bottom
= 0;
297 //printf(__FUNCTION__ " 1\n");
300 if(mpeg3bits_eof(video
->vstream
)) result
= 1;
301 //printf(__FUNCTION__ " 1.1\n");
303 if(!result
) result
= mpeg3video_get_header(video
, 0);
304 //printf(__FUNCTION__ " 1\n");
307 /* skip_bframes is the number of bframes we can skip successfully. */
308 /* This is in case a skipped B-frame is repeated and the second repeat happens */
309 /* to be a B frame we need. */
310 video
->skip_bframes
= skip_bframes
;
311 //printf(__FUNCTION__ " 1\n");
314 result
= mpeg3video_getpicture(video
, video
->framenum
);
316 //printf(__FUNCTION__ " 1\n");
318 if(video
->pict_struct
== TOP_FIELD
)
323 if(video
->pict_struct
== BOTTOM_FIELD
)
326 video
->secondfield
= 0;
329 if(video
->pict_struct
== FRAME_PICTURE
)
331 got_top
= got_bottom
= 1;
333 //printf(__FUNCTION__ " 2\n");
338 video
->framenum
>= 0);
339 // The way they do field based encoding,
340 // the I frames have the top field but both the I frame and
341 // subsequent P frame make the keyframe.
343 //printf(__FUNCTION__ " 3 %d %d\n", video->pict_type, video->pict_struct);
347 __asm__
__volatile__ ("emms");
352 video
->last_number
= video
->framenum
;
355 //printf(__FUNCTION__ " 100\n");
360 int* mpeg3video_get_scaletable(int input_w
, int output_w
)
362 int *result
= malloc(sizeof(int) * output_w
);
364 float scale
= (float)input_w
/ output_w
;
365 for(i
= 0; i
< output_w
; i
++)
367 result
[(int)i
] = (int)(scale
* i
);
372 /* Get the first I frame. */
373 int mpeg3video_get_firstframe(mpeg3video_t
*video
)
376 video
->repeat_count
= video
->current_repeat
= 0;
377 result
= mpeg3video_read_frame_backend(video
, 0);
381 static long gop_to_frame(mpeg3video_t
*video
, mpeg3_timecode_t
*gop_timecode
)
383 int hour
, minute
, second
, frame
, fps
;
386 // Mirror of what mpeg2enc does
387 fps
= (int)(video
->frame_rate
+ 0.5);
390 hour
= gop_timecode
->hour
;
391 minute
= gop_timecode
->minute
;
392 second
= gop_timecode
->second
;
393 frame
= gop_timecode
->frame
;
395 result
= (long)hour
* 60 * 60 * fps
+
404 /* ======================================================================= */
406 /* ======================================================================= */
410 mpeg3video_t
* mpeg3video_new(mpeg3_t
*file
, mpeg3_vtrack_t
*track
)
415 video
= mpeg3video_allocate_struct(file
, track
);
417 //printf("mpeg3video_new 1 %llx %llx\n", mpeg3bits_tell(video->vstream), mpeg3demux_tell(track->demuxer));
418 result
= mpeg3video_get_header(video
, 1);
419 //printf("mpeg3video_new 2 %d\n", result);
423 int hour
, minute
, second
, frame
;
426 mpeg3video_initdecoder(video
);
427 video
->decoder_initted
= 1;
428 track
->width
= video
->horizontal_size
;
429 track
->height
= video
->vertical_size
;
430 track
->frame_rate
= video
->frame_rate
;
432 /* Try to get the length of the file from GOP's */
433 if(!track
->frame_offsets
)
435 if(file
->is_video_stream
)
437 /* Load the first GOP */
438 mpeg3bits_seek_start(video
->vstream
);
439 result
= mpeg3video_next_code(video
->vstream
, MPEG3_GOP_START_CODE
);
440 if(!result
) mpeg3bits_getbits(video
->vstream
, 32);
441 if(!result
) result
= mpeg3video_getgophdr(video
);
443 hour
= video
->gop_timecode
.hour
;
444 minute
= video
->gop_timecode
.minute
;
445 second
= video
->gop_timecode
.second
;
446 frame
= video
->gop_timecode
.frame
;
448 video
->first_frame
= gop_to_frame(video
, &video
->gop_timecode
);
451 * video->first_frame = (long)(hour * 3600 * video->frame_rate +
452 * minute * 60 * video->frame_rate +
453 * second * video->frame_rate +
457 /* GOPs are supposed to have 16 frames */
459 video
->frames_per_gop
= 16;
461 /* Read the last GOP in the file by seeking backward. */
462 mpeg3bits_seek_end(video
->vstream
);
463 mpeg3bits_start_reverse(video
->vstream
);
464 result
= mpeg3video_prev_code(video
->vstream
, MPEG3_GOP_START_CODE
);
465 mpeg3bits_start_forward(video
->vstream
);
466 mpeg3bits_getbits(video
->vstream
, 8);
467 if(!result
) result
= mpeg3video_getgophdr(video
);
469 hour
= video
->gop_timecode
.hour
;
470 minute
= video
->gop_timecode
.minute
;
471 second
= video
->gop_timecode
.second
;
472 frame
= video
->gop_timecode
.frame
;
474 video
->last_frame
= gop_to_frame(video
, &video
->gop_timecode
);
477 * video->last_frame = (long)((double)hour * 3600 * video->frame_rate +
478 * minute * 60 * video->frame_rate +
479 * second * video->frame_rate +
483 //printf("mpeg3video_new 3 %p\n", video);
485 /* Count number of frames to end */
488 result
= mpeg3video_next_code(video
->vstream
, MPEG3_PICTURE_START_CODE
);
489 //printf("mpeg3video_new 2 %d %ld\n", result, video->last_frame);
492 mpeg3bits_getbyte_noptr(video
->vstream
);
497 track
->total_frames
= video
->last_frame
- video
->first_frame
+ 1;
498 //printf("mpeg3video_new 3 %ld\n", track->total_frames);
499 mpeg3bits_seek_start(video
->vstream
);
502 // Try to get the length of the file from the multiplexing.
504 video
->first_frame
= 0;
505 track
->total_frames
= video
->last_frame
=
506 (long)(mpeg3demux_length(video
->vstream
->demuxer
) *
508 video
->first_frame
= 0;
512 // Get length from table of contents
514 track
->total_frames
= track
->total_frame_offsets
;
519 video
->maxframe
= track
->total_frames
;
520 mpeg3bits_seek_start(video
->vstream
);
521 mpeg3video_get_firstframe(video
);
525 //printf("mpeg3video_new 3 %p\n", video);
526 mpeg3video_delete(video
);
529 //printf("mpeg3video_new 100 %p\n", video);
534 int mpeg3video_delete(mpeg3video_t
*video
)
536 if(video
->decoder_initted
)
538 mpeg3video_deletedecoder(video
);
540 mpeg3video_delete_struct(video
);
544 int mpeg3video_set_cpus(mpeg3video_t
*video
, int cpus
)
549 int mpeg3video_set_mmx(mpeg3video_t
*video
, int use_mmx
)
551 video
->have_mmx
= use_mmx
;
552 mpeg3video_init_scantables(video
);
556 /* Read all the way up to and including the next picture start code */
557 int mpeg3video_read_raw(mpeg3video_t
*video
, unsigned char *output
, long *size
, long max_size
)
560 mpeg3_bits_t
*vstream
= video
->vstream
;
563 while(code
!= MPEG3_PICTURE_START_CODE
&&
564 code
!= MPEG3_SEQUENCE_END_CODE
&&
566 !mpeg3bits_eof(vstream
))
569 *output
= mpeg3bits_getbyte_noptr(vstream
);
573 return mpeg3bits_eof(vstream
);
576 int mpeg3video_read_frame(mpeg3video_t
*video
,
578 unsigned char **output_rows
,
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
);
620 //printf("mpeg3video_read_frame 3\n");
621 if(!result
) result
= mpeg3video_seek(video
);
623 //printf("mpeg3video_read_frame 4\n");
624 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
626 //printf("mpeg3video_read_frame 5\n");
627 if(video
->output_src
) mpeg3video_present_frame(video
);
629 video
->percentage_seek
= -1;
633 int mpeg3video_read_yuvframe(mpeg3video_t
*video
,
646 video
->y_output
= y_output
;
647 video
->u_output
= u_output
;
648 video
->v_output
= v_output
;
654 if(!result
) result
= mpeg3video_seek(video
);
656 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
658 if(video
->output_src
) mpeg3video_present_frame(video
);
661 video
->percentage_seek
= -1;
665 int mpeg3video_read_yuvframe_ptr(mpeg3video_t
*video
,
672 //printf("mpeg3video_read_yuvframe_ptr 1\n");
676 if(!result
) result
= mpeg3video_seek(video
);
677 //printf("mpeg3video_read_yuvframe_ptr 10\n");
679 if(!result
) result
= mpeg3video_read_frame_backend(video
, 0);
680 //printf("mpeg3video_read_yuvframe_ptr 20 %p\n", video->output_src);
683 *y_output
= video
->output_src
[0];
684 *u_output
= video
->output_src
[1];
685 *v_output
= video
->output_src
[2];
688 video
->percentage_seek
= -1;
690 //printf("mpeg3video_read_yuvframe_ptr 100\n");
695 int mpeg3video_colormodel(mpeg3video_t
*video
)
697 switch(video
->chroma_format
)
700 return MPEG3_YUV422P
;
704 return MPEG3_YUV420P
;
708 return MPEG3_YUV420P
;
711 void mpeg3video_dump(mpeg3video_t
*video
)
713 printf("mpeg3video_dump 1\n");
714 printf(" *** sequence extension 1\n");
715 printf("prog_seq=%d\n", video
->prog_seq
);
716 printf(" *** picture header 1\n");
717 printf("pict_type=%d field_sequence=%d\n", video
->pict_type
, video
->field_sequence
);
718 printf(" *** picture coding extension 1\n");
719 printf("field_sequence=%d repeatfirst=%d prog_frame=%d pict_struct=%d\n",
720 video
->field_sequence
,