aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hapenc.c
diff options
context:
space:
mode:
authorTom Butterworth <bangnoise@gmail.com>2015-07-23 14:44:24 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-23 20:59:57 +0200
commit64539e12132cb5058042f7e276cea9bc44873026 (patch)
tree758ca9fb6d0844c0b0703053c951b3636f0c7e62 /libavcodec/hapenc.c
parent26e8247c1c0b80052571562b84a91a76f92bddfa (diff)
downloadffmpeg-64539e12132cb5058042f7e276cea9bc44873026.tar.gz
avcodec/hap: (trivial) rename enum values and document their meaning
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hapenc.c')
-rw-r--r--libavcodec/hapenc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index 8261fe9f98..39c1c5afac 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -46,8 +46,10 @@
#define HAP_MAX_CHUNKS 64
enum HapHeaderLength {
- HAP_HDR_4_BYTE = 4,
- HAP_HDR_8_BYTE = 8,
+ /* Short header: four bytes with a 24 bit size value */
+ HAP_HDR_SHORT = 4,
+ /* Long header: eight bytes with a 32 bit size value */
+ HAP_HDR_LONG = 8,
};
static void compress_texture(AVCodecContext *avctx, const AVFrame *f)
@@ -75,10 +77,10 @@ static void hap_write_section_header(PutByteContext *pbc,
* header) or zero if using an eight-byte header.
* For an eight-byte header, the length is in the last four bytes.
* The fourth byte stores the section type. */
- bytestream2_put_le24(pbc, header_length == HAP_HDR_8_BYTE ? 0 : section_length);
+ bytestream2_put_le24(pbc, header_length == HAP_HDR_LONG ? 0 : section_length);
bytestream2_put_byte(pbc, section_type);
- if (header_length == HAP_HDR_8_BYTE) {
+ if (header_length == HAP_HDR_LONG) {
bytestream2_put_le32(pbc, section_length);
}
}
@@ -143,11 +145,11 @@ static int hap_decode_instructions_length(HapContext *ctx)
static int hap_header_length(HapContext *ctx)
{
/* Top section header (long version) */
- int length = HAP_HDR_8_BYTE;
+ int length = HAP_HDR_LONG;
if (ctx->chunk_count > 1) {
/* Decode Instructions header (short) + Decode Instructions Container */
- length += HAP_HDR_4_BYTE + hap_decode_instructions_length(ctx);
+ length += HAP_HDR_SHORT + hap_decode_instructions_length(ctx);
}
return length;
@@ -161,22 +163,22 @@ static void hap_write_frame_header(HapContext *ctx, uint8_t *dst, int frame_leng
bytestream2_init_writer(&pbc, dst, frame_length);
if (ctx->chunk_count == 1) {
/* Write a simple header */
- hap_write_section_header(&pbc, HAP_HDR_8_BYTE, frame_length - 8,
+ hap_write_section_header(&pbc, HAP_HDR_LONG, frame_length - 8,
ctx->chunks[0].compressor | ctx->opt_tex_fmt);
} else {
/* Write a complex header with Decode Instructions Container */
- hap_write_section_header(&pbc, HAP_HDR_8_BYTE, frame_length - 8,
+ hap_write_section_header(&pbc, HAP_HDR_LONG, frame_length - 8,
HAP_COMP_COMPLEX | ctx->opt_tex_fmt);
- hap_write_section_header(&pbc, HAP_HDR_4_BYTE, hap_decode_instructions_length(ctx),
+ hap_write_section_header(&pbc, HAP_HDR_SHORT, hap_decode_instructions_length(ctx),
HAP_ST_DECODE_INSTRUCTIONS);
- hap_write_section_header(&pbc, HAP_HDR_4_BYTE, ctx->chunk_count,
+ hap_write_section_header(&pbc, HAP_HDR_SHORT, ctx->chunk_count,
HAP_ST_COMPRESSOR_TABLE);
for (i = 0; i < ctx->chunk_count; i++) {
bytestream2_put_byte(&pbc, ctx->chunks[i].compressor >> 4);
}
- hap_write_section_header(&pbc, HAP_HDR_4_BYTE, ctx->chunk_count * 4,
+ hap_write_section_header(&pbc, HAP_HDR_SHORT, ctx->chunk_count * 4,
HAP_ST_SIZE_TABLE);
for (i = 0; i < ctx->chunk_count; i++) {