FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
dds.c File Reference

DDS decoder. More...

#include <stdint.h>
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "texturedsp.h"
#include "thread.h"

Go to the source code of this file.

Data Structures

struct  DDSContext
 

Macros

#define DDPF_FOURCC   (1 << 2)
 
#define DDPF_PALETTE   (1 << 5)
 
#define DDPF_NORMALMAP   (1U << 31)
 

Enumerations

enum  DDSPostProc {
  DDS_NONE = 0, DDS_ALPHA_EXP, DDS_NORMAL_MAP, DDS_RAW_YCOCG,
  DDS_SWAP_ALPHA, DDS_SWIZZLE_A2XY, DDS_SWIZZLE_RBXG, DDS_SWIZZLE_RGXB,
  DDS_SWIZZLE_RXBG, DDS_SWIZZLE_RXGB, DDS_SWIZZLE_XGBR, DDS_SWIZZLE_XRBG,
  DDS_SWIZZLE_XGXR
}
 
enum  DDSDXGIFormat {
  DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, DXGI_FORMAT_R16G16B16A16_FLOAT = 10, DXGI_FORMAT_R16G16B16A16_UNORM = 11, DXGI_FORMAT_R16G16B16A16_UINT = 12,
  DXGI_FORMAT_R16G16B16A16_SNORM = 13, DXGI_FORMAT_R16G16B16A16_SINT = 14, DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, DXGI_FORMAT_R8G8B8A8_UNORM = 28,
  DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, DXGI_FORMAT_R8G8B8A8_UINT = 30, DXGI_FORMAT_R8G8B8A8_SNORM = 31, DXGI_FORMAT_R8G8B8A8_SINT = 32,
  DXGI_FORMAT_BC1_TYPELESS = 70, DXGI_FORMAT_BC1_UNORM = 71, DXGI_FORMAT_BC1_UNORM_SRGB = 72, DXGI_FORMAT_BC2_TYPELESS = 73,
  DXGI_FORMAT_BC2_UNORM = 74, DXGI_FORMAT_BC2_UNORM_SRGB = 75, DXGI_FORMAT_BC3_TYPELESS = 76, DXGI_FORMAT_BC3_UNORM = 77,
  DXGI_FORMAT_BC3_UNORM_SRGB = 78, DXGI_FORMAT_BC4_TYPELESS = 79, DXGI_FORMAT_BC4_UNORM = 80, DXGI_FORMAT_BC4_SNORM = 81,
  DXGI_FORMAT_BC5_TYPELESS = 82, DXGI_FORMAT_BC5_UNORM = 83, DXGI_FORMAT_BC5_SNORM = 84, DXGI_FORMAT_B5G6R5_UNORM = 85,
  DXGI_FORMAT_B8G8R8A8_UNORM = 87, DXGI_FORMAT_B8G8R8X8_UNORM = 88, DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
  DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93
}
 

Functions

static int parse_pixel_format (AVCodecContext *avctx)
 
static int decompress_texture_thread (AVCodecContext *avctx, void *arg, int slice, int thread_nb)
 
static void do_swizzle (AVFrame *frame, int x, int y)
 
static void run_postproc (AVCodecContext *avctx, AVFrame *frame)
 
static int dds_decode (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 

Variables

AVCodec ff_dds_decoder
 

Detailed Description

DDS decoder.

https://msdn.microsoft.com/en-us/library/bb943982%28v=vs.85%29.aspx

Definition in file dds.c.

Macro Definition Documentation

#define DDPF_FOURCC   (1 << 2)

Definition at line 40 of file dds.c.

Referenced by parse_pixel_format().

#define DDPF_PALETTE   (1 << 5)

Definition at line 41 of file dds.c.

Referenced by parse_pixel_format().

#define DDPF_NORMALMAP   (1U << 31)

Definition at line 42 of file dds.c.

Referenced by parse_pixel_format().

Enumeration Type Documentation

Enumerator
DDS_NONE 
DDS_ALPHA_EXP 
DDS_NORMAL_MAP 
DDS_RAW_YCOCG 
DDS_SWAP_ALPHA 
DDS_SWIZZLE_A2XY 
DDS_SWIZZLE_RBXG 
DDS_SWIZZLE_RGXB 
DDS_SWIZZLE_RXBG 
DDS_SWIZZLE_RXGB 
DDS_SWIZZLE_XGBR 
DDS_SWIZZLE_XRBG 
DDS_SWIZZLE_XGXR 

Definition at line 44 of file dds.c.

Enumerator
DXGI_FORMAT_R16G16B16A16_TYPELESS 
DXGI_FORMAT_R16G16B16A16_FLOAT 
DXGI_FORMAT_R16G16B16A16_UNORM 
DXGI_FORMAT_R16G16B16A16_UINT 
DXGI_FORMAT_R16G16B16A16_SNORM 
DXGI_FORMAT_R16G16B16A16_SINT 
DXGI_FORMAT_R8G8B8A8_TYPELESS 
DXGI_FORMAT_R8G8B8A8_UNORM 
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB 
DXGI_FORMAT_R8G8B8A8_UINT 
DXGI_FORMAT_R8G8B8A8_SNORM 
DXGI_FORMAT_R8G8B8A8_SINT 
DXGI_FORMAT_BC1_TYPELESS 
DXGI_FORMAT_BC1_UNORM 
DXGI_FORMAT_BC1_UNORM_SRGB 
DXGI_FORMAT_BC2_TYPELESS 
DXGI_FORMAT_BC2_UNORM 
DXGI_FORMAT_BC2_UNORM_SRGB 
DXGI_FORMAT_BC3_TYPELESS 
DXGI_FORMAT_BC3_UNORM 
DXGI_FORMAT_BC3_UNORM_SRGB 
DXGI_FORMAT_BC4_TYPELESS 
DXGI_FORMAT_BC4_UNORM 
DXGI_FORMAT_BC4_SNORM 
DXGI_FORMAT_BC5_TYPELESS 
DXGI_FORMAT_BC5_UNORM 
DXGI_FORMAT_BC5_SNORM 
DXGI_FORMAT_B5G6R5_UNORM 
DXGI_FORMAT_B8G8R8A8_UNORM 
DXGI_FORMAT_B8G8R8X8_UNORM 
DXGI_FORMAT_B8G8R8A8_TYPELESS 
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB 
DXGI_FORMAT_B8G8R8X8_TYPELESS 
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB 

Definition at line 60 of file dds.c.

Function Documentation

static int parse_pixel_format ( AVCodecContext avctx)
static

Definition at line 116 of file dds.c.

Referenced by dds_decode().

static int decompress_texture_thread ( AVCodecContext avctx,
void arg,
int  slice,
int  thread_nb 
)
static

Definition at line 436 of file dds.c.

Referenced by dds_decode().

static void do_swizzle ( AVFrame frame,
int  x,
int  y 
)
static

Definition at line 473 of file dds.c.

Referenced by run_postproc().

static void run_postproc ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 482 of file dds.c.

Referenced by dds_decode().

static int dds_decode ( AVCodecContext avctx,
void data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 608 of file dds.c.

Variable Documentation

AVCodec ff_dds_decoder
Initial value:
= {
.name = "dds",
.long_name = NULL_IF_CONFIG_SMALL("DirectDraw Surface image decoder"),
.decode = dds_decode,
.priv_data_size = sizeof(DDSContext),
}
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
Definition: dds.c:99
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1028
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:968
static int dds_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: dds.c:608

Definition at line 750 of file dds.c.