📄 main.cpp
字号:
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;} int main (int argc, char *argv[]){ bool audio_decode = false; int len = 0; char *allargs = NULL, *step; static struct option orig_options[] = { { "latm", 0, 0, 'l' }, { "help", 0, 0, 'h' }, { NULL, 0, 0, 0 } }; opterr = 0; while (true) { int c = -1; int option_index = 0; c = getopt_long_only(argc, argv, "ah", orig_options, &option_index); if (c == -1) break; switch (c) { case 'l': // -l <latm config> audio_decode = true; break; case 'h': fprintf(stderr, "Usage: %s [-f config_file] [--automatic] [--headless] [--sdp] [--<config variable>=<value>]\n", argv[0]); fprintf(stderr, "Use [--config-vars] to dump configuration variables\n"); exit(-1); } } fprintf(stderr, "argc %d optind %d\n", argc, optind); if(argc > optind) { // There are non-option args left, probably file names argv += optind; argc -= optind; printf("processing %s\n", *argv); while (argc > 0 && strcasestr(*argv, ".mp4") != NULL) { MP4FileHandle mp4File; if (audio_decode) { fprintf(stderr, "No decode of audio from mpeg4 files\n"); return -1; } mp4File = MP4Read(*argv, MP4_DETAILS_ERROR); if (MP4_IS_VALID_FILE_HANDLE(mp4File)) { MP4TrackId tid; uint32_t ix = 0; do { uint32_t verb = MP4GetVerbosity(mp4File); MP4SetVerbosity(mp4File, verb & ~(MP4_DETAILS_ERROR)); tid = MP4FindTrackId(mp4File, ix, MP4_VIDEO_TRACK_TYPE); MP4SetVerbosity(mp4File, verb); if (MP4_IS_VALID_TRACK_ID(tid)) { uint8_t type = MP4GetTrackEsdsObjectTypeId(mp4File, tid); if (type == MP4_MPEG4_VIDEO_TYPE) { uint8_t *foo; uint32_t bufsize; MP4GetTrackESConfiguration(mp4File, tid, &foo, &bufsize); if (foo != NULL && bufsize != 0) { printf("%s\n", *argv); decode(foo, bufsize); free(foo); } else { fprintf(stderr, "%s - track %d - can't find esds\n", *argv, tid); } } else { fprintf(stderr, "%s - track %d is not MPEG4 - type %u\n", *argv, tid, type); } } ix++; } while (MP4_IS_VALID_TRACK_ID(tid)); } else { fprintf(stderr, "%s is not a valid mp4 file\n", *argv); } argc--; argv++; } } if (argc > 0) { len = 1; while (argc > 0) { len += strlen(*argv); if (allargs == NULL) { allargs = (char *)malloc(len); allargs[0] = '\0'; } else allargs = (char *)realloc(allargs, len); strcat(allargs, *argv); argv++; argc--; } if ((len - 1) & 0x1) { fprintf(stderr, "odd length VOL\n"); exit(1); } len /= 2; uint8_t *vol = (uint8_t *)malloc(len), *write; write = vol; step = allargs; int ix; for (ix = 0; ix < len; ix++) { *write = 0; *write = tohex(*step) << 4; step++; *write |= tohex(*step); step++; write++; } printf("decoding vol \"%s\"\n", allargs); if (audio_decode) { decode_audio(vol, len); } else { decode(vol, len); } } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -