Doxygen Source Code Documentation
mpeg2.h File Reference
Go to the source code of this file.
Define Documentation
|
Definition at line 128 of file mpeg2.h. Referenced by mpeg2_idct_init(), and mpeg2_mc_init(). |
|
Definition at line 129 of file mpeg2.h. Referenced by mpeg2_idct_init(). |
|
Definition at line 131 of file mpeg2.h. Referenced by mpeg2_accel(), and mpeg2_init(). |
|
Definition at line 130 of file mpeg2.h. Referenced by convert_internal(), mpeg2_detect_accel(), mpeg2_idct_init(), and mpeg2_mc_init(). |
|
Definition at line 127 of file mpeg2.h. Referenced by mpeg2_cpu_state_init(), mpeg2_idct_init(), and mpeg2_mc_init(). |
|
Definition at line 125 of file mpeg2.h. Referenced by mpeg2_mc_init(). |
|
Definition at line 124 of file mpeg2.h. Referenced by convert_internal(), mpeg2_cpu_state_init(), mpeg2_idct_init(), and mpeg2_mc_init(). |
|
Definition at line 126 of file mpeg2.h. Referenced by convert_internal(), mpeg2_idct_init(), and mpeg2_mc_init(). |
|
Definition at line 62 of file mpeg2.h. Referenced by mpeg2_header_picture(), and mpeg2_header_picture_start(). |
|
|
|
|
|
Definition at line 61 of file mpeg2.h. Referenced by mpeg2_header_picture(). |
|
Definition at line 67 of file mpeg2.h. Referenced by picture_coding_ext(). |
|
Definition at line 66 of file mpeg2.h. Referenced by picture_coding_ext(). |
|
Definition at line 69 of file mpeg2.h. Referenced by mpeg2_header_picture_start(). |
|
Definition at line 68 of file mpeg2.h. Referenced by mpeg2_header_slice_start(). |
|
Definition at line 65 of file mpeg2.h. Referenced by picture_coding_ext(). |
|
|
|
Definition at line 70 of file mpeg2.h. Referenced by picture_coding_ext(). |
|
Definition at line 31 of file mpeg2.h. Referenced by sequence_display_ext(). |
|
Definition at line 28 of file mpeg2.h. Referenced by mpeg2_header_sequence(). |
|
Definition at line 30 of file mpeg2.h. Referenced by mpeg2_header_end(), mpeg2_header_picture(), mpeg2_set_fbuf(), and sequence_ext(). |
|
Definition at line 27 of file mpeg2.h. Referenced by finalize_sequence(), and sequence_ext(). |
|
Definition at line 29 of file mpeg2.h. Referenced by mpeg2_header_sequence(), mpeg2_header_slice_start(), picture_coding_ext(), picture_display_ext(), and sequence_ext(). |
|
Definition at line 33 of file mpeg2.h. Referenced by sequence_display_ext(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 110 of file mpeg2.h. Referenced by decode_mpeg2(), mpeg2_header_end(), sample1(), and sample2(). |
|
Definition at line 105 of file mpeg2.h. Referenced by mpeg2_header_gop(), and mpeg2_parse_header(). |
|
Definition at line 111 of file mpeg2.h. Referenced by mpeg2_header_end(), mpeg2_parse(), and mpeg2_parse_header(). |
|
Definition at line 106 of file mpeg2.h. Referenced by decode_mpeg2(), mpeg2_header_picture(), mpeg2_header_picture_start(), and mpeg2_parse_header(). |
|
Definition at line 108 of file mpeg2.h. Referenced by decode_mpeg2(), mpeg2_header_picture_start(), mpeg2_header_slice_start(), and mpeg2_parse_header(). |
|
Definition at line 103 of file mpeg2.h. Referenced by decode_mpeg2(), mpeg2_header_sequence(), mpeg2_parse_header(), mpeg2_set_buf(), and sample2(). |
|
Definition at line 104 of file mpeg2.h. Referenced by mpeg2_header_sequence_finalize(). |
|
Definition at line 109 of file mpeg2.h. Referenced by decode_mpeg2(), mpeg2_header_slice_start(), mpeg2_parse(), sample1(), and sample2(). |
|
Definition at line 107 of file mpeg2.h. Referenced by mpeg2_header_picture_start(), mpeg2_header_slice_start(), and mpeg2_parse(). |
Typedef Documentation
|
|
|
|
Function Documentation
|
Definition at line 380 of file decode.c. References MPEG2_ACCEL_DETECT, mpeg2_accels, mpeg2_cpu_state_init(), mpeg2_detect_accel(), mpeg2_idct_init(), mpeg2_mc_init(), and uint32_t. Referenced by handle_args(), and mpeg2_init().
00381 { 00382 if (!mpeg2_accels) { 00383 if (accel & MPEG2_ACCEL_DETECT) 00384 accel |= mpeg2_detect_accel (); 00385 mpeg2_accels = accel |= MPEG2_ACCEL_DETECT; 00386 mpeg2_cpu_state_init (accel); 00387 mpeg2_idct_init (accel); 00388 mpeg2_mc_init (accel); 00389 } 00390 return mpeg2_accels & ~MPEG2_ACCEL_DETECT; 00391 } |
|
Definition at line 113 of file decode.c. References mpeg2dec_s::buf_end, mpeg2dec_s::buf_start, and uint8_t. Referenced by decode_mpeg2(), sample1(), and sample2().
|
|
Definition at line 422 of file decode.c. References mpeg2dec_s::alloc_index, mpeg2dec_s::alloc_index_user, mpeg2dec_s::chunk_buffer, mpeg2dec_s::convert_id, mpeg2dec_s::convert_start, mpeg2dec_s::custom_fbuf, mpeg2dec_s::fbuf_alloc, i, mpeg2_free(), and mpeg2dec_s::yuv_buf. Referenced by main(), sample1(), and sample2().
00423 { 00424 int i; 00425 00426 /* static uint8_t finalizer[] = {0,0,1,0xb4}; */ 00427 /* mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4); */ 00428 00429 mpeg2_free (mpeg2dec->chunk_buffer); 00430 if (!mpeg2dec->custom_fbuf) 00431 for (i = mpeg2dec->alloc_index_user; i < mpeg2dec->alloc_index; i++) 00432 mpeg2_free (mpeg2dec->fbuf_alloc[i].fbuf.buf[0]); 00433 if (mpeg2dec->convert_start) 00434 for (i = 0; i < 3; i++) 00435 mpeg2_free (mpeg2dec->yuv_buf[i][0]); 00436 if (mpeg2dec->convert_id) 00437 mpeg2_free (mpeg2dec->convert_id); 00438 mpeg2_free (mpeg2dec); 00439 } |
|
Definition at line 297 of file decode.c. References ALLOC_CONVERT_ID, ALLOC_YUV, arg, convert_init_s::buf_size, mpeg2dec_s::convert_copy, mpeg2dec_s::convert_id, mpeg2dec_s::convert_size, mpeg2dec_s::convert_start, convert_init_s::copy, mpeg2dec_s::decoder, decoder_s::height, convert_init_s::id, convert_init_s::id_size, mpeg2_accels, mpeg2_malloc(), convert_init_s::start, uint32_t, uint8_t, decoder_s::width, and mpeg2dec_s::yuv_buf. Referenced by decode_mpeg2(), and sample2().
00300 { 00301 convert_init_t convert_init; 00302 int size; 00303 00304 convert_init.id = NULL; 00305 convert (mpeg2dec->decoder.width, mpeg2dec->decoder.height, 00306 mpeg2_accels, arg, &convert_init); 00307 if (convert_init.id_size) { 00308 convert_init.id = mpeg2dec->convert_id = 00309 mpeg2_malloc (convert_init.id_size, ALLOC_CONVERT_ID); 00310 convert (mpeg2dec->decoder.width, mpeg2dec->decoder.height, 00311 mpeg2_accels, arg, &convert_init); 00312 } 00313 mpeg2dec->convert_size[0] = size = convert_init.buf_size[0]; 00314 mpeg2dec->convert_size[1] = size += convert_init.buf_size[1]; 00315 mpeg2dec->convert_size[2] = size += convert_init.buf_size[2]; 00316 mpeg2dec->convert_start = convert_init.start; 00317 mpeg2dec->convert_copy = convert_init.copy; 00318 00319 size = mpeg2dec->decoder.width * mpeg2dec->decoder.height >> 2; 00320 mpeg2dec->yuv_buf[0][0] = (uint8_t *) mpeg2_malloc (6 * size, ALLOC_YUV); 00321 mpeg2dec->yuv_buf[0][1] = mpeg2dec->yuv_buf[0][0] + 4 * size; 00322 mpeg2dec->yuv_buf[0][2] = mpeg2dec->yuv_buf[0][0] + 5 * size; 00323 mpeg2dec->yuv_buf[1][0] = (uint8_t *) mpeg2_malloc (6 * size, ALLOC_YUV); 00324 mpeg2dec->yuv_buf[1][1] = mpeg2dec->yuv_buf[1][0] + 4 * size; 00325 mpeg2dec->yuv_buf[1][2] = mpeg2dec->yuv_buf[1][0] + 5 * size; 00326 size = mpeg2dec->decoder.width * 8; 00327 mpeg2dec->yuv_buf[2][0] = (uint8_t *) mpeg2_malloc (6 * size, ALLOC_YUV); 00328 mpeg2dec->yuv_buf[2][1] = mpeg2dec->yuv_buf[2][0] + 4 * size; 00329 mpeg2dec->yuv_buf[2][2] = mpeg2dec->yuv_buf[2][0] + 5 * size; 00330 } |
|
Definition at line 353 of file decode.c. References mpeg2dec_s::custom_fbuf. Referenced by decode_mpeg2().
00354 { 00355 mpeg2dec->custom_fbuf = custom_fbuf; 00356 } |
|
Definition at line 38 of file decode.c. References mpeg2dec_s::info. Referenced by decode_mpeg2(), sample1(), and sample2().
00039 { 00040 return &(mpeg2dec->info); 00041 } |
|
Definition at line 393 of file decode.c. References mpeg2dec_s::action, ALLOC_CHUNK, ALLOC_MPEG2DEC, BUFFER_SIZE, mpeg2dec_s::chunk_buffer, mpeg2dec_s::code, mpeg2dec_s::convert_id, mpeg2dec_s::first_decode_slice, mpeg2_accel(), MPEG2_ACCEL_DETECT, mpeg2_header_state_init(), mpeg2_malloc(), mpeg2_seek_sequence(), mpeg2dec_s::nb_decode_slices, mpeg2dec_s::shift, and uint8_t. Referenced by main(), sample1(), and sample2().
00394 { 00395 mpeg2dec_t * mpeg2dec; 00396 00397 mpeg2_accel (MPEG2_ACCEL_DETECT); 00398 00399 mpeg2dec = (mpeg2dec_t *) mpeg2_malloc (sizeof (mpeg2dec_t), 00400 ALLOC_MPEG2DEC); 00401 if (mpeg2dec == NULL) 00402 return NULL; 00403 00404 memset (mpeg2dec, 0, sizeof (mpeg2dec_t)); 00405 00406 mpeg2dec->chunk_buffer = (uint8_t *) mpeg2_malloc (BUFFER_SIZE + 4, 00407 ALLOC_CHUNK); 00408 00409 mpeg2dec->shift = 0xffffff00; 00410 mpeg2dec->action = mpeg2_seek_sequence; 00411 mpeg2dec->code = 0xb4; 00412 mpeg2dec->first_decode_slice = 1; 00413 mpeg2dec->nb_decode_slices = 0xb0 - 1; 00414 mpeg2dec->convert_id = NULL; 00415 00416 /* initialize substructures */ 00417 mpeg2_header_state_init (mpeg2dec); 00418 00419 return mpeg2dec; 00420 } |
|
Definition at line 1446 of file slice.c. References decoder_s::b_motion, B_TYPE, BOTTOM_FIELD, decoder_s::coding_type, decoder_s::dmv_offset, decoder_s::f_motion, FRAME_PICTURE, decoder_s::height, decoder_s::limit_x, decoder_s::limit_y, decoder_s::limit_y_16, decoder_s::limit_y_8, offset, decoder_s::picture_dest, decoder_s::picture_structure, motion_t::ref, motion_t::ref2, decoder_s::second_field, stride, decoder_s::stride, uint8_t, decoder_s::uv_stride, and decoder_s::width. Referenced by mpeg2_header_slice_start().
01448 { 01449 int offset, stride, height, bottom_field; 01450 01451 stride = decoder->width; 01452 bottom_field = (decoder->picture_structure == BOTTOM_FIELD); 01453 offset = bottom_field ? stride : 0; 01454 height = decoder->height; 01455 01456 decoder->picture_dest[0] = current_fbuf[0] + offset; 01457 decoder->picture_dest[1] = current_fbuf[1] + (offset >> 1); 01458 decoder->picture_dest[2] = current_fbuf[2] + (offset >> 1); 01459 01460 decoder->f_motion.ref[0][0] = forward_fbuf[0] + offset; 01461 decoder->f_motion.ref[0][1] = forward_fbuf[1] + (offset >> 1); 01462 decoder->f_motion.ref[0][2] = forward_fbuf[2] + (offset >> 1); 01463 01464 decoder->b_motion.ref[0][0] = backward_fbuf[0] + offset; 01465 decoder->b_motion.ref[0][1] = backward_fbuf[1] + (offset >> 1); 01466 decoder->b_motion.ref[0][2] = backward_fbuf[2] + (offset >> 1); 01467 01468 if (decoder->picture_structure != FRAME_PICTURE) { 01469 decoder->dmv_offset = bottom_field ? 1 : -1; 01470 decoder->f_motion.ref2[0] = decoder->f_motion.ref[bottom_field]; 01471 decoder->f_motion.ref2[1] = decoder->f_motion.ref[!bottom_field]; 01472 decoder->b_motion.ref2[0] = decoder->b_motion.ref[bottom_field]; 01473 decoder->b_motion.ref2[1] = decoder->b_motion.ref[!bottom_field]; 01474 offset = stride - offset; 01475 01476 if (decoder->second_field && (decoder->coding_type != B_TYPE)) 01477 forward_fbuf = current_fbuf; 01478 01479 decoder->f_motion.ref[1][0] = forward_fbuf[0] + offset; 01480 decoder->f_motion.ref[1][1] = forward_fbuf[1] + (offset >> 1); 01481 decoder->f_motion.ref[1][2] = forward_fbuf[2] + (offset >> 1); 01482 01483 decoder->b_motion.ref[1][0] = backward_fbuf[0] + offset; 01484 decoder->b_motion.ref[1][1] = backward_fbuf[1] + (offset >> 1); 01485 decoder->b_motion.ref[1][2] = backward_fbuf[2] + (offset >> 1); 01486 01487 stride <<= 1; 01488 height >>= 1; 01489 } 01490 01491 decoder->stride = stride; 01492 decoder->uv_stride = stride >> 1; 01493 decoder->limit_x = 2 * decoder->width - 32; 01494 decoder->limit_y_16 = 2 * height - 32; 01495 decoder->limit_y_8 = 2 * height - 16; 01496 decoder->limit_y = height - 16; 01497 } |
|
Definition at line 153 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(), mpeg2dec_s::decoder, mpeg2dec_s::first_decode_slice, mpeg2_parse_header(), mpeg2_seek_header(), mpeg2_slice(), mpeg2dec_s::nb_decode_slices, RECEIVED, seek_chunk(), mpeg2dec_s::state, STATE_INVALID, STATE_SLICE, STATE_SLICE_1ST, and x00. Referenced by decode_mpeg2(), sample1(), and sample2().
00154 { 00155 int size_buffer, size_chunk, copied; 00156 00157 if (mpeg2dec->action) { 00158 int state; 00159 00160 state = mpeg2dec->action (mpeg2dec); 00161 if (state) 00162 return state; 00163 } 00164 00165 while (1) { 00166 while ((unsigned) (mpeg2dec->code - mpeg2dec->first_decode_slice) < 00167 mpeg2dec->nb_decode_slices) { 00168 size_buffer = mpeg2dec->buf_end - mpeg2dec->buf_start; 00169 size_chunk = (mpeg2dec->chunk_buffer + BUFFER_SIZE - 00170 mpeg2dec->chunk_ptr); 00171 if (size_buffer <= size_chunk) { 00172 copied = copy_chunk (mpeg2dec, size_buffer); 00173 if (!copied) { 00174 mpeg2dec->bytes_since_pts += size_buffer; 00175 mpeg2dec->chunk_ptr += size_buffer; 00176 return -1; 00177 } 00178 } else { 00179 copied = copy_chunk (mpeg2dec, size_chunk); 00180 if (!copied) { 00181 /* filled the chunk buffer without finding a start code */ 00182 mpeg2dec->bytes_since_pts += size_chunk; 00183 mpeg2dec->action = seek_chunk; 00184 return STATE_INVALID; 00185 } 00186 } 00187 mpeg2dec->bytes_since_pts += copied; 00188 00189 mpeg2_slice (&(mpeg2dec->decoder), mpeg2dec->code, 00190 mpeg2dec->chunk_start); 00191 mpeg2dec->code = mpeg2dec->buf_start[-1]; 00192 mpeg2dec->chunk_ptr = mpeg2dec->chunk_start; 00193 } 00194 if ((unsigned) (mpeg2dec->code - 1) >= 0xb0 - 1) 00195 break; 00196 if (seek_chunk (mpeg2dec)) 00197 return -1; 00198 } 00199 00200 switch (RECEIVED (mpeg2dec->code, mpeg2dec->state)) { 00201 case RECEIVED (0x00, STATE_SLICE_1ST): 00202 case RECEIVED (0x00, STATE_SLICE): 00203 mpeg2dec->action = mpeg2_header_picture_start; 00204 break; 00205 case RECEIVED (0xb7, STATE_SLICE): 00206 mpeg2dec->action = mpeg2_header_end; 00207 break; 00208 case RECEIVED (0xb3, STATE_SLICE): 00209 case RECEIVED (0xb8, STATE_SLICE): 00210 mpeg2dec->action = mpeg2_parse_header; 00211 break; 00212 default: 00213 mpeg2dec->action = mpeg2_seek_header; 00214 return STATE_INVALID; 00215 } 00216 return mpeg2dec->state; 00217 } |
|
Definition at line 372 of file decode.c. References mpeg2dec_s::bytes_since_pts, mpeg2dec_s::num_pts, mpeg2dec_s::pts_current, mpeg2dec_s::pts_previous, and uint32_t. Referenced by demux(), and pva_demux().
00373 { 00374 mpeg2dec->pts_previous = mpeg2dec->pts_current; 00375 mpeg2dec->pts_current = pts; 00376 mpeg2dec->num_pts++; 00377 mpeg2dec->bytes_since_pts = 0; 00378 } |
|
Definition at line 332 of file decode.c. References mpeg2dec_s::alloc_index, mpeg2dec_s::alloc_index_user, fbuf_t::buf, decoder_s::coding_type, mpeg2dec_s::custom_fbuf, mpeg2dec_s::decoder, mpeg2dec_s::fbuf, mpeg2dec_s::fbuf_alloc, fbuf_t::id, mpeg2_set_fbuf(), mpeg2dec_s::state, STATE_SEQUENCE, and uint8_t. Referenced by decode_mpeg2().
00333 { 00334 fbuf_t * fbuf; 00335 00336 if (mpeg2dec->custom_fbuf) { 00337 mpeg2_set_fbuf (mpeg2dec, mpeg2dec->decoder.coding_type); 00338 fbuf = mpeg2dec->fbuf[0]; 00339 if (mpeg2dec->state == STATE_SEQUENCE) { 00340 mpeg2dec->fbuf[2] = mpeg2dec->fbuf[1]; 00341 mpeg2dec->fbuf[1] = mpeg2dec->fbuf[0]; 00342 } 00343 } else { 00344 fbuf = &(mpeg2dec->fbuf_alloc[mpeg2dec->alloc_index].fbuf); 00345 mpeg2dec->alloc_index_user = ++mpeg2dec->alloc_index; 00346 } 00347 fbuf->buf[0] = buf[0]; 00348 fbuf->buf[1] = buf[1]; 00349 fbuf->buf[2] = buf[2]; 00350 fbuf->id = id; 00351 } |
|
Definition at line 358 of file decode.c. References mpeg2dec_s::first_decode_slice, mpeg2dec_s::nb_decode_slices, and skip.
00359 { 00360 mpeg2dec->first_decode_slice = 1; 00361 mpeg2dec->nb_decode_slices = skip ? 0 : (0xb0 - 1); 00362 } |
|
|
|
Definition at line 364 of file decode.c. References mpeg2dec_s::first_decode_slice, and mpeg2dec_s::nb_decode_slices.
00365 { 00366 start = (start < 1) ? 1 : (start > 0xb0) ? 0xb0 : start; 00367 end = (end < start) ? start : (end > 0xb0) ? 0xb0 : end; 00368 mpeg2dec->first_decode_slice = start; 00369 mpeg2dec->nb_decode_slices = end - start; 00370 } |