示例#1
0
/*!
 ********************************************************************************************
 * \brief 
 *    Write a slice header
 ********************************************************************************************
*/
int  SliceHeader(int first_mb_in_slice)
{

  //ue_v(img.current_mb_nr);
  ue_v(first_mb_in_slice);
  ue_v(get_picture_type ());
  ue_v(0);

  //assert (img.frame_num < 1<<(LOG2_MAX_FRAME_NUM_MINUS4+4));  // check that it fits
  u_v (LOG2_MAX_FRAME_NUM_MINUS4 + 4, img.frame_num);

//added by eskim as what jjs said for another decoder to decode result stream, such as JM11 and GOM player 
if(img.number == 0)
  ue_v (0);

  img.pic_order_cnt_lsb = (img.framepoc & 0xff);
  u_v (LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4+4, img.pic_order_cnt_lsb);

  // ist there any sense in the following assignments ???

  if (img.type == P_SLICE)
  {
    // num_ref_idx_active_override_flag here always 1
    u_1 (1);
    ue_v (img.num_ref_idx_l0_active-1);
  }

  ref_pic_list_reordering();
  
  if (img.nal_reference_idc) 
    dec_ref_pic_marking();
  

  // we transmit zero in the pps, so here the real QP
  se_v((img.qp - 26));

  if (input.LFSendParameters)
  {
    ue_v(input.LFDisableIdc);  // Turn loop filter on/off on slice basis 

    if (input.LFDisableIdc!=1)
    {
      se_v (input.LFAlphaC0Offset / 2);
      se_v (input.LFBetaOffset / 2);
    }
  }

  //MSG(SLICE_HEADER);
  return 0;
}
示例#2
0
  int dP_nr = assignSE2partition[currSlice->partition_mode][SE_HEADER];
  Bitstream *bitstream = currSlice->partArr[dP_nr].bitstream;   
  int len = 0;
  unsigned int field_pic_flag = 0; 
  byte bottom_field_flag = 0;

  int num_bits_slice_group_change_cycle;
  float numtmp;

  if (currSlice->mb_aff_frame_flag)
    len  = write_ue_v("SH: first_mb_in_slice", p_Vid->current_mb_nr >> 1,   bitstream);
  else
    len  = write_ue_v("SH: first_mb_in_slice", p_Vid->current_mb_nr,   bitstream);

  len += write_ue_v("SH: slice_type", get_picture_type (currSlice),   bitstream);

  len += write_ue_v("SH: pic_parameter_set_id" , active_pps->pic_parameter_set_id ,bitstream);

  if( active_sps->separate_colour_plane_flag == 1 )
    len += write_u_v( 2, "SH: colour_plane_id", p_Vid->colour_plane_id, bitstream );

#if (MVC_EXTENSION_ENABLE)
  //if(p_Vid->num_of_layers==2)
  //  len += write_u_v (p_Vid->log2_max_frame_num_minus4 + 4,"SH: frame_num", p_Vid->frame_num/2, bitstream);
  //else
    len += write_u_v (p_Vid->log2_max_frame_num_minus4 + 4,"SH: frame_num", p_Vid->frame_num, bitstream);
#else
  len += write_u_v (p_Vid->log2_max_frame_num_minus4 + 4,"SH: frame_num", p_Vid->frame_num, bitstream);
#endif
示例#3
0
{
  int dP_nr = assignSE2partition[input->partition_mode][SE_HEADER];
  Bitstream *bitstream = img->currentSlice->partArr[dP_nr].bitstream;
  Slice* currSlice = img->currentSlice;
  int len = 0;
  unsigned int field_pic_flag = 0, bottom_field_flag = 0;

  int num_bits_slice_group_change_cycle;
  float numtmp;	
	
  if (img->MbaffFrameFlag)
    len  = ue_v("SH: first_mb_in_slice", img->current_mb_nr >> 1,   bitstream);
  else
    len  = ue_v("SH: first_mb_in_slice", img->current_mb_nr,   bitstream);

  len += ue_v("SH: slice_type",        get_picture_type (),   bitstream);

  len += ue_v("SH: pic_parameter_set_id" , active_pps->pic_parameter_set_id ,bitstream);

  len += u_v (log2_max_frame_num_minus4 + 4,"SH: frame_num", img->frame_num, bitstream);

  if (!active_sps->frame_mbs_only_flag)
  {
    // field_pic_flag    u(1)
    field_pic_flag = (img->structure ==TOP_FIELD || img->structure ==BOTTOM_FIELD)?1:0;
    assert( field_pic_flag == img->fld_flag );
    len += u_1("SH: field_pic_flag", field_pic_flag, bitstream);

    if (field_pic_flag)
    {
      //bottom_field_flag     u(1)