@SuppressWarnings("unused")
  @Deprecated
  private void validateSubIfd(IFD ifd, int n) {
    boolean thumbnail = ifd.getParent().getImageSize() > ifd.getImageSize();
    IfdTags metadata = ifd.getMetadata();

    checkRequiredTag(metadata, "ImageLength", 1, "SubIFD" + n);
    checkRequiredTag(metadata, "ImageWidth", 1, "SubIFD" + n);
    int spp = -1;
    if (checkRequiredTag(metadata, "SamplesPerPixel", 1, "SubIFD" + n)) {
      spp = (int) metadata.get("SamplesPerPixel").getFirstNumericValue();
      checkRequiredTag(metadata, "BitsPerSample", spp, "SubIFD" + n);
    }
    if (checkRequiredTag(metadata, "Compression", 1, "SubIFD" + n)) {
      int comp = (int) metadata.get("Compression").getFirstNumericValue();
      if (comp == 1)
        checkForbiddenTag(metadata, "CompressedBitsPerPixel", "IFD" + n);
    }
    checkRequiredTag(metadata, "XResolution", 1, "SubIFD" + n);
    checkRequiredTag(metadata, "YResolution", 1, "SubIFD" + n);
    checkForbiddenTag(metadata, "SubIFDs", "IFD" + n);
    if (thumbnail)
      checkRequiredTag(metadata, "NewSubfileType", 1, new long[] {1}, "SubIFD" + n);
    else
      checkRequiredTag(metadata, "NewSubfileType", 1, new long[] {0}, "SubIFD" + n);
    if (checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {1, 2, 6, 32803,
        32767}, "SubIFD" + n)) {
      int photo = (int) metadata.get("PhotometricInterpretation").getFirstNumericValue();
      if (photo != 6) {
        checkForbiddenTag(metadata, "YCbCrCoefficients", "SubIFD" + n);
        checkForbiddenTag(metadata, "YCbCrSubSampling", "SubIFD" + n);
        checkForbiddenTag(metadata, "YCbCrPositioning", "SubIFD" + n);
        checkForbiddenTag(metadata, "ReferenceBlackWhite", "SubIFD" + n);
      }
      if (photo == 2 || photo == 3) {
        if (spp != 3) {
          validation.addError("Invalid SampesPerPixel value fo TiffEP", "SubIFD" + n, spp);
        }
      } else if (photo == 1 || photo == 32803) {
        if (spp != 1) {
          validation.addError("Invalid SampesPerPixel value fo TiffEP", "SubIFD" + n, spp);
        }
        if (photo == 32803) {
          checkRequiredTag(metadata, "CFARepeatPatternDim", 2, "SubIFD" + n);
          checkRequiredTag(metadata, "CFAPattern", -1, "SubIFD" + n);
        }
      }
    }
    checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[] {1, 2}, "SubIFD" + n);
    checkRequiredTag(metadata, "ResolutionUnit", 1, new long[] {1, 2, 3}, "SubIFD" + n);

    if (!thumbnail) {
      if (ifd.hasStrips()) {
        checkRequiredTag(metadata, "StripBYTECount", -1, "SubIFD" + n);
        checkRequiredTag(metadata, "StripOffsets", -1, "SubIFD" + n);
        checkRequiredTag(metadata, "RowsPerStrip", 1, "SubIFD" + n);
        if (ifd.hasTiles()) {
          validation.addErrorLoc("Image in both strips and tiles", "SubIFD");
        }
      } else if (ifd.hasTiles()) {
        checkRequiredTag(metadata, "TileLength", 1, "SubIFD" + n);
        checkRequiredTag(metadata, "TileOffsets", 1, "SubIFD" + n);
        checkRequiredTag(metadata, "TileWidth", -1, "SubIFD" + n);
      }
    } else {
      checkRequiredTag(metadata, "StripBYTECount", -1, "SubIFD" + n);
      checkRequiredTag(metadata, "StripOffsets", -1, "SubIFD" + n);
      checkRequiredTag(metadata, "RowsPerStrip", 1, "SubIFD" + n);
      checkForbiddenTag(metadata, "TileLength", "SubIFD" + n);
      checkForbiddenTag(metadata, "TileOffsets", "SubIFD" + n);
      checkForbiddenTag(metadata, "TileWidth", "SubIFD" + n);
    }

    int nycbcr = 0;
    if (metadata.containsTagId(TiffTags.getTagId("YCbCrCoefficients")))
      nycbcr++;
    if (metadata.containsTagId(TiffTags.getTagId("YCbCrSubSampling")))
      nycbcr++;
    if (metadata.containsTagId(TiffTags.getTagId("YCbCrPositioning")))
      nycbcr++;
    if (metadata.containsTagId(TiffTags.getTagId("ReferenceBlackWhite")))
      nycbcr++;
    if (nycbcr > 0 && nycbcr != 4) {
      checkRequiredTag(metadata, "YCbCrCoefficients", 3, "SubIFD" + n);
      checkRequiredTag(metadata, "YCbCrSubSampling", 2, "SubIFD" + n);
      checkRequiredTag(metadata, "YCbCrPositioning", 1, "SubIFD" + n);
      checkRequiredTag(metadata, "ReferenceBlackWhite", 6, "SubIFD" + n);
    }
    if (thumbnail) {
      checkForbiddenTag(metadata, "YCbCrCoefficients", "IFD" + n);
      checkForbiddenTag(metadata, "YCbCrSubSampling", "IFD" + n);
      checkForbiddenTag(metadata, "YCbCrPositioning", "IFD" + n);
      checkForbiddenTag(metadata, "ReferenceBlackWhite", "IFD" + n);
    }

    checkForbiddenTag(metadata, "PrimaryChromaticities", "IFD" + n);
    checkForbiddenTag(metadata, "WhitePoint", "IFD" + n);
    checkForbiddenTag(metadata, "TransferFunction", "IFD" + n);
  }
