[FFmpeg-devel] [PATCH]Add Dirac support to ffmpeg via libdirac_* and Schroedinger libraries]

Diego Biurrun diego
Fri Apr 18 01:12:20 CEST 2008


On Thu, Apr 17, 2008 at 09:17:06PM +1000, Anuradha Suraparaju wrote:
> 
> I've attached the Schroedinger path to this email. I created the patch
> using the latest svn revision 12879.

This is likely going to get merged quicker if you split decoder and
encoder.

> --- ffmpegsvn_trunk/configure	2008-04-17 11:14:38.000000000 +1000
> +++ ffmpegsvn_trunk_schro/configure	2008-04-17 20:47:08.000000000 +1000
> @@ -827,6 +829,8 @@
>  libgsm_ms_decoder_deps="libgsm"
>  libgsm_ms_encoder_deps="libgsm"
>  libmp3lame_encoder_deps="libmp3lame"
> +libschroedinger_encoder_deps="libschroedinger"
> +libschroedinger_decoder_deps="libschroedinger"

alphabetical order

> @@ -1614,20 +1618,21 @@
>  
>  # these are off by default, so fail if requested and not available
> -enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
> -enabled liba52     && require  liba52 a52dec/a52.h a52_init -la52
> -enabled libamr_nb  && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
> -enabled libamr_wb  && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
> -enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
> -enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
> -enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
> -enabled libmp3lame && require  LAME lame/lame.h lame_init -lmp3lame -lm
> -enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
> -enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
> -enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
> -enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
> -enabled libxvid    && require  Xvid xvid.h xvid_global -lxvidcore
> -enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
> +enabled avisynth        && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
> +enabled liba52          && require  liba52 a52dec/a52.h a52_init -la52
> +enabled libamr_nb       && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
> +enabled libamr_wb       && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
> +enabled libfaac         && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
> +enabled libfaad         && require2 libfaad faad.h faacDecOpen -lfaad
> +enabled libgsm          && require  libgsm gsm.h gsm_create -lgsm
> +enabled libmp3lame      && require  LAME lame/lame.h lame_init -lmp3lame -lm
> +enabled libnut          && require  libnut libnut.h nut_demuxer_init -lnut
> +enabled libschroedinger && add_extralibs `pkg-config --libs schroedinger-1.0` && extraincs="$extraincs `pkg-config --cflags schroedinger-1.0`" 
> +enabled libtheora       && require  libtheora theora/theora.h theora_info_init -ltheora -logg
> +enabled libvorbis       && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
> +enabled libx264         && require  x264 x264.h x264_encoder_open -lx264 -lm
> +enabled libxvid         && require  Xvid xvid.h xvid_global -lxvidcore
> +enabled mlib            && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib

cosmetics

> @@ -1837,9 +1842,10 @@
>  
> -enabled libdc1394 && append pkg_requires "libraw1394"
> -enabled libtheora && append pkg_requires "theora"
> -enabled libvorbis && append pkg_requires "vorbisenc"
> +enabled libdc1394       && append pkg_requires "libraw1394"
> +enabled libschroedinger && append pkg_requires "schroedinger-1.0"
> +enabled libtheora       && append pkg_requires "theora"
> +enabled libvorbis       && append pkg_requires "vorbisenc"

cosmetics

> --- ffmpegsvn_trunk/libavcodec/libschroedinger.c	1970-01-01 10:00:00.000000000 +1000
> +++ ffmpegsvn_trunk_schro/libavcodec/libschroedinger.c	2008-04-17 15:35:36.000000000 +1000
> @@ -0,0 +1,80 @@
> +/*
> + * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +/**
> +* @file libschroedinger.c
> +* function definitions common to libschroedingerdec.c and libschroedingerdec.c
> +*/
> +
> +#include "diracschro_common.h"
> +#include "libschroedinger.h"
> +
> +/**
> +* Schroedinger video preset table. Ensure that this tables matches up correctly
> +* with the ff_dirac_schro_video_format_info table in diracschro_common.c
> +*/
> +static const SchroVideoFormatEnum ff_schro_video_formats[]={
> +    SCHRO_VIDEO_FORMAT_CUSTOM     ,
> +    SCHRO_VIDEO_FORMAT_QSIF       ,
> +    SCHRO_VIDEO_FORMAT_QCIF       ,
> +    SCHRO_VIDEO_FORMAT_SIF        ,
> +    SCHRO_VIDEO_FORMAT_CIF        ,
> +    SCHRO_VIDEO_FORMAT_4SIF       ,
> +    SCHRO_VIDEO_FORMAT_4CIF       ,
> +    SCHRO_VIDEO_FORMAT_SD480I_60  ,
> +    SCHRO_VIDEO_FORMAT_SD576I_50  ,
> +    SCHRO_VIDEO_FORMAT_HD720P_60  ,
> +    SCHRO_VIDEO_FORMAT_HD720P_50  ,
> +    SCHRO_VIDEO_FORMAT_HD1080I_60 ,
> +    SCHRO_VIDEO_FORMAT_HD1080I_50 ,
> +    SCHRO_VIDEO_FORMAT_HD1080P_60 ,
> +    SCHRO_VIDEO_FORMAT_HD1080P_50 ,
> +    SCHRO_VIDEO_FORMAT_DC2K_24    ,
> +    SCHRO_VIDEO_FORMAT_DC4K_24    ,
> +};
> +
> +SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext)
> +{
> +    unsigned int num_formats = sizeof(ff_schro_video_formats) /
> +                               sizeof(ff_schro_video_formats[0]);
> +
> +    unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext);
> +
> +    return (idx < num_formats) ?
> +                 ff_schro_video_formats[idx] : SCHRO_VIDEO_FORMAT_CUSTOM;
> +}
> +
> +int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
> +                               SchroFrameFormat  *schro_frame_fmt)
> +{
> +    unsigned int num_formats = sizeof(ffmpeg_schro_pixel_format_map) /
> +                               sizeof(ffmpeg_schro_pixel_format_map[0]);
> +
> +    int idx;
> +
> +    for (idx = 0; idx < num_formats; ++idx) {
> +        if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {
> +            *schro_frame_fmt =
> +                         ffmpeg_schro_pixel_format_map[idx].schro_frame_fmt;
> +            return 0;
> +        }
> +    }
> +    return -1;
> +}
> diff --exclude=.svn -ruN ffmpegsvn_trunk/libavcodec/libschroedingerdec.c ffmpegsvn_trunk_schro/libavcodec/libschroedingerdec.c
> --- ffmpegsvn_trunk/libavcodec/libschroedingerdec.c	1970-01-01 10:00:00.000000000 +1000
> +++ ffmpegsvn_trunk_schro/libavcodec/libschroedingerdec.c	2008-04-17 16:24:58.000000000 +1000
> @@ -0,0 +1,312 @@
> +
> +/** libschroedinger Decoder private data */

nit: Here and in a lot of other places you capitalize words for
(seemingly) no good reason...

> +/**
> +* returns Ffmpeg chroma format

No, you cannot get away with misspelling FFmpeg ;-p

> --- ffmpegsvn_trunk/libavcodec/Makefile	2008-04-17 11:14:38.000000000 +1000
> +++ ffmpegsvn_trunk_schro/libavcodec/Makefile	2008-04-17 20:46:58.000000000 +1000
> @@ -321,6 +323,8 @@
>  OBJS-$(CONFIG_LIBMP3LAME)              += libmp3lame.o
> +OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o libschroedinger.o diracschro_common.o
> +OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o libschroedinger.o diracschro_common.o

alphabetical order

Diego




More information about the ffmpeg-devel mailing list