// we have this so that the check of the global can be inlined // and we don't make the call to CheckMarker unless we need to. void BaseStackMarker::CheckForBackoutViolation() { WRAPPER_CONTRACT; STATIC_CONTRACT_DEBUG_ONLY; // The marker should always be re-enabled at this point. CONSISTENCY_CHECK_MSG(!m_fTemporarilyDisabled, "The stack guard was disabled but not properly re-enabled. This is a bug somewhere in the code called after this marker has been set up."); if (!m_pDebugState || m_fTemporarilyDisabled) { return; } // Reset the SO tolerance of the thread. m_pDebugState->SetSOTolerance(m_prevWasSOTolerant); if (m_fAddedToStack) { // Pop ourselves off of the stack of stack markers on the CLR debug state. CONSISTENCY_CHECK(m_pDebugState != NULL); BaseStackMarker *pPopResult = m_pDebugState->m_StackMarkerStack.PopStackMarker(); CONSISTENCY_CHECK_MSG(pPopResult == this, "The marker we pop off the stack should always be the current marker."); CONSISTENCY_CHECK_MSG(m_pPrevious == NULL, "PopStackMarker should reset the current marker's m_pPrevious field to NULL."); } // Not cancellable markers should only be checked when no cancellable markers are present. if (!m_fAllowDisabling && !(m_pDebugState->m_StackMarkerStack.IsEmpty())) { return; } if (m_fProtectedStackPage) { UndoPageProtectionInDebugger(); } if (m_fMarkerSet) { // Check to see if we overwrote the stack guard marker. CheckMarker(); } }
static void decode (uint8_t *vol, uint32_t len) { uint32_t ix; uint32_t temp; #if 1 for (ix = 0; ix < len; ix++) { printf("%02x ", vol[ix]); } printf("\n"); #endif uint32_t verid = 1; CBitstream *bs = new CBitstream(vol, len * 8); //bs->set_verbose(1); try { temp = bs->GetBits(32); if (temp == 0x000001b0) { printf("Video Object Sequence\n"); printf(" profile_and_level_indication - 0x%x\n", bs->GetBits(8)); temp = bs->GetBits(32); } else { printf("No Video Object Sequence\n"); } do { temp = CheckUserData(temp, bs); } while (temp == 0x000001b2); if (temp == 0x000001b5) { printf("Visual Object\n"); temp = bs->GetBits(1); printf(" is_visual_object_identifier - %u\n", temp); if (temp) { verid = bs->GetBits(4); printf(" visual_object_verid - %u\n", verid); printf(" visual_object_prioriy - %u\n", bs->GetBits(3)); } temp = bs->GetBits(4); printf(" visual object type - %u\n", temp); if (temp == 0x01 || temp == 0x02) { // visual object type of video ID or Still texture ID temp = bs->GetBits(1); printf(" video_signal_type - %u\n", temp); if (temp) { printf(" video_format - %u\n", bs->GetBits(3)); printf(" video_range - %u\n", bs->GetBits(1)); temp = bs->GetBits(1); printf(" colour_description - %u\n", temp); if (temp) { printf(" colour_primaries - %u\n", bs->GetBits(8)); printf(" transfer_characteristics - %u\n", bs->GetBits(8)); printf(" matrix_coefficients - %u\n", bs->GetBits(8)); } } } bs->byte_align(); temp = bs->GetBits(32); } do { temp = CheckUserData(temp, bs); } while (temp == 0x000001b2); if ((temp & 0xfffffff0) == 0x00000100) { printf("Video Object - %u\n", temp & 0xf); temp = bs->GetBits(32); } else { printf("No Video Object\n"); } do { temp = CheckUserData(temp, bs); } while (temp == 0x000001b2); if ((temp & 0xfffffff0) != 0x00000120) { fprintf(stderr, "illegal start code %08x\n", temp); exit(1); } printf("Video Object Layer\n"); printf(" random_accessible_vol - %u\n", bs->GetBits(1)); uint8_t video_object_type; video_object_type = bs->GetBits(8); printf(" video object type - %u\n", video_object_type); if (video_object_type == 0x12) { printf(" fine granularity scalable not implemented\n"); exit(1); } temp = bs->GetBits(1); printf(" is_object_layer_identifier - %u\n", temp); if (temp) { verid = bs->GetBits(4); printf(" verid - %u\n", verid); printf(" vol_priority - %u\n", bs->GetBits(3)); } temp = bs->GetBits(4); printf(" aspect_ratio_info %u\n", temp); if (temp == 0xf) { printf(" par_width - %u\n", bs->GetBits(8)); printf(" par_height - %u\n", bs->GetBits(8)); } temp = bs->GetBits(1); printf(" vol_control_parameters - %u\n", temp); if (temp) { printf(" chroma format - %u\n", bs->GetBits(2)); printf(" low delay - %u\n", bs->GetBits(1)); temp = bs->GetBits(1); printf(" vbv_parameters - %u\n", temp); if (temp) { temp = bs->GetBits(15) << 15; CheckMarker(bs); temp |= bs->GetBits(15); printf(" bit rate %u\n", temp); CheckMarker(bs); temp = bs->GetBits(15) << 3; CheckMarker(bs); temp |= bs->GetBits(3); printf(" vbv buffer size %u\n", temp); temp = bs->GetBits(11) << 15; CheckMarker(bs); temp |= bs->GetBits(15); printf(" vbv occupancy %u\n", temp); CheckMarker(bs); } } uint8_t vol_shape = bs->GetBits(2); uint8_t vol_shape_ext = 0; #define VOL_SHAPE_RECT 0x0 #define VOL_SHAPE_BIN 0x1 #define VOL_SHAPE_BIN_ONLY 0x2 #define VOL_SHAPE_GRAYSCALE 0x3 printf(" video object layer shape - %u\n", vol_shape); if (vol_shape == VOL_SHAPE_GRAYSCALE && verid != 1) { vol_shape_ext = bs->GetBits(4); printf(" vol_shape_extension - %u\n", vol_shape_ext); if (vol_shape_ext > 12) { fprintf(stderr, "Vol shape extension has wrong value\n"); abort(); } } CheckMarker(bs); uint32_t vop_time = bs->GetBits(16); printf(" vop_time_increment_resolution - %u\n", vop_time); CheckMarker(bs); temp = bs->GetBits(1); printf(" fixed_vop_rate - %u\n", temp); if (temp) { u_int32_t powerOf2 = 1; int ix; for (ix = 0; ix < 16; ix++) { if (vop_time < powerOf2) { break; } powerOf2 <<= 1; } printf(" fixed_vop_time_increment - bits %u %u\n", ix, bs->GetBits(ix)); } if (vol_shape != VOL_SHAPE_BIN_ONLY) { // binary only if (vol_shape == VOL_SHAPE_RECT) { // rectangular CheckMarker(bs); printf(" vol width - %u\n", bs->GetBits(13)); CheckMarker(bs); temp = bs->GetBits(13); printf(" vol height - %u\n", temp); CheckMarker(bs); } printf(" interlaced - %u\n", bs->GetBits(1)); printf(" obmc_disable - %u\n", bs->GetBits(1)); uint8_t sprite; sprite = bs->GetBits(verid == 1 ? 1 : 2); printf(" sprite - %u\n", sprite); if (sprite == 1 || sprite == 2) { if (sprite == 1) { // static 1, not GMC 2 printf(" width - %u\n", bs->GetBits(13)); CheckMarker(bs); printf(" height - %u\n", bs->GetBits(13)); CheckMarker(bs); printf(" left coordinate - %u\n", bs->GetBits(13)); CheckMarker(bs); printf(" top coordinate - %u\n", bs->GetBits(13)); CheckMarker(bs); } printf(" no_of_sprite_warping_points - %u\n", bs->GetBits(6)); printf(" sprite_warping_accuracy - %u\n", bs->GetBits(2)); printf(" sprite brightness change - %u\n", bs->GetBits(1)); if (sprite == 1) { printf(" low_latency_sprite_enable - %u\n", bs->GetBits(1)); } } if (verid != 1 && vol_shape != VOL_SHAPE_RECT) { printf(" sadct_disable - %u\n", bs->GetBits(1)); } temp = bs->GetBits(1); printf(" not_8_bit - %u\n", temp); if (temp) { printf(" quant_precision - %u\n", bs->GetBits(4)); printf(" bits_per_pixel - %u\n", bs->GetBits(4)); } if (vol_shape == VOL_SHAPE_GRAYSCALE) { // greyscale printf(" no_gray_quant_update - %u\n", bs->GetBits(1)); printf(" composition_method - %u\n", bs->GetBits(1)); printf(" linear_composition - %u\n", bs->GetBits(1)); } temp = bs->GetBits(1); printf(" quant_type - %u\n", temp); if (temp) { temp = bs->GetBits(1); printf(" load_intra_quant_mat - %u\n", temp); if (temp) { LoadQuantTable(bs); } temp = bs->GetBits(1); printf(" load_nonintra_quant_mat - %u\n", temp); if (temp) { LoadQuantTable(bs); } if (vol_shape == VOL_SHAPE_GRAYSCALE) { static const uint8_t aux_comp[] = { 1, 1, 2, 2, 3, 1, 2, 1, 1, 2, 3, 2 ,3 }; for (ix = 0; ix < aux_comp[vol_shape_ext]; ix++) { temp = bs->GetBits(1); printf(" load_intra_quant_mat_grayscale %d - %u\n", ix, temp); if (temp) { LoadQuantTable(bs); } temp = bs->GetBits(1); printf(" load_nonintra_quant_mat_grayscale %d - %u\n", ix, temp); if (temp) { LoadQuantTable(bs); } } } } if (verid != 1) { printf(" quarter sample - %u\n", bs->GetBits(1)); } temp = bs->GetBits(1); printf(" complexity estimation - %u\n", temp); if (!temp) { uint8_t est_method; est_method = bs->GetBits(2); printf(" estimation_method - %u\n", est_method); if (est_method == 0 || est_method == 1) { temp = bs->GetBits(1); printf(" shape_complexity_estimation_disable - %u\n", temp); if (!temp) { printf(" opaque - %u\n", bs->GetBits(1)); printf(" transparent - %u\n", bs->GetBits(1)); printf(" intra_cae - %u\n", bs->GetBits(1)); printf(" inter_cae - %u\n", bs->GetBits(1)); printf(" no_update - %u\n", bs->GetBits(1)); printf(" upsampling - %u\n", bs->GetBits(1)); } temp = bs->GetBits(1); printf(" texture_complexity_estimation_set_1_disable - %u\n", temp); if (!temp) { printf(" intra_blocks - %u\n", bs->GetBits(1)); printf(" inter_blocks - %u\n", bs->GetBits(1)); printf(" inter4v_blocks - %u\n", bs->GetBits(1)); printf(" not_coded_blocks - %u\n", bs->GetBits(1)); } CheckMarker(bs); temp = bs->GetBits(1); printf(" texture_complexity_estimation_set_2_disable - %u\n", temp); if (!temp) { printf(" dct_coefs - %u\n", bs->GetBits(1)); printf(" dct_lines - %u\n", bs->GetBits(1)); printf(" vlc_symbols - %u\n", bs->GetBits(1)); printf(" vlc_bits - %u\n", bs->GetBits(1)); } CheckMarker(bs); temp = bs->GetBits(1); printf(" motion_compensation_complexity_disable - %u\n", temp); if (!temp) { printf(" apm - %u\n", bs->GetBits(1)); printf(" npm - %u\n", bs->GetBits(1)); printf(" interpolate_mc_q - %u\n", bs->GetBits(1)); printf(" forw_back_mc_q - %u\n", bs->GetBits(1)); printf(" halfpel2 - %u\n", bs->GetBits(1)); printf(" halfpel4 - %u\n", bs->GetBits(1)); } CheckMarker(bs); if (est_method == 1) { temp = bs->GetBits(1); printf(" version2_complexity_estimation_disable - %u\n", temp); if (!temp) { printf(" sadct - %u\n", bs->GetBits(1)); printf(" quarterpel - %u\n", bs->GetBits(1)); } } } } // done with complexity estimation printf(" resync_marker_disable - %u\n", bs->GetBits(1)); temp = bs->GetBits(1); printf(" data partitioned - %u\n", temp); if (temp) { printf(" reversible_vlc - %u\n", bs->GetBits(1)); } if (verid != 1) { temp = bs->GetBits(1); printf(" newpred_enable - %u\n", temp); if (temp) { printf(" requested_upstream_message_type - %u\n", bs->GetBits(2)); printf(" newpred_segment_type - %u\n", bs->GetBits(1)); } printf(" reduced_resolution_vop_enable - %u\n", bs->GetBits(1)); } temp = bs->GetBits(1); printf(" scalability - %u\n", temp); if (temp) { uint8_t heirarchy_type = bs->GetBits(1); printf(" heirarchy_type - %u\n", heirarchy_type); printf(" ref_layer_id - %u\n", bs->GetBits(4)); printf(" ref_layer_sampling_direc - %u\n", bs->GetBits(1)); printf(" hor_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" hor_sampling_factor_m - %u\n", bs->GetBits(5)); printf(" vert_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" vert_sampling_factor_m - %u\n", bs->GetBits(5)); printf(" enhancement_type - %u\n", bs->GetBits(1)); if (vol_shape == VOL_SHAPE_BIN && heirarchy_type == 0) { printf(" use_ref_shape - %u\n", bs->GetBits(1)); printf(" use_ref_texture - %u\n", bs->GetBits(1)); printf(" shape_hor_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" shape_hor_sampling_factor_m - %u\n", bs->GetBits(5)); printf(" shape_vert_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" shape_vert_sampling_factor_m - %u\n", bs->GetBits(5)); } } } else { // binary only if (verid != 1) { temp = bs->GetBits(1); printf(" scalability - %u\n", temp); if (temp) { printf(" shape_hor_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" shape_hor_sampling_factor_m - %u\n", bs->GetBits(5)); printf(" shape_vert_sampling_factor_n - %u\n", bs->GetBits(5)); printf(" shape_vert_sampling_factor_m - %u\n", bs->GetBits(5)); } printf(" resync_marker_disable - %u\n", bs->GetBits(1)); } } bs->byte_align(); if (bs->bits_remain() > 32) { temp = bs->GetBits(32); do { temp = CheckUserData(temp, bs); } while (temp == 0x000001b2); } } catch (...) { fprintf(stderr, "bitstream read error\n"); } return; }