summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-06-16 13:47:23 +0200
committerAnton Khirnov <anton@khirnov.net>2016-07-25 13:57:01 +0200
commit866f6a17754a532f56e7632823082b0bf3ac9af8 (patch)
treed59b0611dce95127dd1f5a8e52d01cbc6bb80dc4
parent73218654055b0d81ad841dc13c9d7f821bad9d3f (diff)
cfhd: Replace codec state parameter magic numbers by names from the spec
-rw-r--r--libavcodec/cfhd.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index ee67900cb7..35b85ffc8f 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -240,6 +240,19 @@ static int alloc_buffers(AVCodecContext *avctx)
return 0;
}
+#define PARAM_ChannelCount 12
+#define PARAM_SubbandCount 14
+#define PARAM_imageWidth 20
+#define PARAM_imageHeight 21
+#define PARAM_LowpassPrecision 35
+#define PARAM_SubbandNumber 48
+#define PARAM_Quantization 53
+#define PARAM_ChannelNumber 62
+#define PARAM_BitsPerComponent 101
+#define PARAM_ChannelWidth 104
+#define PARAM_ChannelHeight 105
+#define PARAM_PrescaleShift 109
+
static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
GetByteContext *gb, int16_t tag, uint16_t data,
int *planes)
@@ -274,7 +287,7 @@ static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
}
av_log(avctx, AV_LOG_DEBUG, "Transform-type? %"PRIu16"\n", data);
break;
- case 12:
+ case PARAM_ChannelCount:
av_log(avctx, AV_LOG_DEBUG, "Channel count: %"PRIu16"\n", data);
if (data > 4) {
@@ -285,7 +298,7 @@ static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
s->channel_cnt = data;
break;
- case 14:
+ case PARAM_SubbandCount:
av_log(avctx, AV_LOG_DEBUG, "Subband count: %"PRIu16"\n", data);
if (data != SUBBAND_COUNT) {
avpriv_report_missing_feature(avctx, "Subband count %"PRIu16,
@@ -293,22 +306,22 @@ static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
return AVERROR_PATCHWELCOME;
}
break;
- case 20:
+ case PARAM_imageWidth:
av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16"\n", data);
s->coded_width = data;
break;
- case 21:
+ case PARAM_imageHeight:
av_log(avctx, AV_LOG_DEBUG, "Height %"PRIu16"\n", data);
s->coded_height = data;
break;
case 23:
avpriv_report_missing_feature(avctx, "Skip frame");
return AVERROR_PATCHWELCOME;
- case 35:
+ case PARAM_LowpassPrecision:
av_log(avctx, AV_LOG_DEBUG, "Lowpass precision bits: %"PRIu16"\n",
data);
break;
- case 48:
+ case PARAM_SubbandNumber:
av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n", data);
if (data > 3) {
av_log(avctx, AV_LOG_ERROR, "Invalid subband number\n");
@@ -335,11 +348,11 @@ static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
s->subband_num_actual = data;
break;
- case 53:
+ case PARAM_Quantization:
s->quantisation = data;
av_log(avctx, AV_LOG_DEBUG, "Quantisation: %"PRIu16"\n", data);
break;
- case 62:
+ case PARAM_ChannelNumber:
av_log(avctx, AV_LOG_DEBUG, "Channel number %"PRIu16"\n", data);
if (data >= *planes) {
av_log(avctx, AV_LOG_ERROR, "Invalid channel number\n");
@@ -386,7 +399,7 @@ static int parse_header_tag(AVCodecContext *avctx, CFHDContext *s,
data);
s->bpc = data;
break;
- case 109:
+ case PARAM_PrescaleShift:
s->prescale_shift[0] = (data >> 0) & 0x7;
s->prescale_shift[1] = (data >> 3) & 0x7;
s->prescale_shift[2] = (data >> 6) & 0x7;