[Ffmpeg-devel] MPEG-2 Acceleration Under Mac OS X - Can We Move This Forward?

Nigel Pearson nigel
Wed Aug 30 01:01:18 CEST 2006


> I didn't come up with a solution that doesn't either:
> 1. Add lots of #ifdefs uglifying the code (and preventing runtime 
> selection), or
> 2. Add lots of ifs slowing down the code, or
> 3. Duplicate significant portions of the code.

	Here are my slight changes to your mpeg12.c patches.
My understanding of that file, (or how Michael N. would
like to factor out the hardware accel. stuff) isn't great,
but I hope this can be a start for discussion/review.

	In terms of the concerns above:
1) There are lots of #ifdefs, but not many
more than the existing HAVE_XVMC blocks?
2) Similarly with the ifs for runtime selection.
3) I tried to move the large blocks into a separate file,
but there are still lots of sections that are in similar
locations to the XVMC code.

	I think we also need to settle on one namespace.
Either DVDV or Accellent (at the moment there are both).



(Note that this also includes some other MythTV additions-
  VIA XVMC hardware accel, and a closed captioning decoder)

Index: libavcodec/mpeg12.c
===================================================================
--- libavcodec/mpeg12.c	(revision 6123)
+++ libavcodec/mpeg12.c	(working copy)
@@ -33,6 +33,9 @@
  //#undef NDEBUG
  //#include <assert.h>

+#ifdef HAVE_DVDV
+#include "dvdv.h"
+#endif

  /* Start codes. */
  #define SEQ_END_CODE            0x000001b7
@@ -83,6 +86,18 @@
  extern void XVMC_init_block(MpegEncContext *s);//set s->block
  #endif

+#ifdef HAVE_XVMC_VLD
+extern int XVMC_VLD_field_start(MpegEncContext *s, AVCodecContext 
*avctx);
+extern int XVMC_VLD_field_end(MpegEncContext *s);
+extern int XVMC_VLD_decode_slice(MpegEncContext *s, int start_code,
+                                 uint8_t *buffer, int buf_size);
+#endif
+
+#ifdef HAVE_DVDV
+extern void DVDV_init_block(MpegEncContext *s);
+extern void DVDV_decode_mb(MpegEncContext *s);
+#endif
+
  const enum PixelFormat pixfmt_yuv_420[]= {PIX_FMT_YUV420P,-1};
  const enum PixelFormat pixfmt_yuv_422[]= {PIX_FMT_YUV422P,-1};
  const enum PixelFormat pixfmt_yuv_444[]= {PIX_FMT_YUV444P,-1};
@@ -1124,6 +1139,11 @@
                  s->mb_skipped = 1;
          }

+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+            *DVDV_CBP(s)++ = 0;
+#endif
+
          return 0;
      }

@@ -1198,6 +1218,10 @@
              }
          }
  #endif
+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+            *DVDV_CBP(s)++ = 0x3F;
+#endif

          if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
              if(s->flags2 & CODEC_FLAG2_FAST){
@@ -1409,6 +1433,10 @@
                  }
              }
  #endif
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+                *DVDV_CBP(s)++ = cbp;
+#endif

              if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
                  if(s->flags2 & CODEC_FLAG2_FAST){
@@ -1456,6 +1484,10 @@
                  }
              }
          }else{
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+                *DVDV_CBP(s)++ = 0;
+#endif
              for(i=0;i<12;i++)
                  s->block_last_index[i] = -1;
          }
@@ -1751,6 +1783,9 @@
      const uint16_t *quant_matrix;
      const int qscale= s->qscale;
      int mismatch;
+#ifdef HAVE_DVDV
+    int dct_count = 0;
+#endif

      mismatch = 1;

@@ -1770,6 +1805,15 @@
                  level= -level;
              block[0] = level;
              mismatch ^= level;
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+            {
+                DVDV_DCT(s)->run_sub_one = 0;
+                DVDV_DCT(s)->elt = level;
+                DVDV_DCT(s)++;
+                dct_count++;
+            }
+#endif
              i++;
              SKIP_BITS(re, &s->gb, 2);
              if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
@@ -1808,6 +1852,16 @@

              mismatch ^= level;
              block[j] = level;
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+            {
+                //needn't write block at all but keep it for sanity
+                DVDV_DCT(s)->run_sub_one = run-1;
+                DVDV_DCT(s)->elt = level;
+                DVDV_DCT(s)++;
+                dct_count++;
+            }
+#endif
              if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                  break;
              UPDATE_CACHE(re, &s->gb);
