libavcodec/crystalhd.c File Reference

#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libcrystalhd/bc_dts_types.h>
#include <libcrystalhd/bc_dts_defs.h>
#include <libcrystalhd/libcrystalhd_if.h>
#include "avcodec.h"
#include "h264.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  OpaqueList
struct  CHDContext

Defines

#define _XOPEN_SOURCE   600
#define OUTPUT_PROC_TIMEOUT   50
 Timeout parameter passed to DtsProcOutput() in us.
#define TIMESTAMP_UNIT   100000
 Step between fake timestamps passed to hardware in units of 100ns.
#define BASE_WAIT   10000
 Initial value in us of the wait in decode().
#define WAIT_UNIT   1000
 Increment in us to adjust wait in decode().

Typedefs

typedef struct OpaqueList OpaqueList

Enumerations

enum  CopyRet {
  RET_ERROR = -1, RET_OK = 0, RET_COPY_AGAIN = 1, RET_SKIP_NEXT_COPY = 2,
  RET_COPY_NEXT_FIELD = 3
}

Functions

static BC_MEDIA_SUBTYPE id2subtype (CHDContext *priv, enum CodecID id)
static void print_frame_info (CHDContext *priv, BC_DTS_PROC_OUT *output)
static uint64_t opaque_list_push (CHDContext *priv, uint64_t reordered_opaque, uint8_t pic_type)
static OpaqueListopaque_list_pop (CHDContext *priv, uint64_t fake_timestamp)
static void flush (AVCodecContext *avctx)
static av_cold int uninit (AVCodecContext *avctx)
static av_cold int init (AVCodecContext *avctx)
static CopyRet copy_frame (AVCodecContext *avctx, BC_DTS_PROC_OUT *output, void *data, int *data_size)
static CopyRet receive_frame (AVCodecContext *avctx, void *data, int *data_size)
static int decode (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)

Variables

static const AVOption options []
static AVClass h264_class
AVCodec ff_h264_crystalhd_decoder
static AVClass mpeg2_class
AVCodec ff_mpeg2_crystalhd_decoder
static AVClass mpeg4_class
AVCodec ff_mpeg4_crystalhd_decoder
static AVClass msmpeg4_class
AVCodec ff_msmpeg4_crystalhd_decoder
static AVClass vc1_class
AVCodec ff_vc1_crystalhd_decoder
static AVClass wmv3_class
AVCodec ff_wmv3_crystalhd_decoder

Define Documentation

#define _XOPEN_SOURCE   600

Definition at line 76 of file crystalhd.c.

#define BASE_WAIT   10000

Initial value in us of the wait in decode().

Definition at line 97 of file crystalhd.c.

Referenced by decode().

#define OUTPUT_PROC_TIMEOUT   50

Timeout parameter passed to DtsProcOutput() in us.

Definition at line 93 of file crystalhd.c.

Referenced by receive_frame().

#define TIMESTAMP_UNIT   100000

Step between fake timestamps passed to hardware in units of 100ns.

Definition at line 95 of file crystalhd.c.

#define WAIT_UNIT   1000

Increment in us to adjust wait in decode().

Definition at line 99 of file crystalhd.c.


Typedef Documentation

typedef struct OpaqueList OpaqueList

Enumeration Type Documentation

enum CopyRet
Enumerator:
RET_ERROR 
RET_OK 
RET_COPY_AGAIN 
RET_SKIP_NEXT_COPY 
RET_COPY_NEXT_FIELD 

Definition at line 106 of file crystalhd.c.


Function Documentation

static CopyRet copy_frame ( AVCodecContext avctx,
BC_DTS_PROC_OUT *  output,
void *  data,
int *  data_size 
) [inline, static]

Definition at line 536 of file crystalhd.c.

Referenced by receive_frame().

static int decode ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 812 of file crystalhd.c.

Referenced by opt_codecs(), and opt_formats().

static void flush ( AVCodecContext avctx  )  [static]

Definition at line 315 of file crystalhd.c.

static BC_MEDIA_SUBTYPE id2subtype ( CHDContext priv,
enum CodecID  id 
) [inline, static]

Definition at line 166 of file crystalhd.c.

Referenced by init().

static av_cold int init ( AVCodecContext avctx  )  [static]

Definition at line 380 of file crystalhd.c.

Referenced by mpeg12_class().

static OpaqueList* opaque_list_pop ( CHDContext priv,
uint64_t  fake_timestamp 
) [static]

Definition at line 262 of file crystalhd.c.

Referenced by copy_frame().

static uint64_t opaque_list_push ( CHDContext priv,
uint64_t  reordered_opaque,
uint8_t  pic_type 
) [static]

Definition at line 232 of file crystalhd.c.

Referenced by decode().

static void print_frame_info ( CHDContext priv,
BC_DTS_PROC_OUT *  output 
) [inline, static]

Definition at line 186 of file crystalhd.c.

Referenced by receive_frame().

static CopyRet receive_frame ( AVCodecContext avctx,
void *  data,
int *  data_size 
) [inline, static]

Definition at line 726 of file crystalhd.c.

Referenced by decode().

static av_cold int uninit ( AVCodecContext avctx  )  [static]

Definition at line 334 of file crystalhd.c.

Referenced by init().


Variable Documentation

Initial value:
 {
    .name           = "h264_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_H264,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &h264_class,
}

Definition at line 1033 of file crystalhd.c.

Initial value:
 {
    .name           = "mpeg2_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_MPEG2VIDEO,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-2 Video (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &mpeg2_class,
}

Definition at line 1057 of file crystalhd.c.

Initial value:
 {
    .name           = "mpeg4_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_MPEG4,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-4 Part 2 (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &mpeg4_class,
}

Definition at line 1081 of file crystalhd.c.

Initial value:
 {
    .name           = "msmpeg4_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_MSMPEG4V3,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-4 Part 2 Microsoft variant version 3 (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &msmpeg4_class,
}

Definition at line 1105 of file crystalhd.c.

Initial value:
 {
    .name           = "vc1_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_VC1,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("SMPTE VC-1 (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &vc1_class,
}

Definition at line 1129 of file crystalhd.c.

Initial value:
 {
    .name           = "wmv3_crystalhd",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_WMV3,
    .priv_data_size = sizeof(CHDContext),
    .init           = init,
    .close          = uninit,
    .decode         = decode,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
    .flush          = flush,
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Video 9 (CrystalHD acceleration)"),
    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_YUYV422, PIX_FMT_NONE},
    .priv_class     = &wmv3_class,
}

Definition at line 1153 of file crystalhd.c.

AVClass h264_class [static]
Initial value:

Definition at line 1026 of file crystalhd.c.

AVClass mpeg2_class [static]
Initial value:

Definition at line 1050 of file crystalhd.c.

AVClass mpeg4_class [static]
Initial value:

Definition at line 1074 of file crystalhd.c.

Initial value:
 {
    "msmpeg4_crystalhd",
    av_default_item_name,
    options,
    LIBAVUTIL_VERSION_INT,
}

Definition at line 1098 of file crystalhd.c.

const AVOption options[] [static]
Initial value:
 {
    { "crystalhd_downscale_width",
      "Turn on downscaling to the specified width",
      0x42,
      AV_OPT_TYPE_INT, 0, 0, UINT32_MAX,
      AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, },
    { NULL, },
}

Definition at line 152 of file crystalhd.c.

AVClass vc1_class [static]
Initial value:

Definition at line 1122 of file crystalhd.c.

AVClass wmv3_class [static]
Initial value:

Definition at line 1146 of file crystalhd.c.