diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-04-13 03:45:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-13 03:45:45 +0200 |
commit | b9b2f9d218bad3001edc64704865987fd7cf7dca (patch) | |
tree | 2fa210c6ef3eba82b0e1cf67ae315903f81098fb /libavcodec/tiff.c | |
parent | 75b4e4013796b26c8cc22fd9f9bec0cc8672c767 (diff) | |
parent | a9b046fb0ae5395c4d1d8a82cd0d3e354b5034ed (diff) | |
download | ffmpeg-b9b2f9d218bad3001edc64704865987fd7cf7dca.tar.gz |
Merge commit 'a9b046fb0ae5395c4d1d8a82cd0d3e354b5034ed'
* commit 'a9b046fb0ae5395c4d1d8a82cd0d3e354b5034ed':
tiff: use a better name and enum values for PhotometricInterpretation
Conflicts:
libavcodec/tiff.c
libavcodec/tiff.h
libavcodec/tiffenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r-- | libavcodec/tiff.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 0868a016e3..c5891d4d70 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -53,7 +53,7 @@ typedef struct TiffContext { int palette_is_set; int le; enum TiffCompr compr; - int invert; + enum TiffPhotometric photometric; int planar; int fax_opts; int predictor; @@ -744,20 +744,31 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) case TIFF_PREDICTOR: s->predictor = value; break; - case TIFF_INVERT: + case TIFF_PHOTOMETRIC: switch (value) { - case 0: - s->invert = 1; - break; - case 1: - s->invert = 0; - break; - case 2: - case 3: + case TIFF_PHOTOMETRIC_WHITE_IS_ZERO: + case TIFF_PHOTOMETRIC_BLACK_IS_ZERO: + case TIFF_PHOTOMETRIC_RGB: + case TIFF_PHOTOMETRIC_PALETTE: + s->photometric = value; break; + case TIFF_PHOTOMETRIC_ALPHA_MASK: + case TIFF_PHOTOMETRIC_SEPARATED: + case TIFF_PHOTOMETRIC_YCBCR: + case TIFF_PHOTOMETRIC_CIE_LAB: + case TIFF_PHOTOMETRIC_ICC_LAB: + case TIFF_PHOTOMETRIC_ITU_LAB: + case TIFF_PHOTOMETRIC_CFA: + case TIFF_PHOTOMETRIC_LOG_L: + case TIFF_PHOTOMETRIC_LOG_LUV: + case TIFF_PHOTOMETRIC_LINEAR_RAW: + avpriv_report_missing_feature(s->avctx, + "PhotometricInterpretation 0x%04X", + value); + return AVERROR_PATCHWELCOME; default: - av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", - value); + av_log(s->avctx, AV_LOG_ERROR, "PhotometricInterpretation %u is " + "unknown\n", value); return AVERROR_INVALIDDATA; } break; @@ -967,12 +978,12 @@ static int decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n"); return AVERROR_INVALIDDATA; } - s->le = le; + s->le = le; // TIFF_BPP is not a required tag and defaults to 1 - s->bppcount = s->bpp = 1; - s->invert = 0; - s->compr = TIFF_RAW; - s->fill_order = 0; + s->bppcount = s->bpp = 1; + s->photometric = TIFF_PHOTOMETRIC_NONE; + s->compr = TIFF_RAW; + s->fill_order = 0; free_geotags(s); // Reset these offsets so we can tell if they were set this frame @@ -1095,7 +1106,7 @@ static int decode_frame(AVCodecContext *avctx, } } - if (s->invert) { + if (s->photometric == TIFF_PHOTOMETRIC_WHITE_IS_ZERO) { dst = p->data[plane]; for (i = 0; i < s->height; i++) { for (j = 0; j < p->linesize[plane]; j++) |