@@ -1819,6 +1873,10 @@
      block[63] ^= (mismatch & 1);

      s->block_last_index[n] = i;
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+        DVDV_MB(s)->num_coded_elts[n] = dct_count;
+#endif
      return 0;
  }

@@ -1830,6 +1888,9 @@
      RLTable *rl = &rl_mpeg1;
      uint8_t * const scantable= s->intra_scantable.permutated;
      const int qscale= s->qscale;
+#ifdef HAVE_DVDV
+    int dct_count = 0;
+#endif
      OPEN_READER(re, &s->gb);
      i = -1;

@@ -1840,6 +1901,15 @@
          if(GET_CACHE(re, &s->gb)&0x40000000)
              level= -level;
          block[0] = level;
+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+        {
+            DVDV_DCT(s)->run_sub_one = 0;
+            DVDV_DCT(s)->elt = level;
+            DVDV_DCT(s)++;
+            dct_count++;
+        }
+#endif
          i++;
          SKIP_BITS(re, &s->gb, 2);
          if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
@@ -1873,6 +1943,16 @@
          }

          block[j] = level;
+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+        {
+            //needn't write block at all but keep it for sanity
+            DVDV_DCT(s)->run_sub_one = run-1;
+            DVDV_DCT(s)->elt = level;
+            DVDV_DCT(s)++;
+            dct_count++;
+        }
+#endif
          if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
              break;
          UPDATE_CACHE(re, &s->gb);
@@ -1881,6 +1961,10 @@
      LAST_SKIP_BITS(re, &s->gb, 2);
      CLOSE_READER(re, &s->gb);
      s->block_last_index[n] = i;
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+        DVDV_MB(s)->num_coded_elts[n] = dct_count;
+#endif
      return 0;
  }

@@ -1896,6 +1980,9 @@
      const uint16_t *quant_matrix;
      const int qscale= s->qscale;
      int mismatch;
+#ifdef HAVE_DVDV
+    int dct_count = 0;
+#endif

      /* DC coef */
      if (n < 4){
@@ -1914,6 +2001,15 @@
      block[0] = dc << (3 - s->intra_dc_precision);
      dprintf("dc=%d\n", block[0]);
      mismatch = block[0] ^ 1;
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+    {
+        DVDV_DCT(s)->run_sub_one = 0;
+        DVDV_DCT(s)->elt = block[0] - 0x0400;
+        DVDV_DCT(s)++;
+        dct_count++;
+    }
+#endif
      i = 0;
      if (s->intra_vlc_format)
          rl = &rl_mpeg2;
@@ -1951,17 +2047,35 @@
              }
              if (i > 63){
                  av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d 
%d\n", s->mb_x, s->mb_y);
+#ifdef HAVE_DVDV
+                if (s->avctx->accellent_enabled)
+                    DVDV_MB(s)->num_coded_elts[n] = dct_count;
+#endif
                  return -1;
              }

              mismatch^= level;
              block[j] = level;
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+            {
+                //needn't write block at all but keep it for sanity
+                DVDV_DCT(s)->run_sub_one = run-1;
+                DVDV_DCT(s)->elt = level;
+                DVDV_DCT(s)++;
+                dct_count++;
+            }
+#endif
          }
          CLOSE_READER(re, &s->gb);
      }
      block[63]^= mismatch&1;

      s->block_last_index[n] = i;
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+        DVDV_MB(s)->num_coded_elts[n] = dct_count;
+#endif
      return 0;
  }

@@ -1975,6 +2089,9 @@
      uint8_t * scantable= s->intra_scantable.permutated;
      const uint16_t *quant_matrix;
      const int qscale= s->qscale;
+#ifdef HAVE_DVDV
+    int dct_count = 0;
+#endif

      /* DC coef */
      if (n < 4){
@@ -1991,6 +2108,15 @@
      dc += diff;
      s->last_dc[component] = dc;
      block[0] = dc << (3 - s->intra_dc_precision);
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+    {
+        DVDV_DCT(s)->run_sub_one = 0;
+        DVDV_DCT(s)->elt = block[0] - 0x0400;
+        DVDV_DCT(s)++;
+        dct_count++;
+    }
+#endif
      if (s->intra_vlc_format)
          rl = &rl_mpeg2;
      else
@@ -2027,11 +2153,25 @@
              }

              block[j] = level;
