slice.h File Reference

Headerfile for slice-related functions. More...

#include "global.h"
#include "mbuffer.h"
#include "rdopt_coding_state.h"

Include dependency graph for slice.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void poc_ref_pic_reorder_frame (Slice *currSlice, StorablePicture **list, unsigned num_ref_idx_lX_active, int *reordering_of_pic_nums_idc, int *abs_diff_pic_num_minus1, int *long_term_pic_idx, int list_no)
void poc_ref_pic_reorder_field (Slice *currSlice, StorablePicture **list, unsigned num_ref_idx_lX_active, int *reordering_of_pic_nums_idc, int *abs_diff_pic_num_minus1, int *long_term_pic_idx, int list_no)
void init_ref_pic_list_reordering (Slice *currSlice)
int encode_one_slice (int SliceGroupId, Picture *pic, int TotalCodedMBs)
int encode_one_slice_MBAFF (int SliceGroupId, Picture *pic, int TotalCodedMBs)
void init_slice (Slice **currSlice, int start_mb_addr)
void free_slice_list (Picture *currPic)
void SetLambda (int j, int qp, double lambda_scale)
void SetLagrangianMultipliersOn (void)
void SetLagrangianMultipliersOff (void)

Variables

CSptr cs_mb
CSptr cs_b8
CSptr cs_cm
CSptr cs_ib8
CSptr cs_ib4
pic_parameter_set_rbsp_t * PicParSet [MAXPPS]


Detailed Description

Headerfile for slice-related functions.

slice.h

Date:
16 July 2008
Author:
Main contributors (see contributors.h for copyright, address and affiliation details)

Definition in file slice.h.


Function Documentation

int encode_one_slice ( int  SliceGroupId,
Picture *  pic,
int  TotalCodedMBs 
)

int encode_one_slice_MBAFF ( int  SliceGroupId,
Picture *  pic,
int  TotalCodedMBs 
)

Encodes one slice (MBAFF Frame).

returns the number of coded MBs in the SLice

This following ugly code breaks slices, at least for a slice mode that accumulates a certain number of bits into one slice. The suggested algorithm is as follows:

SaveState (Bitstream, stats, etc. etc.); BitsForThisMBPairInFrameMode = CodeMB (Upper, FRAME_MODE) + CodeMB (Lower, FRAME_MODE); DistortionForThisMBPairInFrameMode = CalculateDistortion(Upper) + CalculateDistortion (Lower); RestoreState(); BitsForThisMBPairInFieldMode = CodeMB (Upper, FIELD_MODE) + CodeMB (Lower, FIELD_MODE); DistortionForThisMBPairInFrameMode = CalculateDistortion(Upper) + CalculateDistortion (Lower); FrameFieldMode = Decision (...) RestoreState() if (FrameFieldMode == FRAME) { CodeMB (Upper, FRAME); CodeMB (Lower, FRAME); } else { CodeMB (Upper FIELD); CodeMB (Lower, FIELD); }

