avcodec/cfhd: Add CFHDSegment enum and named identifiers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-02-14 23:00:02 +01:00
committed by michaelni
parent d138169966
commit 2263e05e41
3 changed files with 17 additions and 8 deletions
+2 -2
View File
@@ -631,7 +631,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
} else
av_log(avctx, AV_LOG_DEBUG, "Unknown tag %i data %x\n", tag, data);
if (tag == BitstreamMarker && data == 0xf0f &&
if (tag == BitstreamMarker && data == CoefficientSegment &&
s->coded_format != AV_PIX_FMT_NONE) {
int lowpass_height = s->plane[s->channel_num].band[0][0].height;
int lowpass_width = s->plane[s->channel_num].band[0][0].width;
@@ -701,7 +701,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
coeff_data = s->plane[s->channel_num].subband[s->subband_num_actual];
/* Lowpass coefficients */
if (tag == BitstreamMarker && data == 0xf0f) {
if (tag == BitstreamMarker && data == CoefficientSegment) {
int lowpass_height, lowpass_width, lowpass_a_height, lowpass_a_width;
if (!s->a_width || !s->a_height) {
+9
View File
@@ -91,6 +91,15 @@ enum CFHDParam {
ChannelHeight = 105,
};
enum CFHDSegment {
LowPassSegment = 0x1a4a,
LowPassEndSegment = 0x1b4b,
HighPassSegment = 0x0d0d,
BandSegment = 0x0e0e,
HighPassEndSegment = 0x0c0c,
CoefficientSegment = 0x0f0f,
};
#define VLC_BITS 9
#define SUBBAND_COUNT 10
#define SUBBAND_COUNT_3D 17
+6 -6
View File
@@ -627,7 +627,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x1a4a);
bytestream2_put_be16(pby, LowPassSegment);
pos = bytestream2_tell_p(pby);
@@ -653,7 +653,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream2_put_be16(pby, 16);
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0f0f);
bytestream2_put_be16(pby, CoefficientSegment);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++)
@@ -662,7 +662,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x1b4b);
bytestream2_put_be16(pby, LowPassEndSegment);
for (int l = 0; l < 3; l++) {
for (int i = 0; i < 3; i++) {
@@ -677,7 +677,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int height = s->plane[p].band[l][0].height;
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0d0d);
bytestream2_put_be16(pby, HighPassSegment);
bytestream2_put_be16(pby, WaveletType);
bytestream2_put_be16(pby, 3 + 2 * (l == 2));
@@ -714,7 +714,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int count = 0, padd = 0;
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0e0e);
bytestream2_put_be16(pby, BandSegment);
bytestream2_put_be16(pby, SubbandNumber);
bytestream2_put_be16(pby, i + 1);
@@ -783,7 +783,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0c0c);
bytestream2_put_be16(pby, HighPassEndSegment);
}
s->plane[p].size = bytestream2_tell_p(pby) - pos;