@ SuppressWarnings ( "unused" ) @ Deprecated private void validateSubIfd ( IFD ifd , int n ) { boolean thumbnail = ifd . getParent ( ) . getImageSize ( ) > ifd . getImageSize ( ) ; IfdTags metadata = ifd . getMetadata ( ) ; checkRequiredTag ( metadata , "ImageLength" , 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 , "SubIFD" + n ) ; int spp = - 1 ; if ( checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , "SubIFD" + n ) ) { spp = ( int ) metadata . get ( "SamplesPerPixel" ) . getFirstNumericValue ( ) ; checkRequiredTag ( metadata , "BitsPerSample" , spp , "SubIFD" + n ) ; } if ( checkRequiredTag ( metadata , "Compression" , 1 , "SubIFD" + n ) ) { int comp = ( int ) metadata . get ( "Compression" ) . getFirstNumericValue ( ) ; if ( comp == 1 ) checkForbiddenTag ( metadata , "CompressedBitsPerPixel" , "IFD" + n ) ; } checkRequiredTag ( metadata , "XResolution" , 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "YResolution" , 1 , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "SubIFDs" , "IFD" + n ) ; if ( thumbnail ) checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 1 } , "SubIFD" + n ) ; else checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } , "SubIFD" + n ) ; if ( checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 1 , 2 , 6 , 32803 , 32767 } , "SubIFD" + n ) ) { int photo = ( int ) metadata . get ( "PhotometricInterpretation" ) . getFirstNumericValue ( ) ; if ( photo != 6 ) { checkForbiddenTag ( metadata , "YCbCrCoefficients" , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "YCbCrSubSampling" , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "YCbCrPositioning" , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "ReferenceBlackWhite" , "SubIFD" + n ) ; } if ( photo == 2 || photo == 3 ) { if ( spp != 3 ) { validation . addError ( "Invalid SampesPerPixel value fo TiffEP" , "SubIFD" + n , spp ) ; } } else if ( photo == 1 || photo == 32803 ) { if ( spp != 1 ) { validation . addError ( "Invalid SampesPerPixel value fo TiffEP" , "SubIFD" + n , spp ) ; } if ( photo == 32803 ) { checkRequiredTag ( metadata , "CFARepeatPatternDim" , 2 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "CFAPattern" , - 1 , "SubIFD" + n ) ; } } } checkRequiredTag ( metadata , "PlanarConfiguration" , 1 , new long [ ] { 1 , 2 } , "SubIFD" + n ) ; checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 1 , 2 , 3 } , "SubIFD" + n ) ; if ( ! thumbnail ) { if ( ifd . hasStrips ( ) ) { checkRequiredTag ( metadata , "StripBYTECount" , - 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "StripOffsets" , - 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "RowsPerStrip" , 1 , "SubIFD" + n ) ; if ( ifd . hasTiles ( ) ) { validation . addErrorLoc ( "Image in both strips and tiles" , "SubIFD" ) ; } } else if ( ifd . hasTiles ( ) ) { checkRequiredTag ( metadata , "TileLength" , 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "TileOffsets" , 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "TileWidth" , - 1 , "SubIFD" + n ) ; } } else { checkRequiredTag ( metadata , "StripBYTECount" , - 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "StripOffsets" , - 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "RowsPerStrip" , 1 , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "TileLength" , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "TileOffsets" , "SubIFD" + n ) ; checkForbiddenTag ( metadata , "TileWidth" , "SubIFD" + n ) ; } int nycbcr = 0 ; if ( metadata . containsTagId ( TiffTags . getTagId ( "YCbCrCoefficients" ) ) ) nycbcr ++ ; if ( metadata . containsTagId ( TiffTags . getTagId ( "YCbCrSubSampling" ) ) ) nycbcr ++ ; if ( metadata . containsTagId ( TiffTags . getTagId ( "YCbCrPositioning" ) ) ) nycbcr ++ ; if ( metadata . containsTagId ( TiffTags . getTagId ( "ReferenceBlackWhite" ) ) ) nycbcr ++ ; if ( nycbcr > 0 && nycbcr != 4 ) { checkRequiredTag ( metadata , "YCbCrCoefficients" , 3 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "YCbCrSubSampling" , 2 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "YCbCrPositioning" , 1 , "SubIFD" + n ) ; checkRequiredTag ( metadata , "ReferenceBlackWhite" , 6 , "SubIFD" + n ) ; } if ( thumbnail ) { checkForbiddenTag ( metadata , "YCbCrCoefficients" , "IFD" + n ) ; checkForbiddenTag ( metadata , "YCbCrSubSampling" , "IFD" + n ) ; checkForbiddenTag ( metadata , "YCbCrPositioning" , "IFD" + n ) ; checkForbiddenTag ( metadata , "ReferenceBlackWhite" , "IFD" + n ) ; } checkForbiddenTag ( metadata , "PrimaryChromaticities" , "IFD" + n ) ; checkForbiddenTag ( metadata , "WhitePoint" , "IFD" + n ) ; checkForbiddenTag ( metadata , "TransferFunction" , "IFD" + n ) ; }
Validate sub ifd.

@param ifd the subifd
@param n the ifd number