1 #include "../libzmpeg3.h"
3 zslice_buffer_t *zvideo_t::
7 while( avail_slice_buffers == 0 ) {
13 zslice_buffer_t *buffer = avail_slice_buffers;
14 avail_slice_buffers = buffer->next;
16 buffer->buffer_position = 0;
17 buffer->bits_size = 0;
18 buffer->buffer_size = 0;
19 if( !slice_active_locked++ )
26 put_slice_buffer(zslice_buffer_t* buffer)
29 buffer->next = avail_slice_buffers;
30 avail_slice_buffers = buffer;
31 if( slice_wait_locked ) {
35 if( !--slice_active_locked )
36 slice_active.unlock();
41 /* decode all macroblocks of the current picture */
46 /* Load every slice into a buffer array */
48 zcode = vstream->show_bits32_noptr();
49 if( zcode < SLICE_MIN_START || zcode > SLICE_MAX_START ) break;
50 zslice_buffer_t *slice = get_slice_buffer();
51 slice->fill_buffer(vstream);
52 src->decode_slice(slice);
55 slice_active.unlock();
60 display_second_field()
62 return 0; /* Not used */
65 /* decode one frame or field picture */
71 if( pict_type != pic_type_B ) {
73 for( int i=0; i<3; ++i ) {
75 uint8_t *tmp = oldrefframe[i];
76 oldrefframe[i] = refframe[i];
85 for( int i=0; i<3; ++i )
86 newframe[i] = ip_frame[i];
88 if( pict_struct == pics_BOTTOM_FIELD ) {
89 newframe[0] += coded_picture_width;
90 newframe[1] += chrom_width;
91 newframe[2] += chrom_width;
94 if( src->cpus != src->total_slice_decoders )
95 src->reallocate_slice_decoders();
96 if( 2*src->cpus != total_slice_buffers )
97 reallocate_slice_buffers();
99 int result = get_macroblocks();
101 /* Set the frame to display */
102 output_src[0] = output_src[1] = output_src[2] = 0;
104 if( !result && thumb ) {
105 switch( pict_type ) {
109 src->thumbnail_fn(src->thumbnail_priv, track->number);
116 if( !result && !skim && framenum >= 0 ) {
117 if( pict_struct == pics_FRAME_PICTURE || secondfield ) {
118 if( pict_type == pic_type_B ) {
119 output_src[0] = auxframe[0];
120 output_src[1] = auxframe[1];
121 output_src[2] = auxframe[2];
124 output_src[0] = oldrefframe[0];
125 output_src[1] = oldrefframe[1];
126 output_src[2] = oldrefframe[2];
130 display_second_field();