[FFmpeg-devel] [PATCH] CrystalHD decoder support v3

Diego Biurrun diego
Mon Jan 31 23:17:31 CET 2011


On Sun, Jan 30, 2011 at 06:53:08PM -0800, Philip Langdale wrote:
> 
> --- a/configure
> +++ b/configure
> @@ -1212,6 +1213,13 @@ binkaudio_dct_decoder_select="mdct rdft dct"
>  binkaudio_rdft_decoder_select="mdct rdft"
>  cavs_decoder_select="golomb"
>  cook_decoder_select="mdct"
> +h264_crystalhd_decoder_select="crystalhd"
> +mpeg1_crystalhd_decoder_select="crystalhd"
> +mpeg2_crystalhd_decoder_select="crystalhd"
> +mpeg4_crystalhd_decoder_select="crystalhd"
> +msmpeg4_crystalhd_decoder_select="crystalhd"
> +vc1_crystalhd_decoder_select="crystalhd"
> +wmv3_crystalhd_decoder_select="crystalhd"
>  cscd_decoder_suggest="zlib"
>  dca_decoder_select="mdct"
>  dnxhd_encoder_select="aandct"

alphabetical order

> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -86,6 +86,13 @@ void avcodec_register_all(void)
>      REGISTER_DECODER (CDGRAPHICS, cdgraphics);
>      REGISTER_DECODER (CINEPAK, cinepak);
>      REGISTER_DECODER (CLJR, cljr);
> +    REGISTER_DECODER (H264_CRYSTALHD, h264_crystalhd);
> +    REGISTER_DECODER (MPEG1_CRYSTALHD, mpeg1_crystalhd);
> +    REGISTER_DECODER (MPEG2_CRYSTALHD, mpeg2_crystalhd);
> +    REGISTER_DECODER (MPEG4_CRYSTALHD, mpeg4_crystalhd);
> +    REGISTER_DECODER (MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
> +    REGISTER_DECODER (VC1_CRYSTALHD, vc1_crystalhd);
> +    REGISTER_DECODER (WMV3_CRYSTALHD, wmv3_crystalhd);
>      REGISTER_DECODER (CSCD, cscd);
>      REGISTER_DECODER (CYUV, cyuv);

alphabetical order

> --- /dev/null
> +++ b/libavcodec/crystalhd.c
> @@ -0,0 +1,903 @@
> +
> +typedef enum CopyRet CopyRet;
> +
> +typedef struct OpaqueList OpaqueList;

I hate such typedefs - IMO just use the struct...

> +static inline int extract_sps_pps_from_avcc(CHDContext *priv,
> +                                            uint8_t *data,
> +                                            uint32_t data_size)
> +{
> +    int profile;
> +    unsigned int nal_size;
> +    unsigned int num_sps, num_pps;
> +
> +    if (*data == 1) {
> +        priv->is_nal = 1;
> +        priv->nal_length_size = (data[4] & 0x03) + 1;
> +    } else {
> +        priv->is_nal = 0;
> +        priv->nal_length_size = 4;
> +        return 0;

nit: align the =, same in other places

> +static inline void *memcpy_pic(void *dst, const void *src,
> +                               int bytesPerLine, int height,
> +                               int dstStride, int srcStride)
> +{
> +    int i;
> +    void *retval = dst;
> +
> +    for(i = 0; i < height; i++) {

for (

> +static av_cold int init(AVCodecContext *avctx)
> +{
> +    CHDContext* priv;
> +    BC_INPUT_FORMAT format;
> +    BC_STATUS ret;
> +
> +    memset(&format, 0, sizeof(BC_INPUT_FORMAT));
> +    format.FGTEnable = FALSE;
> +    format.Progressive = TRUE;
> +    format.OptFlags = 0x80000000 | vdecFrameRate59_94 | 0x40;
> +    format.width = avctx->width;
> +    format.height = avctx->height;

BC_INPUT_FORMAT format = { 0 };

instead of the memset seems nicer.

> +static inline CopyRet receive_frame(AVCodecContext *avctx,
> +                                    void *data, int *data_size,
> +                                    uint8_t second_field)
> +{
> +    BC_STATUS ret;
> +    BC_DTS_PROC_OUT output;
> +    CHDContext *priv = avctx->priv_data;
> +    HANDLE dev = priv->dev;
> +
> +    memset(&output, 0, sizeof(BC_DTS_PROC_OUT));
> +    output.PicInfo.width = avctx->width;
> +    output.PicInfo.height = avctx->height;

ditto

Diego



More information about the ffmpeg-devel mailing list