static void set_frame_params (const FrameParams& my_frame_params, dirac_decoder_t *decoder) { TEST (decoder != NULL); dirac_frameparams_t *frame_params = &decoder->frame_params; TEST (decoder->state == STATE_PICTURE_AVAIL || decoder->state == STATE_PICTURE_START); frame_params->ftype = my_frame_params.FSort().IsIntra() ? INTRA_FRAME : INTER_FRAME; frame_params->rtype = my_frame_params.FSort().IsRef() ? REFERENCE_FRAME : NON_REFERENCE_FRAME; frame_params->fnum = my_frame_params.FrameNum(); return; }
static void set_frame_params (const FrameParams& my_frame_params, dirac_decoder_t *decoder) { TEST (decoder != NULL); dirac_frameparams_t *frame_params = &decoder->frame_params; TEST (decoder->state == STATE_PICTURE_AVAIL || decoder->state == STATE_PICTURE_START); frame_params->ftype = (dirac_frame_type_t)my_frame_params.FSort(); frame_params->fnum = my_frame_params.FrameNum(); return; }
void FrameCompressor::WriteFrameHeader( const FrameParams& fparams ) { BasicOutputManager& frame_header_op = m_encparams.BitsOut().FrameOutput().HeaderOutput(); // Write the frame start code unsigned char frame_start[5] = { START_CODE_PREFIX_BYTE0, START_CODE_PREFIX_BYTE1, START_CODE_PREFIX_BYTE2, START_CODE_PREFIX_BYTE3, IFRAME_START_CODE }; switch(fparams.FSort()) { case I_frame: frame_start[4] = IFRAME_START_CODE; break; case L1_frame: frame_start[4] = L1FRAME_START_CODE; break; case L2_frame: frame_start[4] = L2FRAME_START_CODE; break; default: // dirac_ASSERTM (false, "Frame type is I_frame or L1_frame or L2_frame"); break; } frame_header_op.OutputBytes((char *)frame_start, 5); // Write the frame number UnsignedGolombCode(frame_header_op , fparams.FrameNum()); //write whether the frame is m_skipped or not frame_header_op.OutputBit( m_skipped ); if (!m_skipped) {// If we're not m_skipped, then we write the rest of the metadata // Write the expiry time relative to the frame number UnsignedGolombCode( frame_header_op , fparams.ExpiryTime() ); // Write the frame sort UnsignedGolombCode( frame_header_op , (unsigned int) fparams.FSort() ); if (fparams.FSort() != I_frame) { // If not an I-frame, write how many references there are UnsignedGolombCode( frame_header_op , (unsigned int) fparams.Refs().size() ); // For each reference, write the reference number relative to the frame number for ( size_t i=0 ; i<fparams.Refs().size() ; ++i ) GolombCode( frame_header_op , fparams.Refs()[i]-fparams.FrameNum() ); // Indicate whether or not there is global motion vector data frame_header_op.OutputBit( m_use_global ); // Indicate whether or not there is block motion vector data frame_header_op.OutputBit( m_use_block_mv ); // If there is global but no block motion vector data, indicate the // prediction mode to use for the whole frame if ( m_use_global && !m_use_block_mv ) { UnsignedGolombCode( frame_header_op , (unsigned int) m_global_pred_mode ); } } }// ?m_skipped }