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

int encode_one_slice (ImageParameters *p_Img, InputParameters *p_Inp, int SliceGroupId, int TotalCodedMBs)
int encode_one_slice_MBAFF (ImageParameters *p_Img, InputParameters *p_Inp, int SliceGroupId, int TotalCodedMBs)
void init_slice (ImageParameters *p_Img, InputParameters *p_Inp, Slice **currSlice, int start_mb_addr)
void free_slice_list (Picture *currPic)
void SetLambda (ImageParameters *p_Img, InputParameters *p_Inp, int j, int qp, double lambda_scale)
void SetLagrangianMultipliersOn (ImageParameters *p_Img, InputParameters *p_Inp)
void SetLagrangianMultipliersOff (ImageParameters *p_Img, InputParameters *p_Inp)

Variables

static const int QP2QUANT [40]


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 ( ImageParameters p_Img,
InputParameters p_Inp,
int  SliceGroupId,
int  TotalCodedMBs 
)

int encode_one_slice_MBAFF ( ImageParameters p_Img,
InputParameters p_Inp,
int  SliceGroupId,
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 554 of file slice.c.

References img_par::AdaptiveRounding, inp_par_enc::AdaptRndPeriod, CalculateOffset4x4Param(), CalculateOffset8x8Param(), change_plane_JV(), img_par::cod_counter, img_par::colour_plane_id, copy_rdopt_data(), end_encode_one_macroblock(), end_macroblock(), error(), errortext, ET_SIZE, img_par::field_mode, FmoGetLastCodedMBOfSliceGroup(), FmoGetNextMBNr(), FmoGetPreviousMBNr(), FmoMB2SliceGroup(), init_quant_4x4(), init_quant_8x8(), init_quant_Chroma(), init_slice(), img_par::masterQP, inp_par_enc::MbInterlace, img_par::MBPairIsField, next_macroblock(), inp_par_enc::num_ref_frames, macroblock::qp, img_par::qp, rc_copy_generic(), rc_copy_quadratic(), inp_par_enc::RCEnable, slice::slice_type, start_macroblock(), start_slice(), terminate_slice(), img_par::top_field, update_mv_limits(), and write_macroblock().

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:
Picture *currPic

Definition at line 1556 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_slice ( ImageParameters p_Img,
InputParameters p_Inp,
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 p_Img->currSlice

Definition at line 1058 of file slice.c.

References slice::all_mv, alloc_colocated(), allocate_block_mem(), inp_par_enc::B_List0_refs, inp_par_enc::B_List1_refs, slice::bipred_mv, inp_par_enc::BiPredMotionEstimation, Bitstream::bits_to_go, Bitstream::byte_buf, Bitstream::byte_pos, img_par::colour_plane_id, compute_colocated(), compute_colocated_JV(), img_par::currentPicture, img_par::currentSlice, img_par::direct_spatial_mv_pred_flag, dummy_slice_too_big(), inp_par_enc::EnableOpenGOP, EPZSSliceInit(), EPZSStructInit(), error(), img_par::frame_num, img_par::framepoc, Get_Direct_MV_Spatial_MBAFF(), Get_Direct_MV_Spatial_Normal(), Get_Direct_MV_Temporal(), get_mem2D(), get_mem3D(), get_mem3Dint(), get_mem3Dpel(), get_mem4Dmv(), get_mem4Dpel(), get_mem_ACcoeff(), get_mem_bipred_mv(), get_mem_DCcoeff(), get_mem_mv(), img_par::height, img_par::height_blk, init_coding_state_methods(), init_lists(), init_mbaff_lists(), init_rdopt(), init_rdoq_slice(), init_ref_pic_list_reordering(), InitWP(), malloc_slice(), img_par::max_num_references, img_par::MbaffFrameFlag, inp_par_enc::MbInterlace, no_mem_exit(), img_par::number, inp_par_enc::NumRefPrimary, storable_picture::p_curr_img, storable_picture::p_curr_img_sub, storable_picture::p_img, storable_picture::p_img_sub, inp_par_enc::P_List0_refs, inp_par_enc::partition_mode, poc_based_ref_management_field_pic(), poc_based_ref_management_frame_pic(), inp_par_enc::PocMemoryManagement, img_par::qp, slice::rddata_trellis_curr, inp_par_enc::RDPictureDecision, reorder_lists(), reorder_ref_pic_list(), set_ref_pic_num(), inp_par_enc::SetFirstAsLongTerm, SetMotionVectorsMBBSlice(), SetMotionVectorsMBPSlice(), img_par::structure, img_par::ThisPOC, img_par::width, img_par::width_blk, wp_mcprec_reorder_lists(), and wpxAdaptRefNum().

Referenced by encode_one_slice(), and encode_one_slice_MBAFF().

Here is the call graph for this function:


Variable Documentation

const int QP2QUANT[40] [static]

Initial value:

{
   1, 1, 1, 1, 2, 2, 2, 2,
   3, 3, 3, 4, 4, 4, 5, 6,
   6, 7, 8, 9,10,11,13,14,
  16,18,20,23,25,29,32,36,
  40,45,51,57,64,72,81,91
}

Definition at line 27 of file slice.h.


Documentation generated with DoxyGen