Lines Matching refs:bs

2473 bitstream_start(bitstream *bs)  in bitstream_start()  argument
2475 bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING; in bitstream_start()
2476 bs->buffer = (unsigned int *)calloc(bs->max_size_in_dword * sizeof(int), 1); in bitstream_start()
2477 bs->bit_offset = 0; in bitstream_start()
2481 bitstream_end(bitstream *bs) in bitstream_end() argument
2483 int pos = (bs->bit_offset >> 5); in bitstream_end()
2484 int bit_offset = (bs->bit_offset & 0x1f); in bitstream_end()
2488 bs->buffer[pos] = swap32((bs->buffer[pos] << bit_left)); in bitstream_end()
2493 bitstream_put_ui(bitstream *bs, unsigned int val, int size_in_bits) in bitstream_put_ui() argument
2495 int pos = (bs->bit_offset >> 5); in bitstream_put_ui()
2496 int bit_offset = (bs->bit_offset & 0x1f); in bitstream_put_ui()
2502 bs->bit_offset += size_in_bits; in bitstream_put_ui()
2505 bs->buffer[pos] = (bs->buffer[pos] << size_in_bits | val); in bitstream_put_ui()
2508 bs->buffer[pos] = (bs->buffer[pos] << bit_left) | (val >> size_in_bits); in bitstream_put_ui()
2509 bs->buffer[pos] = swap32(bs->buffer[pos]); in bitstream_put_ui()
2511 if (pos + 1 == bs->max_size_in_dword) { in bitstream_put_ui()
2512 bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING; in bitstream_put_ui()
2513bs->buffer = (unsigned int *)realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int)); in bitstream_put_ui()
2516 bs->buffer[pos + 1] = val; in bitstream_put_ui()
2521 bitstream_put_ue(bitstream *bs, unsigned int val) in bitstream_put_ue() argument
2531 bitstream_put_ui(bs, 0, size_in_bits - 1); // leading zero in bitstream_put_ue()
2532 bitstream_put_ui(bs, val, size_in_bits); in bitstream_put_ue()
2536 bitstream_put_se(bitstream *bs, int val) in bitstream_put_se() argument
2545 bitstream_put_ue(bs, new_val); in bitstream_put_se()
2549 bitstream_byte_aligning(bitstream *bs, int bit) in bitstream_byte_aligning() argument
2551 int bit_offset = (bs->bit_offset & 0x7); in bitstream_byte_aligning()
2565 bitstream_put_ui(bs, new_val, bit_left); in bitstream_byte_aligning()
2569 rbsp_trailing_bits(bitstream *bs) in rbsp_trailing_bits() argument
2571 bitstream_put_ui(bs, 1, 1); in rbsp_trailing_bits()
2572 bitstream_byte_aligning(bs, 0); in rbsp_trailing_bits()
2575 static void nal_start_code_prefix(bitstream *bs) in nal_start_code_prefix() argument
2577 bitstream_put_ui(bs, 0x00000001, 32); in nal_start_code_prefix()
2580 static void nal_header(bitstream *bs, int nal_ref_idc, int nal_unit_type) in nal_header() argument
2582 bitstream_put_ui(bs, 0, 1); /* forbidden_zero_bit: 0 */ in nal_header()
2583 bitstream_put_ui(bs, nal_ref_idc, 2); in nal_header()
2584 bitstream_put_ui(bs, nal_unit_type, 5); in nal_header()
2587 static void sps_rbsp(bitstream *bs) in sps_rbsp() argument
2597 bitstream_put_ui(bs, profile_idc, 8); /* profile_idc */ in sps_rbsp()
2598 bitstream_put_ui(bs, 0, 1); /* constraint_set0_flag */ in sps_rbsp()
2599 bitstream_put_ui(bs, 1, 1); /* constraint_set1_flag */ in sps_rbsp()
2600 bitstream_put_ui(bs, 0, 1); /* constraint_set2_flag */ in sps_rbsp()
2601 bitstream_put_ui(bs, 0, 1); /* constraint_set3_flag */ in sps_rbsp()
2602 bitstream_put_ui(bs, 0, 4); /* reserved_zero_4bits */ in sps_rbsp()
2603 bitstream_put_ui(bs, seq_param->level_idc, 8); /* level_idc */ in sps_rbsp()
2604 bitstream_put_ue(bs, seq_param->seq_parameter_set_id); /* seq_parameter_set_id */ in sps_rbsp()
2606 …bitstream_put_ue(bs, seq_param->seq_fields.bits.log2_max_frame_num_minus4); /* log2_max_frame_num_… in sps_rbsp()
2607 …bitstream_put_ue(bs, seq_param->seq_fields.bits.pic_order_cnt_type); /* pic_order_cnt_type … in sps_rbsp()
2610 …bitstream_put_ue(bs, seq_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4); /* log2_ma… in sps_rbsp()
2615 bitstream_put_ue(bs, seq_param->max_num_ref_frames); /* num_ref_frames */ in sps_rbsp()
2616 …bitstream_put_ui(bs, 0, 1); /* gaps_in_frame_num_value_allowed_fla… in sps_rbsp()
2618 bitstream_put_ue(bs, seq_param->picture_width_in_mbs - 1); /* pic_width_in_mbs_minus1 */ in sps_rbsp()
2619 bitstream_put_ue(bs, seq_param->picture_height_in_mbs - 1); /* pic_height_in_map_units_minus1 */ in sps_rbsp()
2620 …bitstream_put_ui(bs, seq_param->seq_fields.bits.frame_mbs_only_flag, 1); /* frame_mbs_only_flag… in sps_rbsp()
2626 …bitstream_put_ui(bs, seq_param->seq_fields.bits.direct_8x8_inference_flag, 1); /* direct_8x8_… in sps_rbsp()
2627 bitstream_put_ui(bs, seq_param->frame_cropping_flag, 1); /* frame_cropping_flag */ in sps_rbsp()
2630 bitstream_put_ue(bs, seq_param->frame_crop_left_offset); /* frame_crop_left_offset */ in sps_rbsp()
2631 … bitstream_put_ue(bs, seq_param->frame_crop_right_offset); /* frame_crop_right_offset */ in sps_rbsp()
2632 bitstream_put_ue(bs, seq_param->frame_crop_top_offset); /* frame_crop_top_offset */ in sps_rbsp()
2633 … bitstream_put_ue(bs, seq_param->frame_crop_bottom_offset); /* frame_crop_bottom_offset */ in sps_rbsp()
2636 bitstream_put_ui(bs, 0, 1); /* vui_parameters_present_flag */ in sps_rbsp()
2637 rbsp_trailing_bits(bs); /* rbsp_trailing_bits */ in sps_rbsp()
2643 bitstream bs;
2645 bitstream_start(&bs);
2646 nal_start_code_prefix(&bs);
2647 nal_header(&bs, NAL_REF_IDC_HIGH, NAL_SPS);
2648 sps_rbsp(&bs);
2649 bitstream_end(&bs, avc_fp);
2653 static void pps_rbsp(bitstream *bs) in pps_rbsp() argument
2657 bitstream_put_ue(bs, pic_param->pic_parameter_set_id); /* pic_parameter_set_id */ in pps_rbsp()
2658 bitstream_put_ue(bs, pic_param->seq_parameter_set_id); /* seq_parameter_set_id */ in pps_rbsp()
2660 …bitstream_put_ui(bs, pic_param->pic_fields.bits.entropy_coding_mode_flag, 1); /* entropy_coding_m… in pps_rbsp()
2662 bitstream_put_ui(bs, 0, 1); /* pic_order_present_flag: 0 */ in pps_rbsp()
2664 bitstream_put_ue(bs, 0); /* num_slice_groups_minus1 */ in pps_rbsp()
2666 …bitstream_put_ue(bs, pic_param->num_ref_idx_l0_active_minus1); /* num_ref_idx_l0_active_minus… in pps_rbsp()
2667 …bitstream_put_ue(bs, pic_param->num_ref_idx_l1_active_minus1); /* num_ref_idx_l1_active_minus… in pps_rbsp()
2669 …bitstream_put_ui(bs, pic_param->pic_fields.bits.weighted_pred_flag, 1); /* weighted_pred_flag:… in pps_rbsp()
2670 …bitstream_put_ui(bs, pic_param->pic_fields.bits.weighted_bipred_idc, 2); /* weighted_bipred_idc: 0… in pps_rbsp()
2672 bitstream_put_se(bs, pic_param->pic_init_qp - 26); /* pic_init_qp_minus26 */ in pps_rbsp()
2673 bitstream_put_se(bs, 0); /* pic_init_qs_minus26 */ in pps_rbsp()
2674 bitstream_put_se(bs, 0); /* chroma_qp_index_offset */ in pps_rbsp()
2676 …bitstream_put_ui(bs, pic_param->pic_fields.bits.deblocking_filter_control_present_flag, 1); /* deb… in pps_rbsp()
2677 bitstream_put_ui(bs, 0, 1); /* constrained_intra_pred_flag */ in pps_rbsp()
2678 bitstream_put_ui(bs, 0, 1); /* redundant_pic_cnt_present_flag */ in pps_rbsp()
2680 rbsp_trailing_bits(bs); in pps_rbsp()
2686 bitstream bs;
2688 bitstream_start(&bs);
2689 nal_start_code_prefix(&bs);
2690 nal_header(&bs, NAL_REF_IDC_HIGH, NAL_PPS);
2691 pps_rbsp(&bs);
2692 bitstream_end(&bs, avc_fp);
2706 bitstream bs; in build_packed_pic_buffer() local
2708 bitstream_start(&bs); in build_packed_pic_buffer()
2709 nal_start_code_prefix(&bs); in build_packed_pic_buffer()
2710 nal_header(&bs, NAL_REF_IDC_HIGH, NAL_PPS); in build_packed_pic_buffer()
2711 pps_rbsp(&bs); in build_packed_pic_buffer()
2712 bitstream_end(&bs); in build_packed_pic_buffer()
2714 *header_buffer = (unsigned char *)bs.buffer; in build_packed_pic_buffer()
2715 return bs.bit_offset; in build_packed_pic_buffer()
2721 bitstream bs; in build_packed_seq_buffer() local
2723 bitstream_start(&bs); in build_packed_seq_buffer()
2724 nal_start_code_prefix(&bs); in build_packed_seq_buffer()
2725 nal_header(&bs, NAL_REF_IDC_HIGH, NAL_SPS); in build_packed_seq_buffer()
2726 sps_rbsp(&bs); in build_packed_seq_buffer()
2727 bitstream_end(&bs); in build_packed_seq_buffer()
2729 *header_buffer = (unsigned char *)bs.buffer; in build_packed_seq_buffer()
2730 return bs.bit_offset; in build_packed_seq_buffer()
2736 slice_header(bitstream *bs, int frame_num, int display_frame, int slice_type, int nal_ref_idc, int …
2742 bitstream_put_ue(bs, 0); /* first_mb_in_slice: 0 */
2743 bitstream_put_ue(bs, slice_type); /* slice_type */
2744 bitstream_put_ue(bs, 0); /* pic_parameter_set_id: 0 */
2745 …bitstream_put_ui(bs, frame_num & 0x0F, seq_param->seq_fields.bits.log2_max_frame_num_minus4 + 4); …
2754 bitstream_put_ue(bs, 0); /* idr_pic_id: 0 */
2757 …bitstream_put_ui(bs, (display_frame*2) & 0x3F, seq_param->seq_fields.bits.log2_max_pic_order_cnt_l…
2768 bitstream_put_ui(bs, 0, 1); /* num_ref_idx_active_override_flag: 0 */
2770 bitstream_put_ui(bs, 0, 1); /* ref_pic_list_reordering_flag_l0: 0 */
2772 bitstream_put_ui(bs, 1, 1); /* direct_spatial_mv_pred: 1 */
2773 bitstream_put_ui(bs, 0, 1); /* num_ref_idx_active_override_flag: 0 */
2775 bitstream_put_ui(bs, 0, 1); /* ref_pic_list_reordering_flag_l0: 0 */
2776 bitstream_put_ui(bs, 0, 1); /* ref_pic_list_reordering_flag_l1: 0 */
2784 bitstream_put_ui(bs, 0, 1); /* no_output_of_prior_pics_flag: 0 */
2785 bitstream_put_ui(bs, 0, 1); /* long_term_reference_flag: 0 */
2787 bitstream_put_ui(bs, 0, 1); /* adaptive_ref_pic_marking_mode_flag: 0 */
2792 bitstream_put_ue(bs, 0); /* cabac_init_idc: 0 */
2794 bitstream_put_se(bs, 0); /* slice_qp_delta: 0 */
2797 bitstream_put_ue(bs, 0); /* disable_deblocking_filter_idc: 0 */
2798 bitstream_put_se(bs, 2); /* slice_alpha_c0_offset_div2: 2 */
2799 bitstream_put_se(bs, 2); /* slice_beta_offset_div2: 2 */
2804 slice_data(bitstream *bs)
2826 bitstream_put_ui(bs, *coded_mem, 8);
2836 bitstream bs;
2838 bitstream_start(&bs);
2839 slice_data(&bs);
2840 bitstream_end(&bs, avc_fp);