+#ifdef HAVE_DVDV
+            if (s->avctx->accellent_enabled)
+            {
+                //needn't write block at all but keep it for sanity
+                DVDV_DCT(s)->run_sub_one = run-1;
+                DVDV_DCT(s)->elt = level;
+                DVDV_DCT(s)++;
+                dct_count++;
+            }
+#endif
          }
          CLOSE_READER(re, &s->gb);
      }

      s->block_last_index[n] = scantable - s->intra_scantable.permutated;
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+        DVDV_MB(s)->num_coded_elts[n] = dct_count;
+#endif
      return 0;
  }

@@ -2174,6 +2314,9 @@
              if( avctx->idct_algo == FF_IDCT_AUTO )
                  avctx->idct_algo = FF_IDCT_SIMPLE;

+        if( avctx->xvmc_vld_hwslice == 1)
+            avctx->idct_algo = FF_IDCT_LIBMPEG2MMX;
+
          //quantization matrixes may need reordering
          //if dct permutation is changed
          
memcpy(old_permutation,s->dsp.idct_permutation,64*sizeof(uint8_t));
@@ -2413,6 +2556,13 @@
      dprintf("alternate_scan=%d\n", s->alternate_scan);
      dprintf("frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
      dprintf("progressive_frame=%d\n", s->progressive_frame);
+#ifdef HAVE_DVDV
+    if (s->avctx->accellent_enabled)
+    {
+        DVDV_FRAME(s)->intra_vlc_format = s->intra_vlc_format;
+        DVDV_FRAME(s)->alternate_scan   = s->alternate_scan;
+    }
+#endif
  }

  static void mpeg_decode_extension(AVCodecContext *avctx,
@@ -2496,6 +2646,10 @@
      if(s->avctx->xvmc_acceleration)
           XVMC_field_start(s,avctx);
  #endif
+#ifdef HAVE_XVMC_VLD
+    if(s->avctx->xvmc_vld_hwslice)
+         XVMC_VLD_field_start(s, avctx);
+#endif

      return 0;
  }
@@ -2525,6 +2679,16 @@
          return -1;
      }

+#ifdef HAVE_XVMC_VLD
+    if (s->avctx->xvmc_vld_hwslice){
+        int used = XVMC_VLD_decode_slice(s, mb_y, *buf, buf_size);
+        if (used < 0)
+            return DECODE_SLICE_ERROR;
+        *buf += used - 1;
+        return DECODE_SLICE_OK;
+    }
+#endif
+
      init_get_bits(&s->gb, *buf, buf_size*8);

      ff_mpeg1_clean_buffers(s);
@@ -2583,6 +2747,10 @@
          if(s->avctx->xvmc_acceleration > 1)
              XVMC_init_block(s);//set s->block
  #endif
+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+            DVDV_init_block(s);
+#endif

          ret = mpeg_decode_mb(s, s->block);
          s->chroma_qscale= s->qscale;
@@ -2626,7 +2794,14 @@
          s->dest[1] += 16 >> (s->chroma_x_shift + lowres);
          s->dest[2] += 16 >> (s->chroma_x_shift + lowres);

+#ifdef HAVE_DVDV
+        if (s->avctx->accellent_enabled)
+            DVDV_decode_mb(s);
+        else
+            MPV_decode_mb(s, s->block);
+#else
          MPV_decode_mb(s, s->block);
