54 default:
return "unexpected";
63 uint32_t sign = (uint32_t)(
h & 0x8000u) << 16;
64 uint32_t
exp = (
h & 0x7C00u) >> 10;
65 uint32_t mant =
h & 0x03FFu;
69 f = 0x7F800000u | (mant << 13);
70 }
else if (
exp == 0) {
74 while (!(mant & 0x0400u)) {
79 f = ((uint32_t)(
exp + 112) << 23) | (mant << 13);
81 f = ((
exp + 112) << 23) | (mant << 13);
91 for (y = 0; y <
frame->height; y++) {
93 uint8_t *row =
frame->data[0] + (size_t)y *
frame->linesize[0];
94 for (x = 0; x <
frame->width; x++) {
95 row[4 * x + 0] = 0x80;
96 row[4 * x + 1] = 0x80;
97 row[4 * x + 2] = 0x80;
98 row[4 * x + 3] = 0xff;
101 float *row = (
float *)(
frame->data[0] + (
size_t)y *
frame->linesize[0]);
102 for (x = 0; x <
frame->width; x++) {
103 row[4 * x + 0] = 2.5f;
104 row[4 * x + 1] = 2.5f;
105 row[4 * x + 2] = 2.5f;
106 row[4 * x + 3] = 2.5f;
119 const uint16_t *
half;
122 rgba =
frame->data[0];
123 printf(
"decoded %s: 0x%02x 0x%02x 0x%02x 0x%02x",
125 rgba[0], rgba[1], rgba[2], rgba[3]);
128 printf(
"decoded %s: %.3f %.3f %.3f %.3f",
133 printf(
"decoded %s: unexpected format",
140 const char *priv_profile,
int dec_profile)
148 printf(
"requested profile %d", req_profile);
150 printf(
", private profile %s", priv_profile);
160 enc_ctx->
profile = req_profile;
209 dec_ctx->profile = dec_profile;
264 const char *priv_profile;
301 cases[
i].priv_profile, cases[
i].dec_profile);
static int run_case(const AVCodec *enc, const AVCodec *dec, int req_profile, enum AVPixelFormat pix_fmt, const char *priv_profile, int dec_profile)
static void print_texel(const AVFrame *frame)
static const char * fmt_label(enum AVPixelFormat pix_fmt)
static float half_to_float(uint16_t h)
static int fill_frame(const AVFrame *frame)
static AVDictionary * opts
Libavcodec external API header.
#define i(width, name, range_min, range_max)
common internal and external API header
__device__ int printf(const char *,...)
static AVCodecContext * dec_ctx
Misc types and constants that do not belong anywhere else.
#define AV_PROFILE_UNKNOWN
#define AV_PROFILE_ASTC_LDR
Linear LDR.
#define AV_PROFILE_ASTC_HDR
HDR RGB and alpha.
#define AV_PROFILE_ASTC_HDR_RGB_LDR_A
HDR RGB with LDR alpha.
#define AV_PROFILE_ASTC_LDR_SRGB
sRGB LDR.
#define AV_PROFILE_ASTC_LINEAR_ANY
static enum AVPixelFormat pix_fmt
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Read encoded data from the encoder.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Supply a raw video or audio frame to the encoder.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Memory handling functions.
static uint8_t half(int a, int b)
#define AV_PIX_FMT_RGBAF32
#define AV_PIX_FMT_RGBAF16
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
#define FF_ARRAY_ELEMS(a)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
This structure stores compressed data.
Rational number (pair of numerator and denominator).