Changeset 1024 in SHVCSoftware for branches/SHM-upgrade/source/App/utils/ExtractAddLS
- Timestamp:
- 7 Feb 2015, 07:50:43 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-upgrade/source/App/utils/ExtractAddLS/ExtractAddLS.c
r1006 r1024 277 277 NalUnitHeader nalu; 278 278 int numStartCodeZeros; 279 int nalIs SpsPpsEob;279 int nalIsVpsSpsPpsEob; 280 280 int nalIsVpsSpsPpsEos; 281 281 int removeNal; … … 289 289 { 290 290 fprintf(stderr, "\n Usage: ExtractAddLS <infile> <outfile> <max temporal ID> <list of layer IDs> \n\n"); 291 fprintf(stderr, " If only one layer ID is given, independent non-base layer rewriting process\n"); 292 fprintf(stderr, " is performed\n"); 291 fprintf(stderr, " If only one layer ID 0 is given, base layer extration process is performed\n"); 292 fprintf(stderr, " If only one non-zero layer ID is given, independent non-base layer rewriting\n"); 293 fprintf(stderr, " process is performed\n"); 293 294 fprintf(stderr, " If more than one layer ID is given, sub-bitstream extraction process for\n"); 294 295 fprintf(stderr, " additional layer sets is performed (Layer ID list should exactly match\n"); … … 321 322 { 322 323 layerIdListTarget[layerIdx] = atoi(argv[i]); 323 if (layerIdListTarget[layerIdx] < 1|| layerIdListTarget[layerIdx] > 7)324 if (layerIdListTarget[layerIdx] < 0 || layerIdListTarget[layerIdx] > 7) 324 325 { 325 326 fprintf(stderr, "Invalid layer ID (must be in range 1-7)\n"); … … 345 346 if (numLayerIds == 1) 346 347 { 347 /* independent non-base layer rewriting process */ 348 349 nalIsSpsPpsEob = (nalu.nalUnitType == NAL_UNIT_SPS || nalu.nalUnitType == NAL_UNIT_PPS || nalu.nalUnitType == NAL_UNIT_EOB); 350 351 removeNal = (!nalIsSpsPpsEob && (nalu.nuhLayerId != assignedBaseLayerId)) 352 || (nalIsSpsPpsEob && (nalu.nuhLayerId != 0) && (nalu.nuhLayerId != assignedBaseLayerId)) 353 || (nalu.nalUnitType == NAL_UNIT_VPS) 354 || ((nalu.nuhTemporalIdPlus1 - 1) > tIdTarget); 355 348 /* base layer or independent non-base layer bitstream extraction */ 349 350 /* temporary keep VPS so the extracted/rewriting bitstream can be decoded by HM */ 351 nalIsVpsSpsPpsEob = (nalu.nalUnitType == NAL_UNIT_VPS || nalu.nalUnitType == NAL_UNIT_SPS || nalu.nalUnitType == NAL_UNIT_PPS || nalu.nalUnitType == NAL_UNIT_EOB); 352 removeNal = (!nalIsVpsSpsPpsEob && (nalu.nuhLayerId != assignedBaseLayerId)) 353 || (nalIsVpsSpsPpsEob && (nalu.nuhLayerId != 0)) 354 || ((nalu.nuhTemporalIdPlus1 - 1) > tIdTarget); 356 355 nalu.nuhLayerId = 0; 357 356 } … … 403 402 i = 0; 404 403 405 if (numLayerIds > 1 && nalu.nalUnitType == NAL_UNIT_VPS) 404 if (numLayerIds == 1 && nalu.nalUnitType == NAL_UNIT_VPS) 405 { 406 char nalByte = fgetc(inFile); 407 nalByte = nalByte | (0x0C); // set vps_max_layers_minus1 bits(5-4) to 0 for HM decoder 408 nalByte = nalByte & ~(0x03); // set vps_max_layers_minus1 bits(3-0) to 0 for HM decoder 409 fputc(nalByte, outFile); 410 i++; 411 nalByte = fgetc(inFile); 412 nalByte = nalByte & ~(0xF0); 413 fputc(nalByte, outFile); 414 i++; 415 } 416 else if (numLayerIds > 1 && nalu.nalUnitType == NAL_UNIT_VPS) 406 417 { 407 418 /* sub-bitstream extraction process for additional layer sets */
Note: See TracChangeset for help on using the changeset viewer.