+#endif

          if (++s->mb_x >= s->mb_width) {
              const int mb_size= 16>>s->avctx->lowres;
@@ -2737,6 +2912,11 @@
      if(s->avctx->xvmc_acceleration)
          XVMC_field_end(s);
  #endif
+#ifdef HAVE_XVMC_VLD
+    if(s->avctx->xvmc_vld_hwslice)
+        XVMC_VLD_field_end(s);
+#endif
+
      /* end of slice reached */
      if (/*s->mb_y<<field_pic == s->mb_height &&*/ !s->first_field) {
          /* end of image */
@@ -2898,6 +3078,9 @@
          if( avctx->idct_algo == FF_IDCT_AUTO )
              avctx->idct_algo = FF_IDCT_SIMPLE;

+    if( avctx->xvmc_vld_hwslice == 1)
+        avctx->idct_algo = FF_IDCT_LIBMPEG2MMX;
+
      if (MPV_common_init(s) < 0)
          return -1;
      exchange_uv(s);//common init reset pblocks, so we swap them here
@@ -3306,6 +3489,85 @@

  #endif

+#ifdef HAVE_XVMC_VLD
+static int mpeg_xvmc_vld_decode_init(AVCodecContext *avctx){
+    Mpeg1Context *s;
+
+    if( avctx->thread_count > 1)
+        return -1;
+    if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
+        return -1;
+    if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) )
+        dprintf("mpeg12.c: XVMC_VLD decoder will work better if 
SLICE_FLAG_ALLOW_FIELD is set\n");
+
+    mpeg_decode_init(avctx);
+    s = avctx->priv_data;
+
+    avctx->xvmc_vld_hwslice = 1;
+
+    return 0;
+}
+
+AVCodec mpeg_xvmc_vld_decoder = {
+    "mpegvideo_xvmc_vld",
+    CODEC_TYPE_VIDEO,
+    CODEC_ID_MPEG2VIDEO_XVMC_VLD,
+    sizeof(Mpeg1Context),
+    mpeg_xvmc_vld_decode_init,
+    NULL,
+    mpeg_decode_end,
+    mpeg_decode_frame,
+    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED| 
CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
+    .flush= ff_mpeg_flush,
+};
+
+#endif
+
+#ifdef HAVE_DVDV
+static int mpeg_accellent_decode_init(AVCodecContext *avctx){
+    Mpeg1Context *s;
+    // We only try to decode one stream at once:
+    if( avctx->thread_count > 1)
+        return -1;
+
+    // We cannot handle non-ordered slices?
+    //if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
+        //return -1;
+
+    //if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) )
+        //dprintf("mpeg12.c: Accellent decoder will work better if 
SLICE_FLAG_ALLOW_FIELD is set\n");
+
+    mpeg_decode_init(avctx);
+    s = avctx->priv_data;
+
+    avctx->accellent = av_malloc(sizeof(DVDV_CurPtrs));
+    if (!avctx->accellent)
+        return -1;
+
+    // Indicate to callers that we are initialised?
+    avctx->accellent_enabled = 1;
+
+    // For now, don't actually do anything?
+    //avctx->parse_only = 1;
+
+    return 0;
+}
+
+AVCodec mpeg_accellent_decoder = {
+    "mpegvideo_accellent",
+    CODEC_TYPE_VIDEO,
+    CODEC_ID_MPEG2VIDEO, // Do we need a custom codec type?
+    sizeof(Mpeg1Context),
+    mpeg_accellent_decode_init,
+    NULL,
+    mpeg_decode_end,
+    mpeg_decode_frame,
+    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED| 
CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
+    .flush= ff_mpeg_flush,
+};
+
+#endif
+
  /* this is ugly i know, but the alternative is too make
     hundreds of vars global and prefix them with ff_mpeg1_
     which is far uglier. */
Index: libavcodec/dvdv.c
===================================================================
--- libavcodec/dvdv.c	(revision 0)
+++ libavcodec/dvdv.c	(revision 0)
@@ -0,0 +1,66 @@
+/*
+ * dvdv.c - Mac Hardware MPEG2 decoding.
+ *
+ * Based on modifications to ffmpeg's libavcodec/mpeg12.c by John 
Dagliesh.
+ * See http://www.defyne.org/dvb/accellent.html
+ *
+ * TO be added to the MythTV project's copy of libavcodec?
+ */
+
+#include "avcodec.h"
+#include "mpegvideo.h"
+#include "dvdv.h"
+
+void DVDV_init_block(MpegEncContext *s)
+{
+    DVDV_MBInfo * mb = DVDV_MB(s);
+    int           ret;
+
+    for (ret=0; ret<6; ret++)
+        mb->num_coded_elts[ret] = 0;
+}
+
+void DVDV_decode_mb(MpegEncContext *s)
+{
+    DVDV_MBInfo * mb = DVDV_MB(s);
+
+    mb->mb_type = 0;
+    if (!s->mb_intra)
+    {
+        if (s->mv_dir & MV_DIR_FORWARD)
+        {
+            mb->mb_type |= 1;
+            mb->frwd_mv[0] = s->mv[0][0][0];
+            mb->frwd_mv[1] = s->mv[0][0][1];
+            mb->frwd_mv_field[0] = s->mv[0][1][0];
+            mb->frwd_mv_field[1] = s->mv[0][1][1];
+        }
+        if (s->mv_dir & MV_DIR_BACKWARD)
+        {
+            mb->mb_type |= 2;
+            mb->back_mv[0] = s->mv[1][0][0];
+            mb->back_mv[1] = s->mv[1][0][1];
+            mb->back_mv_field[0] = s->mv[1][1][0];
+            mb->back_mv_field[1] = s->mv[1][1][1];
+        }
+        if (s->mv_type != MV_TYPE_16X16)
+        {
+            mb->mb_type |= 4;
+            mb->field_select[0] = s->field_select[0][0];
+            mb->field_select[1] = s->field_select[1][0];
+            mb->field_select[2] = s->field_select[0][1];
+            mb->field_select[3] = s->field_select[1][1];
+        }
+    }
+    mb->ildct = s->interlaced_dct;
+    DVDV_MB(s)++;
+
+    // side effects of MPV_decode_mb:
+    if (!s->mb_intra)
+    {
+        s->last_dc[0] =
+        s->last_dc[1] =
+        s->last_dc[2] =  128 << s->intra_dc_precision;
+    }
+    s->mb_skipped = 0;
+}

Property changes on: libavcodec/dvdv.c
___________________________________________________________________
Name: svn:keywords
    + Date Revision Author
Name: svn:eol-style
    + native

Index: libavcodec/dvdv.h
===================================================================
--- libavcodec/dvdv.h	(revision 0)
+++ libavcodec/dvdv.h	(revision 0)
@@ -0,0 +1,64 @@
+/*
+ * This header is adapted from Accellent by John Dagliesh:
+ *   http://www.defyne.org/dvb/accellent.html
+ */
+
+#ifndef __FF_DVDV__
+#define __FF_DVDV__
+
+/*
+Header file containing structures for writing data to Apple's
+private hardware MPEG2 decoding API, that I'm calling DVDVideo
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct DVDV_MBInfo
+{
+    int16_t  frwd_mv[2];
+    int16_t  back_mv[2];
+    int16_t  frwd_mv_field[2];
+    int16_t  back_mv_field[2];
+
+    uint8_t  field_select[4];    // 0/1 in order of mvs above
+
+    uint8_t  mb_type;            // |1 = frwd, |2 = back, |4 = use 
fields
+    uint8_t  ildct;              // 0/1
+
+    uint8_t  num_coded_elts[6];  // for each block incl. dc
+} DVDV_MBInfo;
+
+typedef struct DVDV_DCTElt
+{
+    uint8_t   run_sub_one;
+    uint8_t   unused;
+    uint16_t  elt;          // adjusted for first coded elt in block:
+} DVDV_DCTElt;              // intra sub 0x0400, else add 0x0400
+
+typedef struct DVDV_Frame
+{
+    int  intra_vlc_format;
+    int  alternate_scan;
+} DVDV_Frame;
+
+typedef struct DVDV_CurPtrs
+{
+    DVDV_MBInfo  * mb;
+    DVDV_DCTElt  * dct;
+    uint8_t      * cbp;
+    DVDV_Frame   * frame;
+} DVDV_CurPtrs;
+
+// Convenience macro to get the above from an MpegEncContext
+#define DVDV_MB(x)     (((DVDV_CurPtrs *)(x->avctx->accellent))->mb)
+#define DVDV_DCT(x)    (((DVDV_CurPtrs *)(x->avctx->accellent))->dct)
+#define DVDV_CBP(x)    (((DVDV_CurPtrs *)(x->avctx->accellent))->cbp)
+#define DVDV_FRAME(x)  (((DVDV_CurPtrs *)(x->avctx->accellent))->frame)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __FF_DVDV__

Property changes on: libavcodec/dvdv.h
___________________________________________________________________
Name: svn:keywords
    + Date Revision Author
Name: svn:eol-style
    + native

Index: libavcodec/Makefile
===================================================================
--- libavcodec/Makefile	(revision 6123)
+++ libavcodec/Makefile	(working copy)
@@ -281,6 +281,8 @@

  OBJS-$(HAVE_XVMC_ACCEL)                += xvmcvideo.o

+OBJS-$(HAVE_MAC_ACCELLENT)             += dvdv.o
+
  ifneq ($(CONFIG_SWSCALER),yes)
  OBJS += imgresample.o
  endif
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h	(revision 6123)
+++ libavcodec/avcodec.h	(working copy)
@@ -32,6 +32,7 @@
      CODEC_ID_MPEG1VIDEO,
      CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding 
*/
      CODEC_ID_MPEG2VIDEO_XVMC,
+    CODEC_ID_MPEG2VIDEO_XVMC_VLD,
      CODEC_ID_H261,
      CODEC_ID_H263,
      CODEC_ID_RV10,
@@ -627,7 +628,15 @@
       * - encoding: set by user\
       * - decoding: set by lavc\
       */\
-    int8_t *ref_index[2];
+    int8_t *ref_index[2];\
+\
+    /** ATSC CC data\
+     * - encoding: unused\
+     * - decoding: set by lavc\
+     */\
+    uint8_t atsc_cc_buf[1024];\
+    int atsc_cc_len;\
+\

  #define FF_QSCALE_TYPE_MPEG1 0
  #define FF_QSCALE_TYPE_MPEG2 1
@@ -2024,6 +2033,29 @@
       * - decoding: unused.
       */
      int max_partition_order;
+
+    /**
+     * XVMC_VLD (VIA CLE266) Hardware MPEG decoding
+     * - encoding: forbidden
+     * - decoding: set by decoder
+     */
+    int xvmc_vld_hwslice;
+
+    /**
+     * Closed Caption decoder
+     * - encoding: forbidden
+     * - decoding: set by decoder
+     */
+    void (*decode_cc_dvd)(struct AVCodecContext *c, const uint8_t 
*buf, int buf_size);
+    /**
+     * Mac OS X Hardware MPEG decoding - Accellent by John Dagliesh:
+     * http://www.defyne.org/dvb/accellent.html
+     * - encoding: forbidden
+     * - decoding: set by decoder
+     */
+    int   accellent_enabled;
+    void *accellent;         // This is actually a pointer to a 
DVDV_CurPtrs
+
  } AVCodecContext;

  /**
@@ -2158,6 +2190,8 @@
  extern AVCodec mpeg2video_decoder;
  extern AVCodec mpegvideo_decoder;
  extern AVCodec mpeg_xvmc_decoder;
+extern AVCodec mpeg_xvmc_vld_decoder;
+extern AVCodec mpeg_accellent_decoder;
  extern AVCodec h263i_decoder;
  extern AVCodec flv_decoder;
  extern AVCodec rv10_decoder;
@@ -2631,6 +2665,11 @@

  extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);

+void avcodec_default_decode_cc_dvd(AVCodecContext *c, const uint8_t 
*buf, int buf_size);
+void avcodec_default_decode_cc_atsc(AVCodecContext *c, const uint8_t 
*buf, int buf_size);
+const char *codec_id_string(enum CodecID codec_id);
+const char *codec_type_string(enum CodecType codec_type);
+
  #ifdef __cplusplus
  }
  #endif
Index: configure
===================================================================
--- configure	(revision 19589)
+++ configure	(working copy)
@@ -1700,6 +1700,7 @@
  _macosx=auto
  _macosx_finder_support=no
  _macosx_bundle=auto
+_accellent=no
  _sortsub=yes
  _freetypeconfig='freetype-config'
  _fribidi=auto
@@ -3533,7 +3534,7 @@
      _aosrc="$_aosrc ao_macosx.c"
      _aomodules="macosx $_aomodules"
      _vosrc="$_vosrc vo_quartz.c"
-    _vomodules="quartz $_vomodules"
+    _vomodules="quartz accellent $_vomodules"
    else
      _macosx=no
      _def_macosx='#undef MACOSX'
@@ -3550,6 +3551,8 @@
  		_vomodules="macosx $_vomodules"
  		_macosx_frameworks="$_macosx_frameworks -framework Cocoa -framework 
QuartzCore -framework OpenGL"
  		_def_macosx_corevideo='#define MACOSX_COREVIDEO 1'
+		_def_macosx_accellent='#define HAVE_DVDV 1'
+                _accellent=yes
  		_macosx_corevideo=yes
  	else
  		_novomodules="macosx $_novomodules"
@@ -7380,6 +7383,8 @@

  HAVE_XVMC_ACCEL = $_xvmc

+HAVE_MAC_ACCELLENT = $_accellent
+
  # for FFmpeg
  SRC_PATH=..
  LIBPREF=lib
@@ -7834,6 +7839,7 @@
  $_def_macosx_finder_support
  $_def_macosx_bundle
  $_def_macosx_corevideo
+$_def_macosx_accellent

  /* Build our Win32-loader */
  $_def_win32_loader

--
Nigel Pearson, nigel at ind.tansu.com.au|     "They did the
Telstra Net. Eng., Sydney, Australia | white man power dance,
Office: 9202 3900    Fax:  9261 3912 |     and ... Shazam"
Mobile: 0408 664435  Home: 9792 6998 | Lois Lane - Smallville




More information about the ffmpeg-devel mailing list