FFmpeg
Loading...
Searching...
No Matches
libastcdec.c File Reference

ASTC decoder using ARM's astc-encoder library (astcenc C API). More...

#include <astcenc/astcenc.h>
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "profiles.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  LibAstcDecContext
 

Macros

#define ASTC_MAGIC   0x5CA1AB13
 
#define ASTC_HEADER_SIZE   16
 
#define ASTC_BLOCK_BYTES   16
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 
#define OFFSET(x)
 

Functions

static av_cold int astcdec_configure (AVCodecContext *avctx, enum astcenc_profile prf)
 
static av_cold int libastcdec_init (AVCodecContext *avctx)
 
static int libastcdec_decode (AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
static av_cold int libastcdec_close (AVCodecContext *avctx)
 

Variables

static const AVOption dec_options []
 
static const AVClass libastcenc_dec_class
 
const FFCodec ff_libastcenc_decoder
 

Detailed Description

ASTC decoder using ARM's astc-encoder library (astcenc C API).

Consumes the raw ASTC bitstream; block size and dimensions are recovered from the 16-byte .astc-style extradata published by the demuxer.

Definition in file libastcdec.c.

Macro Definition Documentation

◆ ASTC_MAGIC

#define ASTC_MAGIC   0x5CA1AB13

Definition at line 42 of file libastcdec.c.

Referenced by libastcdec_init(), and libastcenc_init().

◆ ASTC_HEADER_SIZE

#define ASTC_HEADER_SIZE   16

◆ ASTC_BLOCK_BYTES

#define ASTC_BLOCK_BYTES   16

Definition at line 44 of file libastcdec.c.

Referenced by astc_read_header(), libastcdec_decode(), and libastcenc_encode().

◆ VD

Definition at line 267 of file libastcdec.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 268 of file libastcdec.c.

Function Documentation

◆ astcdec_configure()

static av_cold int astcdec_configure ( AVCodecContext * avctx,
enum astcenc_profile prf )
static

Definition at line 57 of file libastcdec.c.

Referenced by libastcdec_init().

◆ libastcdec_init()

static av_cold int libastcdec_init ( AVCodecContext * avctx)
static

Definition at line 93 of file libastcdec.c.

◆ libastcdec_decode()

static int libastcdec_decode ( AVCodecContext * avctx,
AVFrame * frame,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 174 of file libastcdec.c.

◆ libastcdec_close()

static av_cold int libastcdec_close ( AVCodecContext * avctx)
static

Definition at line 257 of file libastcdec.c.

Variable Documentation

◆ dec_options

const AVOption dec_options[]
static
Initial value:
= {
{ "dec_profile", "Decoder color profile (must match encoder)", OFFSET(dec_profile),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 3, VD, .unit = "dec_profile" },
{ "ldr", "Linear LDR", 0, AV_OPT_TYPE_CONST, { .i64 = ASTCENC_PRF_LDR }, 0, 0, VD, .unit = "dec_profile" },
{ "ldr-srgb", "sRGB LDR", 0, AV_OPT_TYPE_CONST, { .i64 = ASTCENC_PRF_LDR_SRGB }, 0, 0, VD, .unit = "dec_profile" },
{ "hdr-ldr-a", "HDR RGB, LDR alpha", 0, AV_OPT_TYPE_CONST, { .i64 = ASTCENC_PRF_HDR_RGB_LDR_A }, 0, 0, VD, .unit = "dec_profile" },
{ "hdr", "HDR", 0, AV_OPT_TYPE_CONST, { .i64 = ASTCENC_PRF_HDR }, 0, 0, VD, .unit = "dec_profile" },
{ NULL },
}
#define VD
Definition amfdec.c:787
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 270 of file libastcdec.c.

◆ libastcenc_dec_class

const AVClass libastcenc_dec_class
static
Initial value:
= {
.class_name = "libastcenc decoder",
.item_name = av_default_item_name,
.option = dec_options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
static const AVOption dec_options[]
Definition libastcdec.c:270

Definition at line 280 of file libastcdec.c.

◆ ff_libastcenc_decoder

const FFCodec ff_libastcenc_decoder
Initial value:
= {
.p.name = "libastcenc",
CODEC_LONG_NAME("ASTC (Adaptive Scalable Texture Compression) image using astc-encoder"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.capabilities = AV_CODEC_CAP_DR1,
.p.priv_class = &libastcenc_dec_class,
.p.wrapper_name = "libastcenc",
.priv_data_size = sizeof(LibAstcDecContext),
.close = libastcdec_close,
}
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_ASTC
Definition codec_id.h:327
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int libastcdec_init(AVCodecContext *avctx)
Definition libastcdec.c:93
static const AVClass libastcenc_dec_class
Definition libastcdec.c:280
static int libastcdec_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition libastcdec.c:174
static av_cold int libastcdec_close(AVCodecContext *avctx)
Definition libastcdec.c:257
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:97
#define AV_PIX_FMT_RGBAF16
Definition pixfmt.h:630
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
const AVProfile ff_astc_profiles[]
Definition profiles.c:223

Definition at line 287 of file libastcdec.c.