write MSMPEG4 compatible frame header */
| 352 | |
| 353 | /* write MSMPEG4 compatible frame header */ |
| 354 | void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) |
| 355 | { |
| 356 | find_best_tables(s); |
| 357 | |
| 358 | align_put_bits(&s->pb); |
| 359 | put_bits(&s->pb, 2, s->pict_type - 1); |
| 360 | |
| 361 | put_bits(&s->pb, 5, s->qscale); |
| 362 | if(s->msmpeg4_version<=2){ |
| 363 | s->rl_table_index = 2; |
| 364 | s->rl_chroma_table_index = 2; |
| 365 | } |
| 366 | |
| 367 | s->dc_table_index = 1; |
| 368 | s->mv_table_index = 1; /* only if P frame */ |
| 369 | s->use_skip_mb_code = 1; /* only if P frame */ |
| 370 | s->per_mb_rl_table = 0; |
| 371 | if(s->msmpeg4_version==4) |
| 372 | s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==FF_P_TYPE); |
| 373 | //printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); |
| 374 | |
| 375 | if (s->pict_type == FF_I_TYPE) { |
| 376 | s->slice_height= s->mb_height/1; |
| 377 | put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height); |
| 378 | |
| 379 | if(s->msmpeg4_version==4){ |
| 380 | msmpeg4_encode_ext_header(s); |
| 381 | if(s->bit_rate>MBAC_BITRATE) |
| 382 | put_bits(&s->pb, 1, s->per_mb_rl_table); |
| 383 | } |
| 384 | |
| 385 | if(s->msmpeg4_version>2){ |
| 386 | if(!s->per_mb_rl_table){ |
| 387 | ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index); |
| 388 | ff_msmpeg4_code012(&s->pb, s->rl_table_index); |
| 389 | } |
| 390 | |
| 391 | put_bits(&s->pb, 1, s->dc_table_index); |
| 392 | } |
| 393 | } else { |
| 394 | put_bits(&s->pb, 1, s->use_skip_mb_code); |
| 395 | |
| 396 | if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE) |
| 397 | put_bits(&s->pb, 1, s->per_mb_rl_table); |
| 398 | |
| 399 | if(s->msmpeg4_version>2){ |
| 400 | if(!s->per_mb_rl_table) |
| 401 | ff_msmpeg4_code012(&s->pb, s->rl_table_index); |
| 402 | |
| 403 | put_bits(&s->pb, 1, s->dc_table_index); |
| 404 | |
| 405 | put_bits(&s->pb, 1, s->mv_table_index); |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | s->esc3_level_length= 0; |
| 410 | s->esc3_run_length= 0; |
| 411 | } |
no test coverage detected