<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 3, 2014 at 7:07 AM, <span dir="ltr"><<a href="mailto:ashok@multicorewareinc.com" target="_blank">ashok@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User <a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a><br>
# Date 1388754455 -19800<br>
# Fri Jan 03 18:37:35 2014 +0530<br>
# Node ID d1f5cad1ac2f4394616633751f1b885178848b49<br>
# Parent be8c07a80a181f9a20d51abd01b90ac9fe94f4ea<br>
Modify TEncSbac structure to support multiple color space formats<br></blockquote><div><br></div><div>the white-space changes make this more difficult to review than it should be, but it looks ok</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r be8c07a80a18 -r d1f5cad1ac2f source/Lib/TLibEncoder/TEncSbac.cpp<br>
--- a/source/Lib/TLibEncoder/TEncSbac.cpp Fri Jan 03 18:36:37 2014 +0530<br>
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp Fri Jan 03 18:37:35 2014 +0530<br>
@@ -327,21 +327,21 @@<br>
<br>
void TEncSbac::codeVPS(TComVPS* vps)<br>
{<br>
- WRITE_CODE(vps->getVPSId(), 4, "vps_video_parameter_set_id");<br>
- WRITE_CODE(3, 2, "vps_reserved_three_2bits");<br>
- WRITE_CODE(0, 6, "vps_reserved_zero_6bits");<br>
- WRITE_CODE(vps->getMaxTLayers() - 1, 3, "vps_max_sub_layers_minus1");<br>
- WRITE_FLAG(vps->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag");<br>
+ WRITE_CODE(vps->getVPSId(), 4, "vps_video_parameter_set_id");<br>
+ WRITE_CODE(3, 2, "vps_reserved_three_2bits");<br>
+ WRITE_CODE(0, 6, "vps_reserved_zero_6bits");<br>
+ WRITE_CODE(vps->getMaxTLayers() - 1, 3, "vps_max_sub_layers_minus1");<br>
+ WRITE_FLAG(vps->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag");<br>
assert(vps->getMaxTLayers() > 1 || vps->getTemporalNestingFlag());<br>
- WRITE_CODE(0xffff, 16, "vps_reserved_ffff_16bits");<br>
+ WRITE_CODE(0xffff, 16, "vps_reserved_ffff_16bits");<br>
codePTL(vps->getPTL(), true, vps->getMaxTLayers() - 1);<br>
const bool subLayerOrderingInfoPresentFlag = 1;<br>
- WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag");<br>
+ WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag");<br>
for (uint32_t i = 0; i <= vps->getMaxTLayers() - 1; i++)<br>
{<br>
- WRITE_UVLC(vps->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]");<br>
- WRITE_UVLC(vps->getNumReorderPics(i), "vps_num_reorder_pics[i]");<br>
- WRITE_UVLC(vps->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]");<br>
+ WRITE_UVLC(vps->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]");<br>
+ WRITE_UVLC(vps->getNumReorderPics(i), "vps_num_reorder_pics[i]");<br>
+ WRITE_UVLC(vps->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]");<br>
if (!subLayerOrderingInfoPresentFlag)<br>
{<br>
break;<br>
@@ -365,7 +365,7 @@<br>
}<br>
<br>
TimingInfo *timingInfo = vps->getTimingInfo();<br>
- WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag");<br>
+ WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag");<br>
if (timingInfo->getTimingInfoPresentFlag())<br>
{<br>
WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "vps_num_units_in_tick");<br>
@@ -373,10 +373,10 @@<br>
WRITE_FLAG(timingInfo->getPocProportionalToTimingFlag(), "vps_poc_proportional_to_timing_flag");<br>
if (timingInfo->getPocProportionalToTimingFlag())<br>
{<br>
- WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1");<br>
+ WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1");<br>
}<br>
vps->setNumHrdParameters(0);<br>
- WRITE_UVLC(vps->getNumHrdParameters(), "vps_num_hrd_parameters");<br>
+ WRITE_UVLC(vps->getNumHrdParameters(), "vps_num_hrd_parameters");<br>
<br>
if (vps->getNumHrdParameters() > 0)<br>
{<br>
@@ -459,9 +459,8 @@<br>
codePTL(sps->getPTL(), 1, sps->getMaxTLayers() - 1);<br>
WRITE_UVLC(sps->getSPSId(), "sps_seq_parameter_set_id");<br>
WRITE_UVLC(sps->getChromaFormatIdc(), "chroma_format_idc");<br>
- assert(sps->getChromaFormatIdc() == 1);<br>
- // in the first version chroma_format_idc can only be equal to 1 (4:2:0)<br>
- if (sps->getChromaFormatIdc() == 3)<br>
+<br>
+ if (sps->getChromaFormatIdc() == CHROMA_444)<br>
{<br>
WRITE_FLAG(0, "separate_colour_plane_flag");<br>
}<br>
@@ -479,13 +478,13 @@<br>
WRITE_UVLC(conf.m_winBottomOffset / TComSPS::getWinUnitY(sps->getChromaFormatIdc()), "conf_win_bottom_offset");<br>
}<br>
<br>
- WRITE_UVLC(sps->getBitDepthY() - 8, "bit_depth_luma_minus8");<br>
- WRITE_UVLC(sps->getBitDepthC() - 8, "bit_depth_chroma_minus8");<br>
+ WRITE_UVLC(sps->getBitDepthY() - 8, "bit_depth_luma_minus8");<br>
+ WRITE_UVLC(sps->getBitDepthC() - 8, "bit_depth_chroma_minus8");<br>
<br>
WRITE_UVLC(sps->getBitsForPOC() - 4, "log2_max_pic_order_cnt_lsb_minus4");<br>
<br>
const bool subLayerOrderingInfoPresentFlag = 1;<br>
- WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");<br>
+ WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");<br>
for (uint32_t i = 0; i <= sps->getMaxTLayers() - 1; i++)<br>
{<br>
WRITE_UVLC(sps->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]");<br>
@@ -502,13 +501,13 @@<br>
WRITE_UVLC(sps->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3");<br>
WRITE_UVLC(sps->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size");<br>
WRITE_UVLC(sps->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2");<br>
- WRITE_UVLC(sps->getQuadtreeTULog2MaxSize() - sps->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size");<br>
+ WRITE_UVLC(sps->getQuadtreeTULog2MaxSize() - sps->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size");<br>
WRITE_UVLC(sps->getQuadtreeTUMaxDepthInter() - 1, "max_transform_hierarchy_depth_inter");<br>
WRITE_UVLC(sps->getQuadtreeTUMaxDepthIntra() - 1, "max_transform_hierarchy_depth_intra");<br>
WRITE_FLAG(sps->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag");<br>
if (sps->getScalingListFlag())<br>
{<br>
- WRITE_FLAG(sps->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag");<br>
+ WRITE_FLAG(sps->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag");<br>
if (sps->getScalingListPresentFlag())<br>
{<br>
#if SCALING_LIST_OUTPUT_RESULT<br>
@@ -517,17 +516,17 @@<br>
codeScalingList(m_slice->getScalingList());<br>
}<br>
}<br>
- WRITE_FLAG(sps->getUseAMP() ? 1 : 0, "amp_enabled_flag");<br>
- WRITE_FLAG(sps->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag");<br>
+ WRITE_FLAG(sps->getUseAMP() ? 1 : 0, "amp_enabled_flag");<br>
+ WRITE_FLAG(sps->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag");<br>
<br>
- WRITE_FLAG(sps->getUsePCM() ? 1 : 0, "pcm_enabled_flag");<br>
+ WRITE_FLAG(sps->getUsePCM() ? 1 : 0, "pcm_enabled_flag");<br>
if (sps->getUsePCM())<br>
{<br>
WRITE_CODE(sps->getPCMBitDepthLuma() - 1, 4, "pcm_sample_bit_depth_luma_minus1");<br>
WRITE_CODE(sps->getPCMBitDepthChroma() - 1, 4, "pcm_sample_bit_depth_chroma_minus1");<br>
WRITE_UVLC(sps->getPCMLog2MinSize() - 3, "log2_min_pcm_luma_coding_block_size_minus3");<br>
- WRITE_UVLC(sps->getPCMLog2MaxSize() - sps->getPCMLog2MinSize(), "log2_diff_max_min_pcm_luma_coding_block_size");<br>
- WRITE_FLAG(sps->getPCMFilterDisableFlag() ? 1 : 0, "pcm_loop_filter_disable_flag");<br>
+ WRITE_UVLC(sps->getPCMLog2MaxSize() - sps->getPCMLog2MinSize(), "log2_diff_max_min_pcm_luma_coding_block_size");<br>
+ WRITE_FLAG(sps->getPCMFilterDisableFlag() ? 1 : 0, "pcm_loop_filter_disable_flag");<br>
}<br>
<br>
assert(sps->getMaxTLayers() > 0);<br>
@@ -571,47 +570,47 @@<br>
xTracePPSHeader(pps);<br>
#endif<br>
<br>
- WRITE_UVLC(pps->getPPSId(), "pps_pic_parameter_set_id");<br>
- WRITE_UVLC(pps->getSPSId(), "pps_seq_parameter_set_id");<br>
- WRITE_FLAG(0, "dependent_slice_segments_enabled_flag");<br>
- WRITE_FLAG(pps->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag");<br>
- WRITE_CODE(pps->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");<br>
- WRITE_FLAG(pps->getSignHideFlag(), "sign_data_hiding_flag");<br>
- WRITE_FLAG(pps->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag");<br>
- WRITE_UVLC(pps->getNumRefIdxL0DefaultActive() - 1, "num_ref_idx_l0_default_active_minus1");<br>
- WRITE_UVLC(pps->getNumRefIdxL1DefaultActive() - 1, "num_ref_idx_l1_default_active_minus1");<br>
+ WRITE_UVLC(pps->getPPSId(), "pps_pic_parameter_set_id");<br>
+ WRITE_UVLC(pps->getSPSId(), "pps_seq_parameter_set_id");<br>
+ WRITE_FLAG(0, "dependent_slice_segments_enabled_flag");<br>
+ WRITE_FLAG(pps->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag");<br>
+ WRITE_CODE(pps->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");<br>
+ WRITE_FLAG(pps->getSignHideFlag(), "sign_data_hiding_flag");<br>
+ WRITE_FLAG(pps->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag");<br>
+ WRITE_UVLC(pps->getNumRefIdxL0DefaultActive() - 1, "num_ref_idx_l0_default_active_minus1");<br>
+ WRITE_UVLC(pps->getNumRefIdxL1DefaultActive() - 1, "num_ref_idx_l1_default_active_minus1");<br>
<br>
- WRITE_SVLC(pps->getPicInitQPMinus26(), "init_qp_minus26");<br>
- WRITE_FLAG(pps->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag");<br>
- WRITE_FLAG(pps->getUseTransformSkip() ? 1 : 0, "transform_skip_enabled_flag");<br>
- WRITE_FLAG(pps->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag");<br>
+ WRITE_SVLC(pps->getPicInitQPMinus26(), "init_qp_minus26");<br>
+ WRITE_FLAG(pps->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag");<br>
+ WRITE_FLAG(pps->getUseTransformSkip() ? 1 : 0, "transform_skip_enabled_flag");<br>
+ WRITE_FLAG(pps->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag");<br>
if (pps->getUseDQP())<br>
{<br>
- WRITE_UVLC(pps->getMaxCuDQPDepth(), "diff_cu_qp_delta_depth");<br>
+ WRITE_UVLC(pps->getMaxCuDQPDepth(), "diff_cu_qp_delta_depth");<br>
}<br>
- WRITE_SVLC(pps->getChromaCbQpOffset(), "pps_cb_qp_offset");<br>
- WRITE_SVLC(pps->getChromaCrQpOffset(), "pps_cr_qp_offset");<br>
- WRITE_FLAG(pps->getSliceChromaQpFlag() ? 1 : 0, "pps_slice_chroma_qp_offsets_present_flag");<br>
+ WRITE_SVLC(pps->getChromaCbQpOffset(), "pps_cb_qp_offset");<br>
+ WRITE_SVLC(pps->getChromaCrQpOffset(), "pps_cr_qp_offset");<br>
+ WRITE_FLAG(pps->getSliceChromaQpFlag() ? 1 : 0, "pps_slice_chroma_qp_offsets_present_flag");<br>
<br>
- WRITE_FLAG(pps->getUseWP() ? 1 : 0, "weighted_pred_flag"); // Use of Weighting Prediction (P_SLICE)<br>
- WRITE_FLAG(pps->getWPBiPred() ? 1 : 0, "weighted_bipred_flag"); // Use of Weighting Bi-Prediction (B_SLICE)<br>
- WRITE_FLAG(pps->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag");<br>
- WRITE_FLAG(0, "tiles_enabled_flag");<br>
- WRITE_FLAG(pps->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "entropy_coding_sync_enabled_flag");<br>
- WRITE_FLAG(1, "loop_filter_across_slices_enabled_flag");<br>
+ WRITE_FLAG(pps->getUseWP() ? 1 : 0, "weighted_pred_flag"); // Use of Weighting Prediction (P_SLICE)<br>
+ WRITE_FLAG(pps->getWPBiPred() ? 1 : 0, "weighted_bipred_flag"); // Use of Weighting Bi-Prediction (B_SLICE)<br>
+ WRITE_FLAG(pps->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag");<br>
+ WRITE_FLAG(0, "tiles_enabled_flag");<br>
+ WRITE_FLAG(pps->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "entropy_coding_sync_enabled_flag");<br>
+ WRITE_FLAG(1, "loop_filter_across_slices_enabled_flag");<br>
// TODO: Here have some time sequence problem, we set below field in initEncSlice(), but use them in getStreamHeaders() early<br>
- WRITE_FLAG(pps->getDeblockingFilterControlPresentFlag() ? 1 : 0, "deblocking_filter_control_present_flag");<br>
+ WRITE_FLAG(pps->getDeblockingFilterControlPresentFlag() ? 1 : 0, "deblocking_filter_control_present_flag");<br>
if (pps->getDeblockingFilterControlPresentFlag())<br>
{<br>
- WRITE_FLAG(pps->getDeblockingFilterOverrideEnabledFlag() ? 1 : 0, "deblocking_filter_override_enabled_flag");<br>
- WRITE_FLAG(pps->getPicDisableDeblockingFilterFlag() ? 1 : 0, "pps_disable_deblocking_filter_flag");<br>
+ WRITE_FLAG(pps->getDeblockingFilterOverrideEnabledFlag() ? 1 : 0, "deblocking_filter_override_enabled_flag");<br>
+ WRITE_FLAG(pps->getPicDisableDeblockingFilterFlag() ? 1 : 0, "pps_disable_deblocking_filter_flag");<br>
if (!pps->getPicDisableDeblockingFilterFlag())<br>
{<br>
- WRITE_SVLC(pps->getDeblockingFilterBetaOffsetDiv2(), "pps_beta_offset_div2");<br>
- WRITE_SVLC(pps->getDeblockingFilterTcOffsetDiv2(), "pps_tc_offset_div2");<br>
+ WRITE_SVLC(pps->getDeblockingFilterBetaOffsetDiv2(), "pps_beta_offset_div2");<br>
+ WRITE_SVLC(pps->getDeblockingFilterTcOffsetDiv2(), "pps_tc_offset_div2");<br>
}<br>
}<br>
- WRITE_FLAG(pps->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag");<br>
+ WRITE_FLAG(pps->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag");<br>
if (pps->getScalingListPresentFlag())<br>
{<br>
#if SCALING_LIST_OUTPUT_RESULT<br>
@@ -619,9 +618,9 @@<br>
#endif<br>
codeScalingList(m_slice->getScalingList());<br>
}<br>
- WRITE_FLAG(pps->getListsModificationPresentFlag(), "lists_modification_present_flag");<br>
- WRITE_UVLC(pps->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");<br>
- WRITE_FLAG(pps->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");<br>
+ WRITE_FLAG(pps->getListsModificationPresentFlag(), "lists_modification_present_flag");<br>
+ WRITE_UVLC(pps->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");<br>
+ WRITE_FLAG(pps->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");<br>
WRITE_FLAG(0, "pps_extension_flag");<br>
}<br>
<br>
@@ -630,83 +629,83 @@<br>
#if ENC_DEC_TRACE<br>
fprintf(g_hTrace, "----------- vui_parameters -----------\n");<br>
#endif<br>
- WRITE_FLAG(vui->getAspectRatioInfoPresentFlag(), "aspect_ratio_info_present_flag");<br>
+ WRITE_FLAG(vui->getAspectRatioInfoPresentFlag(), "aspect_ratio_info_present_flag");<br>
if (vui->getAspectRatioInfoPresentFlag())<br>
{<br>
- WRITE_CODE(vui->getAspectRatioIdc(), 8, "aspect_ratio_idc");<br>
+ WRITE_CODE(vui->getAspectRatioIdc(), 8, "aspect_ratio_idc");<br>
if (vui->getAspectRatioIdc() == 255)<br>
{<br>
- WRITE_CODE(vui->getSarWidth(), 16, "sar_width");<br>
- WRITE_CODE(vui->getSarHeight(), 16, "sar_height");<br>
+ WRITE_CODE(vui->getSarWidth(), 16, "sar_width");<br>
+ WRITE_CODE(vui->getSarHeight(), 16, "sar_height");<br>
}<br>
}<br>
- WRITE_FLAG(vui->getOverscanInfoPresentFlag(), "overscan_info_present_flag");<br>
+ WRITE_FLAG(vui->getOverscanInfoPresentFlag(), "overscan_info_present_flag");<br>
if (vui->getOverscanInfoPresentFlag())<br>
{<br>
- WRITE_FLAG(vui->getOverscanAppropriateFlag(), "overscan_appropriate_flag");<br>
+ WRITE_FLAG(vui->getOverscanAppropriateFlag(), "overscan_appropriate_flag");<br>
}<br>
- WRITE_FLAG(vui->getVideoSignalTypePresentFlag(), "video_signal_type_present_flag");<br>
+ WRITE_FLAG(vui->getVideoSignalTypePresentFlag(), "video_signal_type_present_flag");<br>
if (vui->getVideoSignalTypePresentFlag())<br>
{<br>
- WRITE_CODE(vui->getVideoFormat(), 3, "video_format");<br>
- WRITE_FLAG(vui->getVideoFullRangeFlag(), "video_full_range_flag");<br>
- WRITE_FLAG(vui->getColourDescriptionPresentFlag(), "colour_description_present_flag");<br>
+ WRITE_CODE(vui->getVideoFormat(), 3, "video_format");<br>
+ WRITE_FLAG(vui->getVideoFullRangeFlag(), "video_full_range_flag");<br>
+ WRITE_FLAG(vui->getColourDescriptionPresentFlag(), "colour_description_present_flag");<br>
if (vui->getColourDescriptionPresentFlag())<br>
{<br>
- WRITE_CODE(vui->getColourPrimaries(), 8, "colour_primaries");<br>
- WRITE_CODE(vui->getTransferCharacteristics(), 8, "transfer_characteristics");<br>
- WRITE_CODE(vui->getMatrixCoefficients(), 8, "matrix_coefficients");<br>
+ WRITE_CODE(vui->getColourPrimaries(), 8, "colour_primaries");<br>
+ WRITE_CODE(vui->getTransferCharacteristics(), 8, "transfer_characteristics");<br>
+ WRITE_CODE(vui->getMatrixCoefficients(), 8, "matrix_coefficients");<br>
}<br>
}<br>
<br>
- WRITE_FLAG(vui->getChromaLocInfoPresentFlag(), "chroma_loc_info_present_flag");<br>
+ WRITE_FLAG(vui->getChromaLocInfoPresentFlag(), "chroma_loc_info_present_flag");<br>
if (vui->getChromaLocInfoPresentFlag())<br>
{<br>
- WRITE_UVLC(vui->getChromaSampleLocTypeTopField(), "chroma_sample_loc_type_top_field");<br>
- WRITE_UVLC(vui->getChromaSampleLocTypeBottomField(), "chroma_sample_loc_type_bottom_field");<br>
+ WRITE_UVLC(vui->getChromaSampleLocTypeTopField(), "chroma_sample_loc_type_top_field");<br>
+ WRITE_UVLC(vui->getChromaSampleLocTypeBottomField(), "chroma_sample_loc_type_bottom_field");<br>
}<br>
<br>
- WRITE_FLAG(vui->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag");<br>
- WRITE_FLAG(vui->getFieldSeqFlag(), "field_seq_flag");<br>
- WRITE_FLAG(vui->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag");<br>
+ WRITE_FLAG(vui->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag");<br>
+ WRITE_FLAG(vui->getFieldSeqFlag(), "field_seq_flag");<br>
+ WRITE_FLAG(vui->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag");<br>
<br>
Window defaultDisplayWindow = vui->getDefaultDisplayWindow();<br>
- WRITE_FLAG(defaultDisplayWindow.m_enabledFlag, "default_display_window_flag");<br>
+ WRITE_FLAG(defaultDisplayWindow.m_enabledFlag, "default_display_window_flag");<br>
if (defaultDisplayWindow.m_enabledFlag)<br>
{<br>
- WRITE_UVLC(defaultDisplayWindow.m_winLeftOffset, "def_disp_win_left_offset");<br>
- WRITE_UVLC(defaultDisplayWindow.m_winRightOffset, "def_disp_win_right_offset");<br>
- WRITE_UVLC(defaultDisplayWindow.m_winTopOffset, "def_disp_win_top_offset");<br>
- WRITE_UVLC(defaultDisplayWindow.m_winBottomOffset, "def_disp_win_bottom_offset");<br>
+ WRITE_UVLC(defaultDisplayWindow.m_winLeftOffset, "def_disp_win_left_offset");<br>
+ WRITE_UVLC(defaultDisplayWindow.m_winRightOffset, "def_disp_win_right_offset");<br>
+ WRITE_UVLC(defaultDisplayWindow.m_winTopOffset, "def_disp_win_top_offset");<br>
+ WRITE_UVLC(defaultDisplayWindow.m_winBottomOffset, "def_disp_win_bottom_offset");<br>
}<br>
TimingInfo *timingInfo = vui->getTimingInfo();<br>
- WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag");<br>
+ WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag");<br>
if (timingInfo->getTimingInfoPresentFlag())<br>
{<br>
- WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "vui_num_units_in_tick");<br>
- WRITE_CODE(timingInfo->getTimeScale(), 32, "vui_time_scale");<br>
- WRITE_FLAG(timingInfo->getPocProportionalToTimingFlag(), "vui_poc_proportional_to_timing_flag");<br>
+ WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "vui_num_units_in_tick");<br>
+ WRITE_CODE(timingInfo->getTimeScale(), 32, "vui_time_scale");<br>
+ WRITE_FLAG(timingInfo->getPocProportionalToTimingFlag(), "vui_poc_proportional_to_timing_flag");<br>
if (timingInfo->getPocProportionalToTimingFlag())<br>
{<br>
- WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1");<br>
+ WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1");<br>
}<br>
- WRITE_FLAG(vui->getHrdParametersPresentFlag(), "hrd_parameters_present_flag");<br>
+ WRITE_FLAG(vui->getHrdParametersPresentFlag(), "hrd_parameters_present_flag");<br>
if (vui->getHrdParametersPresentFlag())<br>
{<br>
codeHrdParameters(vui->getHrdParameters(), 1, sps->getMaxTLayers() - 1);<br>
}<br>
}<br>
- WRITE_FLAG(vui->getBitstreamRestrictionFlag(), "bitstream_restriction_flag");<br>
+ WRITE_FLAG(vui->getBitstreamRestrictionFlag(), "bitstream_restriction_flag");<br>
if (vui->getBitstreamRestrictionFlag())<br>
{<br>
- WRITE_FLAG(0, "tiles_fixed_structure_flag");<br>
- WRITE_FLAG(vui->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag");<br>
- WRITE_FLAG(vui->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag");<br>
- WRITE_UVLC(vui->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc");<br>
- WRITE_UVLC(vui->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom");<br>
- WRITE_UVLC(vui->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom");<br>
- WRITE_UVLC(vui->getLog2MaxMvLengthHorizontal(), "log2_max_mv_length_horizontal");<br>
- WRITE_UVLC(vui->getLog2MaxMvLengthVertical(), "log2_max_mv_length_vertical");<br>
+ WRITE_FLAG(0, "tiles_fixed_structure_flag");<br>
+ WRITE_FLAG(vui->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag");<br>
+ WRITE_FLAG(vui->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag");<br>
+ WRITE_UVLC(vui->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc");<br>
+ WRITE_UVLC(vui->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom");<br>
+ WRITE_UVLC(vui->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom");<br>
+ WRITE_UVLC(vui->getLog2MaxMvLengthHorizontal(), "log2_max_mv_length_horizontal");<br>
+ WRITE_UVLC(vui->getLog2MaxMvLengthVertical(), "log2_max_mv_length_vertical");<br>
}<br>
}<br>
<br>
@@ -714,36 +713,36 @@<br>
{<br>
if (commonInfPresentFlag)<br>
{<br>
- WRITE_FLAG(hrd->getNalHrdParametersPresentFlag() ? 1 : 0, "nal_hrd_parameters_present_flag");<br>
- WRITE_FLAG(hrd->getVclHrdParametersPresentFlag() ? 1 : 0, "vcl_hrd_parameters_present_flag");<br>
+ WRITE_FLAG(hrd->getNalHrdParametersPresentFlag() ? 1 : 0, "nal_hrd_parameters_present_flag");<br>
+ WRITE_FLAG(hrd->getVclHrdParametersPresentFlag() ? 1 : 0, "vcl_hrd_parameters_present_flag");<br>
if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())<br>
{<br>
- WRITE_FLAG(hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "sub_pic_cpb_params_present_flag");<br>
+ WRITE_FLAG(hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "sub_pic_cpb_params_present_flag");<br>
if (hrd->getSubPicCpbParamsPresentFlag())<br>
{<br>
- WRITE_CODE(hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2");<br>
- WRITE_CODE(hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1");<br>
- WRITE_FLAG(hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag");<br>
- WRITE_CODE(hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1");<br>
+ WRITE_CODE(hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2");<br>
+ WRITE_CODE(hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1");<br>
+ WRITE_FLAG(hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag");<br>
+ WRITE_CODE(hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1");<br>
}<br>
- WRITE_CODE(hrd->getBitRateScale(), 4, "bit_rate_scale");<br>
- WRITE_CODE(hrd->getCpbSizeScale(), 4, "cpb_size_scale");<br>
+ WRITE_CODE(hrd->getBitRateScale(), 4, "bit_rate_scale");<br>
+ WRITE_CODE(hrd->getCpbSizeScale(), 4, "cpb_size_scale");<br>
if (hrd->getSubPicCpbParamsPresentFlag())<br>
{<br>
- WRITE_CODE(hrd->getDuCpbSizeScale(), 4, "du_cpb_size_scale");<br>
+ WRITE_CODE(hrd->getDuCpbSizeScale(), 4, "du_cpb_size_scale");<br>
}<br>
- WRITE_CODE(hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1");<br>
- WRITE_CODE(hrd->getCpbRemovalDelayLengthMinus1(), 5, "au_cpb_removal_delay_length_minus1");<br>
- WRITE_CODE(hrd->getDpbOutputDelayLengthMinus1(), 5, "dpb_output_delay_length_minus1");<br>
+ WRITE_CODE(hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1");<br>
+ WRITE_CODE(hrd->getCpbRemovalDelayLengthMinus1(), 5, "au_cpb_removal_delay_length_minus1");<br>
+ WRITE_CODE(hrd->getDpbOutputDelayLengthMinus1(), 5, "dpb_output_delay_length_minus1");<br>
}<br>
}<br>
int i, j, nalOrVcl;<br>
for (i = 0; i <= maxNumSubLayersMinus1; i++)<br>
{<br>
- WRITE_FLAG(hrd->getFixedPicRateFlag(i) ? 1 : 0, "fixed_pic_rate_general_flag");<br>
+ WRITE_FLAG(hrd->getFixedPicRateFlag(i) ? 1 : 0, "fixed_pic_rate_general_flag");<br>
if (!hrd->getFixedPicRateFlag(i))<br>
{<br>
- WRITE_FLAG(hrd->getFixedPicRateWithinCvsFlag(i) ? 1 : 0, "fixed_pic_rate_within_cvs_flag");<br>
+ WRITE_FLAG(hrd->getFixedPicRateWithinCvsFlag(i) ? 1 : 0, "fixed_pic_rate_within_cvs_flag");<br>
}<br>
else<br>
{<br>
@@ -751,15 +750,15 @@<br>
}<br>
if (hrd->getFixedPicRateWithinCvsFlag(i))<br>
{<br>
- WRITE_UVLC(hrd->getPicDurationInTcMinus1(i), "elemental_duration_in_tc_minus1");<br>
+ WRITE_UVLC(hrd->getPicDurationInTcMinus1(i), "elemental_duration_in_tc_minus1");<br>
}<br>
else<br>
{<br>
- WRITE_FLAG(hrd->getLowDelayHrdFlag(i) ? 1 : 0, "low_delay_hrd_flag");<br>
+ WRITE_FLAG(hrd->getLowDelayHrdFlag(i) ? 1 : 0, "low_delay_hrd_flag");<br>
}<br>
if (!hrd->getLowDelayHrdFlag(i))<br>
{<br>
- WRITE_UVLC(hrd->getCpbCntMinus1(i), "cpb_cnt_minus1");<br>
+ WRITE_UVLC(hrd->getCpbCntMinus1(i), "cpb_cnt_minus1");<br>
}<br>
<br>
for (nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++)<br>
@@ -825,8 +824,8 @@<br>
void TEncSbac::codeProfileTier(ProfileTierLevel* ptl)<br>
{<br>
WRITE_CODE(ptl->getProfileSpace(), 2, "XXX_profile_space[]");<br>
- WRITE_FLAG(ptl->getTierFlag(), "XXX_tier_flag[]");<br>
- WRITE_CODE(ptl->getProfileIdc(), 5, "XXX_profile_idc[]");<br>
+ WRITE_FLAG(ptl->getTierFlag(), "XXX_tier_flag[]");<br>
+ WRITE_CODE(ptl->getProfileIdc(), 5, "XXX_profile_idc[]");<br>
for (int j = 0; j < 32; j++)<br>
{<br>
WRITE_FLAG(ptl->getProfileCompatibilityFlag(j), "XXX_profile_compatibility_flag[][j]");<br>
@@ -1063,10 +1062,15 @@<br>
WRITE_FLAG(slice->getPicOutputFlag() ? 1 : 0, "pic_output_flag");<br>
}<br>
<br>
- // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present<br>
- assert(slice->getSPS()->getChromaFormatIdc() == 1);<br>
- // if( separate_colour_plane_flag == 1 )<br>
- // colour_plane_id u(2)<br>
+ if (slice->getSPS()->getChromaFormatIdc() == CHROMA_444)<br>
+ {<br>
+ //In this version separate_color_plane_flag is 0<br>
+ if(slice->getSPS()->getSeparateColorPlaneFlag())<br>
+ {<br>
+ //plane_id values 0, 1, and 2 correspond to the Y, Cb, and Cr planes, respectively.<br>
+ //WRITE_FLAG(0, "colour_plane_id");<br>
+ }<br>
+ }<br>
<br>
if (!slice->getIdrPicFlag())<br>
{<br>
@@ -2163,16 +2167,6 @@<br>
<br>
if (numSig == 0)<br>
return;<br>
- if (cu->getSlice()->getPPS()->getUseTransformSkip())<br>
- {<br>
- codeTransformSkipFlags(cu, absPartIdx, width, height, ttype);<br>
- }<br>
- ttype = ttype == TEXT_LUMA ? TEXT_LUMA : TEXT_CHROMA;<br>
-<br>
- //----- encode significance map -----<br>
- const uint32_t log2BlockSize = g_convertToBit[width] + 2;<br>
- uint32_t scanIdx = cu->getCoefScanIdx(absPartIdx, width, ttype == TEXT_LUMA, cu->isIntra(absPartIdx));<br>
- const uint32_t *scan = g_sigLastScan[scanIdx][log2BlockSize - 1];<br>
<br>
bool beValid;<br>
if (cu->getCUTransquantBypass(absPartIdx))<br>
@@ -2184,55 +2178,57 @@<br>
beValid = cu->getSlice()->getPPS()->getSignHideFlag() > 0;<br>
}<br>
<br>
+ if (cu->getSlice()->getPPS()->getUseTransformSkip())<br>
+ {<br>
+ codeTransformSkipFlags(cu, absPartIdx, width, height, ttype);<br>
+ }<br>
+<br>
+ ttype = ttype == TEXT_LUMA ? TEXT_LUMA : TEXT_CHROMA;<br>
+ const uint32_t log2BlockWidth = g_convertToBit[width] + 2;<br>
+ const uint32_t log2BlockHeight = g_convertToBit[height] + 2;<br>
+<br>
+ //select scans<br>
+ TUEntropyCodingParameters codingParameters;<br>
+ TComTrQuant::getTUEntropyCodingParameters(cu, codingParameters, absPartIdx, width, height, ttype);<br>
+<br>
+ //----- encode significance map -----<br>
+<br>
// Find position of last coefficient<br>
int scanPosLast = -1;<br>
int posLast;<br>
<br>
- const uint32_t * scanCG;<br>
- {<br>
- scanCG = g_sigLastScan[scanIdx][log2BlockSize > 3 ? log2BlockSize - 2 - 1 : 0];<br>
- if (log2BlockSize == 3)<br>
- {<br>
- scanCG = g_sigLastScan8x8[scanIdx];<br>
- }<br>
- else if (log2BlockSize == 5)<br>
- {<br>
- scanCG = g_sigLastScanCG32x32;<br>
- }<br>
- }<br>
- uint32_t sigCoeffGroupFlag[MLS_GRP_NUM];<br>
- static const uint32_t shift = MLS_CG_SIZE >> 1;<br>
- const uint32_t numBlkSide = width >> shift;<br>
<br>
- ::memset(sigCoeffGroupFlag, 0, sizeof(uint32_t) * MLS_GRP_NUM);<br>
+ uint32_t sigCoeffGroupFlag[ MLS_GRP_NUM ];<br>
+ memset( sigCoeffGroupFlag, 0, sizeof(uint32_t) * MLS_GRP_NUM );<br>
<br>
do<br>
{<br>
- posLast = scan[++scanPosLast];<br>
+ posLast = codingParameters.scan[++scanPosLast];<br>
<br>
- // get L1 sig map<br>
- uint32_t posy = posLast >> log2BlockSize;<br>
- uint32_t posx = posLast - (posy << log2BlockSize);<br>
- uint32_t blkIdx = numBlkSide * (posy >> shift) + (posx >> shift);<br>
- if (coeff[posLast])<br>
+ if(coeff[posLast] != 0)<br>
{<br>
+ // get L1 sig map<br>
+ uint32_t posy = posLast >> log2BlockWidth;<br>
+ uint32_t posx = posLast - (posy << log2BlockWidth);<br>
+ uint32_t blkIdx = codingParameters.widthInGroups * (posy >> MLS_CG_LOG2_HEIGHT) + (posx >> MLS_CG_LOG2_WIDTH);<br>
sigCoeffGroupFlag[blkIdx] = 1;<br>
+<br>
+ numSig --;<br>
}<br>
-<br>
- numSig -= (coeff[posLast] != 0);<br>
}<br>
while (numSig > 0);<br>
<br>
+<br>
// Code position of last coefficient<br>
- int posLastY = posLast >> log2BlockSize;<br>
- int posLastX = posLast - (posLastY << log2BlockSize);<br>
- codeLastSignificantXY(posLastX, posLastY, width, height, ttype, scanIdx);<br>
+ int posLastY = posLast >> log2BlockWidth;<br>
+ int posLastX = posLast - (posLastY << log2BlockWidth);<br>
+ codeLastSignificantXY(posLastX, posLastY, width, height, ttype, codingParameters.scanType);<br>
<br>
//===== code significance flag =====<br>
ContextModel * const baseCoeffGroupCtx = &m_contextModels[OFF_SIG_CG_FLAG_CTX + (ttype ? NUM_SIG_CG_FLAG_CTX : 0)];<br>
ContextModel * const baseCtx = (ttype == TEXT_LUMA) ? &m_contextModels[OFF_SIG_FLAG_CTX] : &m_contextModels[OFF_SIG_FLAG_CTX + NUM_SIG_FLAG_CTX_LUMA];<br>
<br>
- const int lastScanSet = scanPosLast >> LOG2_SCAN_SET_SIZE;<br>
+ const int lastScanSet = scanPosLast >> MLS_CG_SIZE;<br>
uint32_t c1 = 1;<br>
uint32_t goRiceParam = 0;<br>
int scanPosSig = scanPosLast;<br>
@@ -2240,16 +2236,17 @@<br>
for (int subSet = lastScanSet; subSet >= 0; subSet--)<br>
{<br>
int numNonZero = 0;<br>
- int subPos = subSet << LOG2_SCAN_SET_SIZE;<br>
+ int subPos = subSet << MLS_CG_SIZE;<br>
goRiceParam = 0;<br>
- int absCoeff[16];<br>
+ int absCoeff[1 << MLS_CG_SIZE];<br>
uint32_t coeffSigns = 0;<br>
<br>
- int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE;<br>
+ int lastNZPosInCG = -1;<br>
+ int firstNZPosInCG = 1 << MLS_CG_SIZE;<br>
<br>
if (scanPosSig == scanPosLast)<br>
{<br>
- absCoeff[0] = abs(coeff[posLast]);<br>
+ absCoeff[0] = int(abs(coeff[posLast]));<br>
coeffSigns = (coeff[posLast] < 0);<br>
numNonZero = 1;<br>
lastNZPosInCG = scanPosSig;<br>
@@ -2258,9 +2255,10 @@<br>
}<br>
<br>
// encode significant_coeffgroup_flag<br>
- int cgBlkPos = scanCG[subSet];<br>
- int cgPosY = cgBlkPos / numBlkSide;<br>
- int cgPosX = cgBlkPos - (cgPosY * numBlkSide);<br>
+ int cgBlkPos = codingParameters.scanCG[subSet];<br>
+ int cgPosY = cgBlkPos / codingParameters.widthInGroups;<br>
+ int cgPosX = cgBlkPos - (cgPosY * codingParameters.widthInGroups);<br>
+<br>
if (subSet == lastScanSet || subSet == 0)<br>
{<br>
sigCoeffGroupFlag[cgBlkPos] = 1;<br>
@@ -2268,29 +2266,27 @@<br>
else<br>
{<br>
uint32_t sigCoeffGroup = (sigCoeffGroupFlag[cgBlkPos] != 0);<br>
- uint32_t ctxSig = TComTrQuant::getSigCoeffGroupCtxInc(sigCoeffGroupFlag, cgPosX, cgPosY, log2BlockSize);<br>
+ uint32_t ctxSig = TComTrQuant::getSigCoeffGroupCtxInc(sigCoeffGroupFlag, cgPosX, cgPosY, codingParameters.widthInGroups, codingParameters.heightInGroups);<br>
m_binIf->encodeBin(sigCoeffGroup, baseCoeffGroupCtx[ctxSig]);<br>
}<br>
<br>
// encode significant_coeff_flag<br>
if (sigCoeffGroupFlag[cgBlkPos])<br>
{<br>
- int patternSigCtx = TComTrQuant::calcPatternSigCtx(sigCoeffGroupFlag, cgPosX, cgPosY, log2BlockSize);<br>
- uint32_t blkPos, posy, posx, sig, ctxSig;<br>
+ const int patternSigCtx = TComTrQuant::calcPatternSigCtx(sigCoeffGroupFlag, cgPosX, cgPosY, codingParameters.widthInGroups, codingParameters.heightInGroups);<br>
+ uint32_t blkPos, sig, ctxSig;<br>
for (; scanPosSig >= subPos; scanPosSig--)<br>
{<br>
- blkPos = scan[scanPosSig];<br>
- posy = blkPos >> log2BlockSize;<br>
- posx = blkPos - (posy << log2BlockSize);<br>
+ blkPos = codingParameters.scan[scanPosSig];<br>
sig = (coeff[blkPos] != 0);<br>
if (scanPosSig > subPos || subSet == 0 || numNonZero)<br>
{<br>
- ctxSig = TComTrQuant::getSigCtxInc(patternSigCtx, scanIdx, posx, posy, log2BlockSize, ttype);<br>
+ ctxSig = TComTrQuant::getSigCtxInc(patternSigCtx, codingParameters, scanPosSig, log2BlockWidth, log2BlockHeight, ttype);<br>
m_binIf->encodeBin(sig, baseCtx[ctxSig]);<br>
}<br>
if (sig)<br>
{<br>
- absCoeff[numNonZero] = abs(coeff[blkPos]);<br>
+ absCoeff[numNonZero] = int(abs(coeff[blkPos]));<br>
coeffSigns = 2 * coeffSigns + (coeff[blkPos] < 0);<br>
numNonZero++;<br>
if (lastNZPosInCG == -1)<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>