Doxygen Source Code Documentation
mpeg2_internal.h File Reference
Go to the source code of this file.
Define Documentation
|
|
Definition at line 207 of file mpeg2_internal.h. Referenced by mpeg2_init(). |
|
|
Definition at line 209 of file mpeg2_internal.h. Referenced by mpeg2_convert(). |
|
|
Definition at line 210 of file mpeg2_internal.h. Referenced by mpeg2_header_picture(). |
|
|
Definition at line 206 of file mpeg2_internal.h. Referenced by mpeg2_init(). |
|
|
Definition at line 208 of file mpeg2_internal.h. Referenced by mpeg2_convert(), and mpeg2_header_picture(). |
|
|
Definition at line 47 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), mpeg2_header_end(), mpeg2_header_slice_start(), mpeg2_init_fbuf(), mpeg2_set_fbuf(), and slice_init(). |
|
|
Definition at line 41 of file mpeg2_internal.h. Referenced by mpeg2_header_slice_start(), mpeg2_init_fbuf(), and picture_coding_ext(). |
|
|
Definition at line 48 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), mpeg2_slice(), and slice_intra_DCT(). |
|
|
Definition at line 30 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 42 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), mpeg2_header_sequence(), mpeg2_init_fbuf(), mpeg2_slice(), and picture_coding_ext(). |
|
|
Definition at line 45 of file mpeg2_internal.h. Referenced by get_macroblock_modes(). |
|
|
Definition at line 25 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 27 of file mpeg2_internal.h. |
|
|
Definition at line 28 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 26 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 29 of file mpeg2_internal.h. Referenced by mpeg2_slice(). |
|
|
Definition at line 36 of file mpeg2_internal.h. Referenced by mpeg2_slice(). |
|
|
Definition at line 37 of file mpeg2_internal.h. Referenced by mpeg2_slice(). |
|
|
Definition at line 34 of file mpeg2_internal.h. Referenced by mpeg2_slice(). |
|
|
Definition at line 35 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 33 of file mpeg2_internal.h. Referenced by get_macroblock_modes(). |
|
|
Definition at line 32 of file mpeg2_internal.h. Referenced by mpeg2_slice(). |
|
|
Value: mpeg2_mc_t mpeg2_mc_##x = { \ {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \ MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \ {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \ MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \ }; Definition at line 283 of file mpeg2_internal.h. |
|
|
Definition at line 46 of file mpeg2_internal.h. Referenced by get_macroblock_modes(), and mpeg2_slice(). |
|
|
Definition at line 40 of file mpeg2_internal.h. Referenced by mpeg2_header_slice_start(), and picture_coding_ext(). |
Typedef Documentation
|
|
Definition at line 276 of file mpeg2_internal.h. Referenced by motion_fi_16x8(), motion_fi_dmv(), motion_fi_field(), motion_fr_dmv(), motion_fr_field(), motion_fr_frame(), motion_mp1(), motion_reuse(), and motion_zero(). |
Function Documentation
|
|
Definition at line 106 of file cpu_state.c. References MPEG2_ACCEL_PPC_ALTIVEC, MPEG2_ACCEL_X86_MMX, mpeg2_cpu_state_restore, mpeg2_cpu_state_save, and uint32_t. Referenced by mpeg2_accel().
00107 {
00108 #ifdef ARCH_X86
00109 if (accel & MPEG2_ACCEL_X86_MMX) {
00110 mpeg2_cpu_state_restore = state_restore_mmx;
00111 }
00112 #endif
00113 #ifdef ARCH_PPC
00114 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
00115 mpeg2_cpu_state_save = state_save_altivec;
00116 mpeg2_cpu_state_restore = state_restore_altivec;
00117 }
00118 #endif
00119 }
|
|
|
Definition at line 161 of file cpu_accel.c. References MPEG2_ACCEL_MLIB, and uint32_t. Referenced by mpeg2_accel().
00162 {
00163 uint32_t accel;
00164
00165 accel = 0;
00166 #ifdef ACCEL_DETECT
00167 #ifdef LIBMPEG2_MLIB
00168 accel = MPEG2_ACCEL_MLIB;
00169 #endif
00170 #if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA)
00171 accel |= arch_accel ();
00172 #endif
00173 #endif
00174 return accel;
00175 }
|
|
|
Definition at line 66 of file alloc.c. References free, and mpeg2_free_hook. Referenced by mpeg2_close().
00067 {
00068 if (mpeg2_free_hook && mpeg2_free_hook (buf))
00069 return;
00070
00071 #if defined(HAVE_MEMALIGN) && !defined(__cplusplus) && !defined(DEBUG)
00072 free (buf);
00073 #else
00074 free (*(((void **)buf) - 1));
00075 #endif
00076 }
|
|
|
|
Definition at line 588 of file header.c. References mpeg2dec_s::chunk_start, copyright_ext(), mpeg2dec_s::ext_state, picture_coding_ext(), picture_display_ext(), quant_matrix_ext(), sequence_display_ext(), and sequence_ext().
00589 {
00590 static int (* parser[]) (mpeg2dec_t *) = {
00591 0, sequence_ext, sequence_display_ext, quant_matrix_ext,
00592 copyright_ext, 0, 0, picture_display_ext, picture_coding_ext
00593 };
00594 int ext, ext_bit;
00595
00596 ext = mpeg2dec->chunk_start[0] >> 4;
00597 ext_bit = 1 << ext;
00598
00599 if (!(mpeg2dec->ext_state & ext_bit))
00600 return 0; /* ignore illegal extensions */
00601 mpeg2dec->ext_state &= ~ext_bit;
00602 return parser[ext] (mpeg2dec);
00603 }
|
|
|
Definition at line 328 of file header.c. References mpeg2dec_s::info, reset_info(), mpeg2dec_s::state, and STATE_GOP.
00329 {
00330 mpeg2dec->state = STATE_GOP;
00331 reset_info (&(mpeg2dec->info));
00332 return 0;
00333 }
|
|
|
Definition at line 389 of file header.c. References ALLOC_CONVERTED, mpeg2dec_s::alloc_index, ALLOC_YUV, decoder_s::b_motion, fbuf_t::buf, mpeg2dec_s::chunk_start, decoder_s::coding_type, mpeg2dec_s::convert_size, mpeg2dec_s::convert_start, mpeg2_info_t::current_picture, mpeg2_info_t::current_picture_2nd, mpeg2dec_s::custom_fbuf, mpeg2dec_s::decoder, mpeg2_info_t::discard_fbuf, mpeg2_info_t::display_fbuf, mpeg2_info_t::display_picture, mpeg2_info_t::display_picture_2nd, mpeg2dec_s::ext_state, motion_t::f_code, decoder_s::f_motion, mpeg2dec_s::fbuf, mpeg2dec_s::fbuf_alloc, mpeg2dec_s::first, picture_t::flags, sequence_t::flags, decoder_s::height, fbuf_t::id, mpeg2dec_s::info, mpeg2_malloc(), mpeg2_set_fbuf(), picture_t::nb_fields, PIC_CODING_EXT, PIC_FLAG_CODING_TYPE_B, PIC_FLAG_CODING_TYPE_P, mpeg2dec_s::picture, mpeg2dec_s::pictures, reset_info(), decoder_s::second_field, SEQ_FLAG_LOW_DELAY, mpeg2dec_s::sequence, mpeg2dec_s::state, STATE_PICTURE, picture_t::temporal_reference, uint8_t, mpeg2_info_t::user_data, mpeg2_info_t::user_data_len, and decoder_s::width.
00390 {
00391 uint8_t * buffer = mpeg2dec->chunk_start;
00392 picture_t * picture = mpeg2dec->picture;
00393 decoder_t * decoder = &(mpeg2dec->decoder);
00394 int type;
00395 int low_delay;
00396
00397 type = (buffer [1] >> 3) & 7;
00398 low_delay = mpeg2dec->sequence.flags & SEQ_FLAG_LOW_DELAY;
00399
00400 if (mpeg2dec->state == STATE_PICTURE) {
00401 picture_t * other;
00402
00403 decoder->second_field = 0;
00404 other = mpeg2dec->pictures;
00405 if (other == picture)
00406 other += 2;
00407 if (decoder->coding_type != PIC_FLAG_CODING_TYPE_B) {
00408 mpeg2dec->fbuf[2] = mpeg2dec->fbuf[1];
00409 mpeg2dec->fbuf[1] = mpeg2dec->fbuf[0];
00410 }
00411 mpeg2dec->fbuf[0] = NULL;
00412 reset_info (&(mpeg2dec->info));
00413 mpeg2dec->info.current_picture = picture;
00414 mpeg2dec->info.display_picture = picture;
00415 if (type != PIC_FLAG_CODING_TYPE_B) {
00416 if (!low_delay) {
00417 if (mpeg2dec->first) {
00418 mpeg2dec->info.display_picture = NULL;
00419 mpeg2dec->first = 0;
00420 } else {
00421 mpeg2dec->info.display_picture = other;
00422 if (other->nb_fields == 1)
00423 mpeg2dec->info.display_picture_2nd = other + 1;
00424 mpeg2dec->info.display_fbuf = mpeg2dec->fbuf[1];
00425 }
00426 }
00427 if (!low_delay + !mpeg2dec->convert_start)
00428 mpeg2dec->info.discard_fbuf =
00429 mpeg2dec->fbuf[!low_delay + !mpeg2dec->convert_start];
00430 }
00431 if (!mpeg2dec->custom_fbuf) {
00432 while (mpeg2dec->alloc_index < 3) {
00433 fbuf_t * fbuf;
00434
00435 fbuf = &(mpeg2dec->fbuf_alloc[mpeg2dec->alloc_index++].fbuf);
00436 fbuf->id = NULL;
00437 if (mpeg2dec->convert_start) {
00438 fbuf->buf[0] =
00439 (uint8_t *) mpeg2_malloc (mpeg2dec->convert_size[0],
00440 ALLOC_CONVERTED);
00441 fbuf->buf[1] = fbuf->buf[0] + mpeg2dec->convert_size[1];
00442 fbuf->buf[2] = fbuf->buf[0] + mpeg2dec->convert_size[2];
00443 } else {
00444 int size;
00445 size = mpeg2dec->decoder.width * mpeg2dec->decoder.height;
00446 fbuf->buf[0] = (uint8_t *) mpeg2_malloc (6 * size >> 2,
00447 ALLOC_YUV);
00448 fbuf->buf[1] = fbuf->buf[0] + size;
00449 fbuf->buf[2] = fbuf->buf[1] + (size >> 2);
00450 }
00451 }
00452 mpeg2_set_fbuf (mpeg2dec, type);
00453 }
00454 } else {
00455 decoder->second_field = 1;
00456 mpeg2dec->info.current_picture_2nd = picture;
00457 mpeg2dec->info.user_data = NULL; mpeg2dec->info.user_data_len = 0;
00458 if (low_delay || type == PIC_FLAG_CODING_TYPE_B)
00459 mpeg2dec->info.display_picture_2nd = picture;
00460 }
00461 mpeg2dec->ext_state = PIC_CODING_EXT;
00462
00463 picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
00464
00465 decoder->coding_type = type;
00466 picture->flags |= type;
00467
00468 if (type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B) {
00469 /* forward_f_code and backward_f_code - used in mpeg1 only */
00470 decoder->f_motion.f_code[1] = (buffer[3] >> 2) & 1;
00471 decoder->f_motion.f_code[0] =
00472 (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
00473 decoder->b_motion.f_code[1] = (buffer[4] >> 6) & 1;
00474 decoder->b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
00475 }
00476
00477 /* XXXXXX decode extra_information_picture as well */
00478
00479 picture->nb_fields = 2;
00480
00481 return 0;
00482 }
|
|
|
Definition at line 354 of file header.c. References mpeg2dec_s::bytes_since_pts, decoder_s::coding_type, mpeg2dec_s::decoder, picture_t::display_offset, mpeg2dec_s::display_offset_x, mpeg2dec_s::display_offset_y, picture_t::flags, mpeg2_parse_header(), mpeg2dec_s::num_pts, PIC_FLAG_CODING_TYPE_B, PIC_FLAG_PTS, mpeg2dec_s::picture, mpeg2dec_s::pictures, picture_t::pts, mpeg2dec_s::pts_current, mpeg2dec_s::pts_previous, mpeg2dec_s::state, STATE_PICTURE, STATE_PICTURE_2ND, and STATE_SLICE_1ST.
00355 {
00356 decoder_t * decoder = &(mpeg2dec->decoder);
00357 picture_t * picture;
00358
00359 if (mpeg2dec->state != STATE_SLICE_1ST) {
00360 mpeg2dec->state = STATE_PICTURE;
00361 picture = mpeg2dec->pictures;
00362 if ((decoder->coding_type != PIC_FLAG_CODING_TYPE_B) ^
00363 (mpeg2dec->picture >= mpeg2dec->pictures + 2))
00364 picture += 2;
00365 } else {
00366 mpeg2dec->state = STATE_PICTURE_2ND;
00367 picture = mpeg2dec->picture + 1; /* second field picture */
00368 }
00369 mpeg2dec->picture = picture;
00370 picture->flags = 0;
00371 if (mpeg2dec->num_pts) {
00372 if (mpeg2dec->bytes_since_pts >= 4) {
00373 mpeg2dec->num_pts = 0;
00374 picture->pts = mpeg2dec->pts_current;
00375 picture->flags = PIC_FLAG_PTS;
00376 } else if (mpeg2dec->num_pts > 1) {
00377 mpeg2dec->num_pts = 1;
00378 picture->pts = mpeg2dec->pts_previous;
00379 picture->flags = PIC_FLAG_PTS;
00380 }
00381 }
00382 picture->display_offset[0].x = picture->display_offset[1].x =
00383 picture->display_offset[2].x = mpeg2dec->display_offset_x;
00384 picture->display_offset[0].y = picture->display_offset[1].y =
00385 picture->display_offset[2].y = mpeg2dec->display_offset_y;
00386 return mpeg2_parse_header (mpeg2dec);
00387 }
|
|
|
Definition at line 97 of file header.c. References sequence_t::byte_rate, sequence_t::chroma_height, sequence_t::chroma_width, mpeg2dec_s::chunk_start, sequence_t::colour_primaries, decoder_s::concealment_motion_vectors, mpeg2dec_s::decoder, sequence_t::display_height, mpeg2dec_s::display_offset_x, mpeg2dec_s::display_offset_y, sequence_t::display_width, mpeg2dec_s::ext_state, sequence_t::flags, sequence_t::frame_period, FRAME_PICTURE, decoder_s::frame_pred_frame_dct, sequence_t::height, decoder_s::height, i, mpeg2dec_s::info, decoder_s::intra_dc_precision, decoder_s::intra_quantizer_matrix, sequence_t::matrix_coefficients, decoder_s::mpeg1, mpeg2dec_s::new_sequence, decoder_s::non_intra_quantizer_matrix, sequence_t::picture_height, decoder_s::picture_structure, sequence_t::picture_width, sequence_t::pixel_width, sequence_t::profile_level_id, decoder_s::q_scale_type, reset_info(), decoder_s::scan, SEQ_EXT, SEQ_FLAG_CONSTRAINED_PARAMETERS, SEQ_FLAG_PROGRESSIVE_SEQUENCE, mpeg2dec_s::state, STATE_SEQUENCE, sequence_t::transfer_characteristics, uint8_t, sequence_t::vbv_buffer_size, decoder_s::vertical_position_extension, sequence_t::width, and decoder_s::width.
00098 {
00099 uint8_t * buffer = mpeg2dec->chunk_start;
00100 sequence_t * sequence = &(mpeg2dec->new_sequence);
00101 decoder_t * decoder = &(mpeg2dec->decoder);
00102 static unsigned int frame_period[9] = {
00103 0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000
00104 };
00105 int width, height;
00106 int i;
00107
00108 if ((buffer[6] & 0x20) != 0x20) /* missing marker_bit */
00109 return 1;
00110
00111 i = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
00112 sequence->display_width = sequence->picture_width = width = i >> 12;
00113 sequence->display_height = sequence->picture_height = height = i & 0xfff;
00114 decoder->width = sequence->width = width = (width + 15) & ~15;
00115 decoder->height = sequence->height = height = (height + 15) & ~15;
00116 decoder->vertical_position_extension = (height > 2800);
00117 sequence->chroma_width = width >> 1;
00118 sequence->chroma_height = height >> 1;
00119
00120 sequence->flags = SEQ_FLAG_PROGRESSIVE_SEQUENCE;
00121
00122 sequence->pixel_width = buffer[3] >> 4; /* aspect ratio */
00123 sequence->frame_period = 0;
00124 if ((buffer[3] & 15) < 9)
00125 sequence->frame_period = frame_period[buffer[3] & 15];
00126
00127 sequence->byte_rate = (buffer[4]<<10) | (buffer[5]<<2) | (buffer[6]>>6);
00128
00129 sequence->vbv_buffer_size = ((buffer[6]<<16)|(buffer[7]<<8))&0x1ff800;
00130
00131 if (buffer[7] & 4)
00132 sequence->flags |= SEQ_FLAG_CONSTRAINED_PARAMETERS;
00133
00134 if (buffer[7] & 2) {
00135 for (i = 0; i < 64; i++)
00136 decoder->intra_quantizer_matrix[mpeg2_scan_norm[i]] =
00137 (buffer[i+7] << 7) | (buffer[i+8] >> 1);
00138 buffer += 64;
00139 } else
00140 for (i = 0; i < 64; i++)
00141 decoder->intra_quantizer_matrix[mpeg2_scan_norm[i]] =
00142 default_intra_quantizer_matrix [i];
00143
00144 if (buffer[7] & 1)
00145 for (i = 0; i < 64; i++)
00146 decoder->non_intra_quantizer_matrix[mpeg2_scan_norm[i]] =
00147 buffer[i+8];
00148 else
00149 for (i = 0; i < 64; i++)
00150 decoder->non_intra_quantizer_matrix[i] = 16;
00151
00152 sequence->profile_level_id = 0x80;
00153 sequence->colour_primaries = 1;
00154 sequence->transfer_characteristics = 1;
00155 sequence->matrix_coefficients = 1;
00156
00157 decoder->mpeg1 = 1;
00158 decoder->intra_dc_precision = 0;
00159 decoder->frame_pred_frame_dct = 1;
00160 decoder->q_scale_type = 0;
00161 decoder->concealment_motion_vectors = 0;
00162 decoder->scan = mpeg2_scan_norm;
00163 decoder->picture_structure = FRAME_PICTURE;
00164
00165 mpeg2dec->ext_state = SEQ_EXT;
00166 mpeg2dec->state = STATE_SEQUENCE;
00167 mpeg2dec->display_offset_x = mpeg2dec->display_offset_y = 0;
00168
00169 reset_info (&(mpeg2dec->info));
00170 return 0;
00171 }
|
|
|
Definition at line 307 of file header.c. References sequence_t::byte_rate, finalize_sequence(), mpeg2dec_s::info, memcmp(), mpeg2dec_s::new_sequence, mpeg2_info_t::sequence, mpeg2dec_s::sequence, mpeg2dec_s::state, and STATE_SEQUENCE_REPEATED. Referenced by mpeg2_parse_header().
00308 {
00309 sequence_t * sequence = &(mpeg2dec->new_sequence);
00310
00311 finalize_sequence (sequence);
00312
00313 /*
00314 * according to 6.1.1.6, repeat sequence headers should be
00315 * identical to the original. However some DVDs dont respect that
00316 * and have different bitrates in the repeat sequence headers. So
00317 * we'll ignore that in the comparison and still consider these as
00318 * repeat sequence headers.
00319 */
00320 mpeg2dec->sequence.byte_rate = sequence->byte_rate;
00321 if (!memcmp (&(mpeg2dec->sequence), sequence, sizeof (sequence_t)))
00322 mpeg2dec->state = STATE_SEQUENCE_REPEATED;
00323 mpeg2dec->sequence = *sequence;
00324
00325 mpeg2dec->info.sequence = &(mpeg2dec->sequence);
00326 }
|
|
|
|
Definition at line 77 of file header.c. References mpeg2dec_s::alloc_index, mpeg2dec_s::alloc_index_user, mpeg2dec_s::decoder, fbuf_alloc_t::fbuf, mpeg2dec_s::fbuf, mpeg2dec_s::fbuf_alloc, mpeg2dec_s::first, mpeg2dec_s::picture, mpeg2dec_s::pictures, and decoder_s::scan. Referenced by mpeg2_init().
00078 {
00079 mpeg2dec->decoder.scan = mpeg2_scan_norm;
00080 mpeg2dec->picture = mpeg2dec->pictures;
00081 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf;
00082 mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf;
00083 mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf;
00084 mpeg2dec->first = 1;
00085 mpeg2dec->alloc_index = 0;
00086 mpeg2dec->alloc_index_user = 0;
00087 }
|
|
|
Definition at line 605 of file header.c. References mpeg2dec_s::chunk_ptr, mpeg2dec_s::chunk_start, mpeg2dec_s::info, mpeg2_info_t::user_data, and mpeg2_info_t::user_data_len.
00606 {
00607 if (!mpeg2dec->info.user_data_len)
00608 mpeg2dec->info.user_data = mpeg2dec->chunk_start;
00609 else
00610 mpeg2dec->info.user_data_len += 3;
00611 mpeg2dec->info.user_data_len += (mpeg2dec->chunk_ptr - 4 -
00612 mpeg2dec->chunk_start);
00613 mpeg2dec->chunk_start = mpeg2dec->chunk_ptr - 1;
00614
00615 return 0;
00616 }
|
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
|
Referenced by mpeg2_idct_init(). |
|
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||||||
|
Referenced by mpeg2_idct_init(). |
|
|
|
Referenced by mpeg2_idct_init(). |
|
||||||||||||
|
Definition at line 40 of file alloc.c. References malloc, memalign(), and mpeg2_malloc_hook. Referenced by mpeg2_convert(), mpeg2_header_picture(), and mpeg2_init().
00041 {
00042 char * buf;
00043
00044 if (mpeg2_malloc_hook) {
00045 buf = (char *) mpeg2_malloc_hook (size, reason);
00046 if (buf)
00047 return buf;
00048 }
00049
00050 #if defined(HAVE_MEMALIGN) && !defined(__cplusplus) && !defined(DEBUG)
00051 return memalign (16, size);
00052 #else
00053 buf = (char *) malloc (size + 15 + sizeof (void **));
00054 if (buf) {
00055 char * align_buf;
00056
00057 align_buf = buf + 15 + sizeof (void **);
00058 align_buf -= (long)align_buf & 15;
00059 *(((void **)align_buf) - 1) = buf;
00060 return align_buf;
00061 }
00062 return NULL;
00063 #endif
00064 }
|
|
|
|
Definition at line 219 of file decode.c. References mpeg2dec_s::action, mpeg2dec_s::buf_end, mpeg2dec_s::buf_start, BUFFER_SIZE, mpeg2dec_s::bytes_since_pts, mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_ptr, mpeg2dec_s::chunk_start, mpeg2dec_s::code, copy_chunk(), mpeg2_header_sequence_finalize(), mpeg2_parse_header(), mpeg2_seek_header(), RECEIVED, mpeg2dec_s::state, STATE_GOP, STATE_INVALID, STATE_PICTURE, STATE_PICTURE_2ND, STATE_SEQUENCE, and x00. Referenced by mpeg2_header_picture_start(), mpeg2_parse(), mpeg2_parse_header(), and mpeg2_seek_header().
00220 {
00221 static int (* process_header[]) (mpeg2dec_t * mpeg2dec) = {
00222 mpeg2_header_picture, mpeg2_header_extension, mpeg2_header_user_data,
00223 mpeg2_header_sequence, NULL, NULL, NULL, NULL, mpeg2_header_gop
00224 };
00225 int size_buffer, size_chunk, copied;
00226
00227 mpeg2dec->action = mpeg2_parse_header;
00228 while (1) {
00229 size_buffer = mpeg2dec->buf_end - mpeg2dec->buf_start;
00230 size_chunk = (mpeg2dec->chunk_buffer + BUFFER_SIZE -
00231 mpeg2dec->chunk_ptr);
00232 if (size_buffer <= size_chunk) {
00233 copied = copy_chunk (mpeg2dec, size_buffer);
00234 if (!copied) {
00235 mpeg2dec->bytes_since_pts += size_buffer;
00236 mpeg2dec->chunk_ptr += size_buffer;
00237 return -1;
00238 }
00239 } else {
00240 copied = copy_chunk (mpeg2dec, size_chunk);
00241 if (!copied) {
00242 /* filled the chunk buffer without finding a start code */
00243 mpeg2dec->bytes_since_pts += size_chunk;
00244 mpeg2dec->code = 0xb4;
00245 mpeg2dec->action = mpeg2_seek_header;
00246 return STATE_INVALID;
00247 }
00248 }
00249 mpeg2dec->bytes_since_pts += copied;
00250
00251 if (process_header[mpeg2dec->code & 0x0b] (mpeg2dec)) {
00252 mpeg2dec->code = mpeg2dec->buf_start[-1];
00253 mpeg2dec->action = mpeg2_seek_header;
00254 return STATE_INVALID;
00255 }
00256
00257 mpeg2dec->code = mpeg2dec->buf_start[-1];
00258 switch (RECEIVED (mpeg2dec->code, mpeg2dec->state)) {
00259
00260 /* state transition after a sequence header */
00261 case RECEIVED (0x00, STATE_SEQUENCE):
00262 mpeg2dec->action = mpeg2_header_picture_start;
00263 case RECEIVED (0xb8, STATE_SEQUENCE):
00264 mpeg2_header_sequence_finalize (mpeg2dec);
00265 break;
00266
00267 /* other legal state transitions */
00268 case RECEIVED (0x00, STATE_GOP):
00269 mpeg2dec->action = mpeg2_header_picture_start;
00270 break;
00271 case RECEIVED (0x01, STATE_PICTURE):
00272 case RECEIVED (0x01, STATE_PICTURE_2ND):
00273 mpeg2dec->action = mpeg2_header_slice_start;
00274 break;
00275
00276 /* legal headers within a given state */
00277 case RECEIVED (0xb2, STATE_SEQUENCE):
00278 case RECEIVED (0xb2, STATE_GOP):
00279 case RECEIVED (0xb2, STATE_PICTURE):
00280 case RECEIVED (0xb2, STATE_PICTURE_2ND):
00281 case RECEIVED (0xb5, STATE_SEQUENCE):
00282 case RECEIVED (0xb5, STATE_PICTURE):
00283 case RECEIVED (0xb5, STATE_PICTURE_2ND):
00284 mpeg2dec->chunk_ptr = mpeg2dec->chunk_start;
00285 continue;
00286
00287 default:
00288 mpeg2dec->action = mpeg2_seek_header;
00289 return STATE_INVALID;
00290 }
00291
00292 mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
00293 return mpeg2dec->state;
00294 }
00295 }
|
|
|
Definition at line 134 of file decode.c. References mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_ptr, mpeg2dec_s::chunk_start, mpeg2dec_s::code, mpeg2_parse_header(), seek_chunk(), mpeg2dec_s::sequence, and sequence_t::width. Referenced by mpeg2_parse(), mpeg2_parse_header(), and mpeg2_seek_sequence().
00135 {
00136 while (mpeg2dec->code != 0xb3 &&
00137 ((mpeg2dec->code != 0xb7 && mpeg2dec->code != 0xb8 &&
00138 mpeg2dec->code) || mpeg2dec->sequence.width == -1))
00139 if (seek_chunk (mpeg2dec))
00140 return -1;
00141 mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
00142 return mpeg2_parse_header (mpeg2dec);
00143 }
|
|
|
Definition at line 145 of file decode.c. References mpeg2_seek_header(), mpeg2dec_s::sequence, and sequence_t::width. Referenced by mpeg2_init().
00146 {
00147 mpeg2dec->sequence.width = -1;
00148 return mpeg2_seek_header (mpeg2dec);
00149 }
|
|
||||||||||||
|
Definition at line 335 of file header.c. References B_TYPE, mpeg2dec_s::convert_start, mpeg2_info_t::current_fbuf, mpeg2_info_t::discard_fbuf, mpeg2_info_t::display_fbuf, mpeg2dec_s::fbuf, mpeg2dec_s::fbuf_alloc, sequence_t::flags, i, mpeg2dec_s::info, SEQ_FLAG_LOW_DELAY, and mpeg2dec_s::sequence. Referenced by mpeg2_header_picture(), and mpeg2_set_buf().
00336 {
00337 int i;
00338
00339 for (i = 0; i < 3; i++)
00340 if (mpeg2dec->fbuf[1] != &mpeg2dec->fbuf_alloc[i].fbuf &&
00341 mpeg2dec->fbuf[2] != &mpeg2dec->fbuf_alloc[i].fbuf) {
00342 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[i].fbuf;
00343 mpeg2dec->info.current_fbuf = mpeg2dec->fbuf[0];
00344 if ((coding_type == B_TYPE) ||
00345 (mpeg2dec->sequence.flags & SEQ_FLAG_LOW_DELAY)) {
00346 if ((coding_type == B_TYPE) || (mpeg2dec->convert_start))
00347 mpeg2dec->info.discard_fbuf = mpeg2dec->fbuf[0];
00348 mpeg2dec->info.display_fbuf = mpeg2dec->fbuf[0];
00349 }
00350 break;
00351 }
00352 }
|
Variable Documentation
|
|
Definition at line 293 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 295 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 294 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 290 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 296 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 291 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |
|
|
Definition at line 292 of file mpeg2_internal.h. Referenced by mpeg2_mc_init(). |