Open questions/issues: 1. CABAC/CA-VLC state: It seems that the CABAC/CA_VLC states are changed during the dummy encoding processes (for the R-D based selection), but that they are never reset, once the selection is made. I believe that this breaks the MB-adaptive frame/field coding. The necessary code for the state saves is readily available in macroblock.c, start_macroblock() and end_macroblock() (this code needs to be double checked that it works with CA-VLC as well 2. would it be an option to allocate Bitstreams with zero data in them (or copy the already generated bitstream) for the "test coding"?

Go back to the previous MB to recode it

Definition at line 415 of file slice.c.

References ImageParameters::AdaptiveRounding, InputParameters::AdaptRndPeriod, ImageParameters::BasicUnit, ImageParameters::bot_MB, ImageParameters::buf_cycle, CalculateOffset8Param(), CalculateOffsetParam(), change_plane_JV(), ImageParameters::checkref, ImageParameters::cod_counter, ImageParameters::colour_plane_id, copy_rdopt_data(), ImageParameters::current_mb_nr, end_macroblock(), error(), errortext, ET_SIZE, ImageParameters::field_mode, FmoGetLastCodedMBOfSliceGroup(), FmoGetNextMBNr(), FmoGetPreviousMBNr(), FmoMB2SliceGroup(), init_quant_4x4(), init_quant_8x8(), init_quant_Chroma(), init_slice(), ImageParameters::masterQP, InputParameters::MbInterlace, MBPairIsField, RD_DATA::min_rdcost, next_macroblock(), InputParameters::num_ref_frames, ImageParameters::num_ref_idx_l0_active, ImageParameters::NumberofCodedMacroBlocks, ImageParameters::PicSizeInMbs, macroblock::qp, ImageParameters::qp, rc_copy_generic(), rc_copy_quadratic(), InputParameters::RCEnable, InputParameters::RCUpdateMode, rddata_bot_field_mb, rddata_bot_frame_mb, InputParameters::rdopt, InputParameters::RestrictRef, start_macroblock(), start_slice(), storable_picture::stats, ImageParameters::SumFrameQP, Slice::symbol_mode, terminate_slice(), ImageParameters::top_field, InputParameters::Transform8x8Mode, ImageParameters::type, update_mv_limits(), write_macroblock(), ImageParameters::write_macroblock, and ImageParameters::write_mbaff_frame.

Referenced by code_a_plane().

Here is the call graph for this function:

void free_slice_list ( Picture *  currPic  ) 

Memory frees of all Slice structures and of its dependent data structures.

Input:
Image Parameters struct struct img_par *img

Definition at line 1170 of file slice.c.

References free_nal_unit(), and free_slice().

Referenced by encode_one_frame(), and free_picture().

Here is the call graph for this function:

void init_ref_pic_list_reordering ( Slice *  currSlice  ) 

init_ref_pic_list_reordering initializations should go here

Definition at line 74 of file slice.c.

References Slice::ref_pic_list_reordering_flag_l0, and Slice::ref_pic_list_reordering_flag_l1.

Referenced by init_slice().

void init_slice ( Slice **  currSlice,
int  start_mb_addr 
)

Initializes the parameters for a new slice and allocates the memory for the coded slice in the Picture structure.

Side effects:
Adds slice/partition header symbols to the symbol buffer increments Picture->no_slices, allocates memory for the slice, sets img->currSlice

Definition at line 767 of file slice.c.

References alloc_ref_pic_list_reordering_buffer(), InputParameters::B_List0_refs, InputParameters::B_List1_refs, Bitstream::bits_to_go, datapartition::bitstream, Bitstream::byte_buf, Bitstream::byte_pos, ImageParameters::colour_plane_id, compute_colocated(), compute_colocated_JV(), ImageParameters::current_mb_nr, ImageParameters::currentPicture, ImageParameters::currentSlice, dummy_slice_too_big(), InputParameters::EnableOpenGOP, EPZSSliceInit(), error(), ImageParameters::frame_no, ImageParameters::frame_num, InputParameters::GenerateMultiplePPS, init_lists(), init_mbaff_lists(), init_rdoq_slice(), init_ref_pic_list_reordering(), InitWP(), ImageParameters::last_valid_reference, malloc_slice(), ImageParameters::MbaffFrameFlag, ImageParameters::nal_reference_idc, ImageParameters::num_ref_idx_l0_active, ImageParameters::num_ref_idx_l1_active, ImageParameters::number, InputParameters::NumRefPrimary, storable_picture::p_curr_img, storable_picture::p_curr_img_sub, storable_picture::p_img, storable_picture::p_img_sub, InputParameters::P_List0_refs, Slice::picture_id, poc_based_ref_management_field_pic(), poc_based_ref_management_frame_pic(), poc_ref_pic_reorder_field(), poc_ref_pic_reorder_frame(), InputParameters::PocMemoryManagement, ImageParameters::qp, InputParameters::RDPictureDecision, InputParameters::redundant_pic_flag, decoded_picture_buffer::ref_frames_in_buffer, InputParameters::ReferenceReorder, reorder_ref_pic_list(), InputParameters::SearchMode, set_ref_pic_num(), ImageParameters::structure, ImageParameters::ThisPOC, ImageParameters::type, InputParameters::UseRDOQuant, InputParameters::WPMCPrecFullRef, InputParameters::WPMCPrecision, wpxAdaptRefNum(), wpxReorderLists(), writeB8_typeInfo_CABAC(), writeCBP_CABAC(), writeCBP_VLC(), writeCIPredMode_CABAC(), writeDquant_CABAC(), writeFieldModeInfo_CABAC(), writeIntraPredMode_CABAC(), writeIntraPredMode_CAVLC(), writeMB_transform_size_CABAC(), writeMB_typeInfo_CABAC(), writeMVD_CABAC(), writeRefFrame_CABAC(), writeSE_Dummy(), writeSE_Flag(), writeSE_invFlag(), writeSE_SVLC(), and writeSE_UVLC().

Referenced by encode_one_slice(), and encode_one_slice_MBAFF().

Here is the call graph for this function:

void poc_ref_pic_reorder_field ( Slice *  currSlice,
StorablePicture **  list,
unsigned  num_ref_idx_lX_active,
int *  reordering_of_pic_nums_idc,
int *  abs_diff_pic_num_minus1,
int *  long_term_pic_idx,
int  list_no 
)

void poc_ref_pic_reorder_frame ( Slice *  currSlice,
StorablePicture **  list,
unsigned  num_ref_idx_lX_active,
int *  reordering_of_pic_nums_idc,
int *  abs_diff_pic_num_minus1,
int *  long_term_pic_idx,
int  list_no 
)


Documentation generated with DoxyGen