Changeset 10862 in josm for trunk/src/com/drew/metadata/jpeg
- Timestamp:
- 2016-08-20T20:58:03+02:00 (8 years ago)
- Location:
- trunk/src/com/drew/metadata/jpeg
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/jpeg/JpegCommentDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/jpeg/JpegCommentDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/jpeg/JpegCommentReader.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 26 26 import com.drew.metadata.Metadata; 27 27 28 import java.util. Arrays;28 import java.util.Collections; 29 29 30 30 /** … … 39 39 public Iterable<JpegSegmentType> getSegmentTypes() 40 40 { 41 return Arrays.asList(JpegSegmentType.COM); 42 } 43 44 public boolean canProcess(@NotNull byte[] segmentBytes, @NotNull JpegSegmentType segmentType) 45 { 46 // The entire contents of the byte[] is the comment. There's nothing here to discriminate upon. 47 return true; 41 return Collections.singletonList(JpegSegmentType.COM); 48 42 } 49 43 -
trunk/src/com/drew/metadata/jpeg/JpegComponent.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 21 21 package com.drew.metadata.jpeg; 22 22 23 import com.drew.lang.annotations.N ullable;23 import com.drew.lang.annotations.NotNull; 24 24 25 25 import java.io.Serializable; … … 55 55 * @return the component name 56 56 */ 57 @N ullable57 @NotNull 58 58 public String getComponentName() 59 59 { … … 70 70 case 5: 71 71 return "Q"; 72 default: 73 return String.format("Unknown (%s)", _componentId); 72 74 } 73 return null;74 75 } 75 76 … … 81 82 public int getHorizontalSamplingFactor() 82 83 { 83 return _samplingFactorByte& 0x0F;84 return (_samplingFactorByte>>4) & 0x0F; 84 85 } 85 86 86 87 public int getVerticalSamplingFactor() 87 88 { 88 return (_samplingFactorByte>>4)& 0x0F;89 return _samplingFactorByte & 0x0F; 89 90 } 90 91 } -
trunk/src/com/drew/metadata/jpeg/JpegDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 25 25 import com.drew.metadata.TagDescriptor; 26 26 27 import static com.drew.metadata.jpeg.JpegDirectory.*; 28 27 29 /** 28 30 * Provides human-readable string versions of the tags stored in a JpegDirectory. … … 44 46 switch (tagType) 45 47 { 46 case JpegDirectory.TAG_COMPRESSION_TYPE:48 case TAG_COMPRESSION_TYPE: 47 49 return getImageCompressionTypeDescription(); 48 case JpegDirectory.TAG_COMPONENT_DATA_1:50 case TAG_COMPONENT_DATA_1: 49 51 return getComponentDataDescription(0); 50 case JpegDirectory.TAG_COMPONENT_DATA_2:52 case TAG_COMPONENT_DATA_2: 51 53 return getComponentDataDescription(1); 52 case JpegDirectory.TAG_COMPONENT_DATA_3:54 case TAG_COMPONENT_DATA_3: 53 55 return getComponentDataDescription(2); 54 case JpegDirectory.TAG_COMPONENT_DATA_4:56 case TAG_COMPONENT_DATA_4: 55 57 return getComponentDataDescription(3); 56 case JpegDirectory.TAG_DATA_PRECISION:58 case TAG_DATA_PRECISION: 57 59 return getDataPrecisionDescription(); 58 case JpegDirectory.TAG_IMAGE_HEIGHT:60 case TAG_IMAGE_HEIGHT: 59 61 return getImageHeightDescription(); 60 case JpegDirectory.TAG_IMAGE_WIDTH:62 case TAG_IMAGE_WIDTH: 61 63 return getImageWidthDescription(); 62 64 default: … … 68 70 public String getImageCompressionTypeDescription() 69 71 { 70 Integer value = _directory.getInteger(JpegDirectory.TAG_COMPRESSION_TYPE); 71 if (value==null) 72 return null; 73 // Note there is no 2 or 12 74 switch (value) { 75 case 0: return "Baseline"; 76 case 1: return "Extended sequential, Huffman"; 77 case 2: return "Progressive, Huffman"; 78 case 3: return "Lossless, Huffman"; 79 case 5: return "Differential sequential, Huffman"; 80 case 6: return "Differential progressive, Huffman"; 81 case 7: return "Differential lossless, Huffman"; 82 case 8: return "Reserved for JPEG extensions"; 83 case 9: return "Extended sequential, arithmetic"; 84 case 10: return "Progressive, arithmetic"; 85 case 11: return "Lossless, arithmetic"; 86 case 13: return "Differential sequential, arithmetic"; 87 case 14: return "Differential progressive, arithmetic"; 88 case 15: return "Differential lossless, arithmetic"; 89 default: 90 return "Unknown type: "+ value; 91 } 72 return getIndexedDescription(TAG_COMPRESSION_TYPE, 73 "Baseline", 74 "Extended sequential, Huffman", 75 "Progressive, Huffman", 76 "Lossless, Huffman", 77 null, // no 4 78 "Differential sequential, Huffman", 79 "Differential progressive, Huffman", 80 "Differential lossless, Huffman", 81 "Reserved for JPEG extensions", 82 "Extended sequential, arithmetic", 83 "Progressive, arithmetic", 84 "Lossless, arithmetic", 85 null, // no 12 86 "Differential sequential, arithmetic", 87 "Differential progressive, arithmetic", 88 "Differential lossless, arithmetic"); 92 89 } 90 93 91 @Nullable 94 92 public String getImageWidthDescription() 95 93 { 96 final String value = _directory.getString( JpegDirectory.TAG_IMAGE_WIDTH);94 final String value = _directory.getString(TAG_IMAGE_WIDTH); 97 95 if (value==null) 98 96 return null; … … 103 101 public String getImageHeightDescription() 104 102 { 105 final String value = _directory.getString( JpegDirectory.TAG_IMAGE_HEIGHT);103 final String value = _directory.getString(TAG_IMAGE_HEIGHT); 106 104 if (value==null) 107 105 return null; … … 112 110 public String getDataPrecisionDescription() 113 111 { 114 final String value = _directory.getString( JpegDirectory.TAG_DATA_PRECISION);112 final String value = _directory.getString(TAG_DATA_PRECISION); 115 113 if (value==null) 116 114 return null; -
trunk/src/com/drew/metadata/jpeg/JpegDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/jpeg/JpegReader.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/jpeg/package.html
r8132 r10862 1 1 <!-- 2 ~ Copyright 2002-201 5Drew Noakes2 ~ Copyright 2002-2016 Drew Noakes 3 3 ~ 4 4 ~ Licensed under the Apache License, Version 2.0 (the "License");
Note:
See TracChangeset
for help on using the changeset viewer.