On Mon, 24 Sep 2012 19:05:38 +0200, Diego Biurrun <[email protected]> wrote:
> So I guess it's time to drop Snow.  Jordi is moving code around for Dirac
> that will end up getting deleted.  Let's not have him do that.  Attached
> is a patch that excises Snow; note the sexy diffstat.
> 
> I manually edited the patch to leave out the actual file deletions.
> Since I can push myself, they only make the patch large and unwieldy.
> 
> Diego
> From 16d34b997438ebee2314751c30ea40f32d9e81d1 Mon Sep 17 00:00:00 2001
> From: Diego Biurrun <[email protected]>
> Date: Mon, 24 Sep 2012 17:57:14 +0200
> Subject: [PATCH] Drop Snow codec
> 
> Snow is a toy codec with no real-world use and horrible code.
> ---
>  configure                        |    2 -
>  doc/general.texi                 |    2 -
>  doc/snow.txt                     |  630 -------------
>  libavcodec/Makefile              |    3 -
>  libavcodec/allcodecs.c           |    1 -
>  libavcodec/avcodec.h             |    6 +-
>  libavcodec/codec_desc.c          |    7 -
>  libavcodec/dwt.c                 |   59 +--
>  libavcodec/dwt.h                 |    9 -
>  libavcodec/motion_est.c          |   21 +-
>  libavcodec/old_codec_ids.h       |    2 +
>  libavcodec/options_table.h       |    8 +-
>  libavcodec/snow.c                |  676 -------------
>  libavcodec/snow.h                |  692 --------------
>  libavcodec/snowdata.h            |  132 ---
>  libavcodec/snowdec.c             |  573 -----------
>  libavcodec/snowenc.c             | 1938 
> --------------------------------------
>  libavcodec/x86/Makefile          |    1 -
>  libavcodec/x86/motion_est.c      |    2 +-
>  libavcodec/x86/snowdsp.c         |  902 ------------------
>  libavformat/matroska.c           |    1 -
>  libavformat/riff.c               |    1 -
>  tests/fate/vcodec.mak            |   14 -
>  tests/ref/fate/vsynth1-snow      |    4 -
>  tests/ref/fate/vsynth1-snow-hpel |    4 -
>  tests/ref/fate/vsynth1-snow-ll   |    4 -
>  tests/ref/fate/vsynth2-snow      |    4 -
>  tests/ref/fate/vsynth2-snow-hpel |    4 -
>  tests/ref/fate/vsynth2-snow-ll   |    4 -
>  tests/ref/seek/snow_avi          |   46 -
>  tests/ref/seek/snow_ll_avi       |   46 -
>  31 files changed, 24 insertions(+), 5774 deletions(-)
>  delete mode 100644 doc/snow.txt
>  delete mode 100644 libavcodec/snow.c
>  delete mode 100644 libavcodec/snow.h
>  delete mode 100644 libavcodec/snowdata.h
>  delete mode 100644 libavcodec/snowdec.c
>  delete mode 100644 libavcodec/snowenc.c
>  delete mode 100644 libavcodec/x86/snowdsp.c
>  delete mode 100644 tests/ref/fate/vsynth1-snow
>  delete mode 100644 tests/ref/fate/vsynth1-snow-hpel
>  delete mode 100644 tests/ref/fate/vsynth1-snow-ll
>  delete mode 100644 tests/ref/fate/vsynth2-snow
>  delete mode 100644 tests/ref/fate/vsynth2-snow-hpel
>  delete mode 100644 tests/ref/fate/vsynth2-snow-ll
>  delete mode 100644 tests/ref/seek/snow_avi
>  delete mode 100644 tests/ref/seek/snow_ll_avi
> 
> diff --git a/configure b/configure
> index 4461bde..88cb46d 100755
> --- a/configure
> +++ b/configure
> @@ -1507,8 +1507,6 @@ rv30_decoder_select="error_resilience golomb h264chroma 
> h264pred h264qpel mpegvi
>  rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel 
> mpegvideo"
>  shorten_decoder_select="golomb"
>  sipr_decoder_select="lsp"
> -snow_decoder_select="dwt rangecoder"
> -snow_encoder_select="aandcttables dwt error_resilience mpegvideoenc 
> rangecoder"
>  svq1_decoder_select="error_resilience mpegvideo"
>  svq1_encoder_select="aandcttables error_resilience mpegvideoenc"
>  svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred 
> h264qpel mpegvideo"
> diff --git a/doc/general.texi b/doc/general.texi
> index 8415ca3..1c3dfbc 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -605,8 +605,6 @@ following image formats are supported:
>  @item Smacker video          @tab     @tab  X
>      @tab Video encoding used in Smacker.
>  @item SMPTE VC-1             @tab     @tab  X
> -@item Snow                   @tab  X  @tab  X
> -    @tab experimental wavelet codec (fourcc: SNOW)
>  @item Sony PlayStation MDEC (Motion DECoder)  @tab     @tab  X
>  @item Sorenson Vector Quantizer 1  @tab  X  @tab  X
>      @tab fourcc: SVQ1
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 45c6d66..e0af322 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -339,9 +339,6 @@ OBJS-$(CONFIG_SIPR_DECODER)            += sipr.o 
> acelp_pitch_delay.o \
>  OBJS-$(CONFIG_SMACKAUD_DECODER)        += smacker.o
>  OBJS-$(CONFIG_SMACKER_DECODER)         += smacker.o
>  OBJS-$(CONFIG_SMC_DECODER)             += smc.o
> -OBJS-$(CONFIG_SNOW_DECODER)            += snowdec.o snow.o
> -OBJS-$(CONFIG_SNOW_ENCODER)            += snowenc.o snow.o              \
> -                                          h263.o ituh263enc.o
>  OBJS-$(CONFIG_SOL_DPCM_DECODER)        += dpcm.o
>  OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o mjpegdec.o mjpeg.o
>  OBJS-$(CONFIG_SRT_DECODER)             += srtdec.o ass.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index c6df818..6a4f8ca 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -193,7 +193,6 @@ void avcodec_register_all(void)
>      REGISTER_ENCDEC  (SGI, sgi);
>      REGISTER_DECODER (SMACKER, smacker);
>      REGISTER_DECODER (SMC, smc);
> -    REGISTER_ENCDEC  (SNOW, snow);
>      REGISTER_DECODER (SP5X, sp5x);
>      REGISTER_ENCDEC  (SUNRAST, sunrast);
>      REGISTER_ENCDEC  (SVQ1, svq1);
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index c5cdf41..86016db 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -152,7 +152,9 @@ enum AVCodecID {
>      AV_CODEC_ID_MSZH,
>      AV_CODEC_ID_ZLIB,
>      AV_CODEC_ID_QTRLE,
> +#if LIBAVCODEC_VERSION_MAJOR < 55

FF_API_SNOW? Same below.

>      AV_CODEC_ID_SNOW,
> +#endif
>      AV_CODEC_ID_TSCC,
>      AV_CODEC_ID_ULTI,
>      AV_CODEC_ID_QDRAW,
> @@ -515,7 +517,9 @@ enum Motion_Est_ID {
>      ME_X1,          ///< reserved for experiments
>      ME_HEX,         ///< hexagon based search
>      ME_UMH,         ///< uneven multi-hexagon search
> +#if LIBAVCODEC_VERSION_MAJOR < 55
>      ME_ITER,        ///< iterative search
> +#endif
>      ME_TESA,        ///< transformed exhaustive search algorithm
>  };
>  
> @@ -1499,7 +1503,7 @@ typedef struct AVCodecContext {
>      /**
>       * Motion estimation algorithm used for video coding.
>       * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
> -     * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow 
> specific]
> +     * 8 (umh), 10 (tesa) [7, 8, 10 are x264 specific]
>       * - encoding: MUST be set by user.
>       * - decoding: unused
>       */
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 51fc171..19b1c72 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -419,13 +419,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
>          .props     = AV_CODEC_PROP_LOSSLESS,
>      },
>      {
> -        .id        = AV_CODEC_ID_SNOW,
> -        .type      = AVMEDIA_TYPE_VIDEO,
> -        .name      = "snow",
> -        .long_name = NULL_IF_CONFIG_SMALL("Snow"),
> -        .props     = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
> -    },
> -    {
>          .id        = AV_CODEC_ID_TSCC,
>          .type      = AVMEDIA_TYPE_VIDEO,
>          .name      = "tscc",
> diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
> index 93cf2c6..2ad0dc3 100644
> --- a/libavcodec/dwt.c
> +++ b/libavcodec/dwt.c
> @@ -17,7 +17,9 @@
>   * License along with Libav; if not, write to the Free Software
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
> +#include <assert.h>
>  
> +#include "config.h"
>  #include "libavutil/attributes.h"
>  #include "libavutil/common.h"
>  #include "dsputil.h"
> @@ -465,34 +467,6 @@ static void spatial_compose53i_dy(DWTCompose *cs, 
> IDWTELEM *buffer,
>      cs->y  += 2;
>  }
>  
> -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
> -{
> -    const int w2 = (width + 1) >> 1;
> -    int x;
> -
> -    temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
> -    for (x = 1; x < (width >> 1); x++) {
> -        temp[2 * x]     = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 
> 3);
> -        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
> -    }
> -    if (width & 1) {
> -        temp[2 * x]     = b[x] - ((3 * b[x + w2 - 1] + 2) >> 2);
> -        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
> -    } else
> -        temp[2 * x - 1] = b[x + w2 - 1] - 2 * temp[2 * x - 2];
> -
> -    b[0] = temp[0] + ((2 * temp[0] + temp[1] + 4) >> 3);
> -    for (x = 2; x < width - 1; x += 2) {
> -        b[x]     = temp[x] + ((4 * temp[x] + temp[x - 1] + temp[x + 1] + 8) 
> >> 4);
> -        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
> -    }
> -    if (width & 1) {
> -        b[x]     = temp[x] + ((2 * temp[x] + temp[x - 1] + 4) >> 3);
> -        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
> -    } else
> -        b[x - 1] = temp[x - 1] + 3 * b[x - 2];
> -}
> -
>  static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
>                                    int width)
>  {
> @@ -529,20 +503,6 @@ static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM 
> *b1, IDWTELEM *b2,
>          b1[i] -= (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
>  }
>  
> -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
> -                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
> -                                 int width)
> -{
> -    int i;
> -
> -    for (i = 0; i < width; i++) {
> -        b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
> -        b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;
> -        b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
> -        b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
> -    }
> -}
> -
>  static void spatial_compose97i_buffered_init(DWTCompose *cs, slice_buffer 
> *sb,
>                                               int height, int stride_line)
>  {
> @@ -627,11 +587,6 @@ static void spatial_compose97i_dy(DWTCompose *cs, 
> IDWTELEM *buffer,
>      if (y + 0 < (unsigned)height)
>          vertical_compose97iH0(b0, b1, b2, width);
>  
> -    if (y - 1 < (unsigned)height)
> -        ff_snow_horizontal_compose97i(b0, temp, width);
> -    if (y + 0 < (unsigned)height)
> -        ff_snow_horizontal_compose97i(b1, temp, width);
> -
>      cs->b0  = b2;
>      cs->b1  = b3;
>      cs->b2  = b4;
> @@ -849,13 +804,3 @@ void ff_dsputil_init_dwt(DSPContext *c)
>      c->w97[0] = w97_16_c;
>      c->w97[1] = w97_8_c;
>  }
> -
> -void ff_dwt_init(DWTContext *c)
> -{
> -    c->vertical_compose97i   = ff_snow_vertical_compose97i;
> -    c->horizontal_compose97i = ff_snow_horizontal_compose97i;
> -    c->inner_add_yblock      = ff_snow_inner_add_yblock;
> -
> -    if (HAVE_MMX)
> -        ff_dwt_init_x86(c);
> -}
> diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h
> index f2d7864..1d01d59 100644
> --- a/libavcodec/dwt.h
> +++ b/libavcodec/dwt.h
> @@ -93,15 +93,6 @@ void ff_slice_buffer_flush(slice_buffer *buf);
>  void ff_slice_buffer_destroy(slice_buffer *buf);
>  IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
>  
> -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
> -                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
> -                                 int width);
> -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
> -void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
> -                              uint8_t **block, int b_w, int b_h, int src_x,
> -                              int src_y, int src_stride, slice_buffer *sb,
> -                              int add, uint8_t *dst8);
> -
>  int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
>  int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
>  
> diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
> index 12e1257..c77d8c8 100644
> --- a/libavcodec/motion_est.c
> +++ b/libavcodec/motion_est.c
> @@ -302,8 +302,9 @@ int ff_init_me(MpegEncContext *s){
>          av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB 
> diamond\n");
>          return -1;
>      }
> -    //special case of snow is needed because snow uses its own iterative ME 
> code
> -    if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 
> && s->avctx->codec_id != AV_CODEC_ID_SNOW){
> +    if (s->me_method != ME_ZERO &&
> +        s->me_method != ME_EPZS &&
> +        s->me_method != ME_X1) {
>          av_log(s->avctx, AV_LOG_ERROR, "me_method is only allowed to be set 
> to zero and epzs; for hex,umh,full and others see dia_size\n");
>          return -1;
>      }
> @@ -354,16 +355,14 @@ int ff_init_me(MpegEncContext *s){
>      /* 8x8 fullpel search would need a 4x4 chroma compare, which we do
>       * not have yet, and even if we had, the motion estimation code
>       * does not expect it. */
> -    if(s->codec_id != AV_CODEC_ID_SNOW){
> -        if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){
> -            s->dsp.me_cmp[2]= zero_cmp;
> -        }
> -        if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){
> -            s->dsp.me_sub_cmp[2]= zero_cmp;
> -        }
> -        c->hpel_put[2][0]= c->hpel_put[2][1]=
> -        c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
> +    if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){
> +        s->dsp.me_cmp[2]= zero_cmp;
> +    }
> +    if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){
> +        s->dsp.me_sub_cmp[2]= zero_cmp;
>      }
> +    c->hpel_put[2][0]= c->hpel_put[2][1]=
> +    c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
>  
>      if(s->codec_id == AV_CODEC_ID_H261){
>          c->sub_motion_search= no_sub_motion_search;
> diff --git a/libavcodec/old_codec_ids.h b/libavcodec/old_codec_ids.h
> index 2b72e38..4e84332 100644
> --- a/libavcodec/old_codec_ids.h
> +++ b/libavcodec/old_codec_ids.h
> @@ -86,7 +86,9 @@
>      CODEC_ID_MSZH,
>      CODEC_ID_ZLIB,
>      CODEC_ID_QTRLE,
> +#if LIBAVCODEC_VERSION_MAJOR < 55
>      CODEC_ID_SNOW,
> +#endif
>      CODEC_ID_TSCC,
>      CODEC_ID_ULTI,
>      CODEC_ID_QDRAW,
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 4b6d417..3773441 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -91,7 +91,9 @@ static const AVOption options[]={
>  {"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_X1 }, 
> INT_MIN, INT_MAX, V|E, "me_method" },
>  {"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, 
> INT_MIN, INT_MAX, V|E, "me_method" },
>  {"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, 
> INT_MIN, INT_MAX, V|E, "me_method" },
> +#if LIBAVCODEC_VERSION_MAJOR < 55
>  {"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, 
> INT_MIN, INT_MAX, V|E, "me_method" },
> +#endif
>  {"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = 
> DEFAULT }, INT_MIN, INT_MAX},
>  {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 
> INT_MIN, INT_MAX},
>  {"g", "set the group of picture size", OFFSET(gop_size), AV_OPT_TYPE_INT, 
> {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
> @@ -259,10 +261,6 @@ static const AVOption options[]={
>  {"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 
> = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
>  {"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 
> = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
>  {"nsse", "noise preserving sum of squared differences", 0, 
> AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
> -#if CONFIG_SNOW_ENCODER
> -{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = 
> FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
> -{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = 
> FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
> -#endif
>  {"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, 
> INT_MAX, V|E, "cmp_func"},
>  {"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, 
> INT_MAX, V|E, "cmp_func"},
>  {"pre_dia_size", "diamond type & size for motion estimation pre-pass", 
> OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, 
> V|E},
> @@ -347,7 +345,9 @@ static const AVOption options[]={
>  {"bidir_refine", "refine the two motion vectors used in bidirectional 
> macroblocks", OFFSET(bidir_refine), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 4, V|E},
>  {"brd_scale", "downscales frames for dynamic B-frame decision", 
> OFFSET(brd_scale), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 10, V|E},
>  {"keyint_min", "minimum interval between IDR-frames (x264)", 
> OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E},
> +#if LIBAVCODEC_VERSION_MAJOR < 55
>  {"refs", "reference frames to consider for motion compensation (Snow)", 
> OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E},

The comment lies, at least x264 also uses this option. Please check this
also for other options.

If x264 is the only user (i'm not completely sure), we should probably
make this a private option.


-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to