[FFmpeg-cvslog] CrystalHD: Always send filtered H.264 stream to hardware.

Philip Langdale git at videolan.org
Wed Jun 22 06:04:40 CEST 2011


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Sat Jun 18 11:00:37 2011 -0700| [63e0697294ce0040fba58daa0a1de4e45dc4c677] | committer: Philip Langdale

CrystalHD: Always send filtered H.264 stream to hardware.

As we're now always running mp4 format streams through the annex b
filter, it makes sense to pass the filtered stream down, as
libcrystalhd would be doing the conversion internally anyway.

Signed-off-by: Philip Langdale <philipl at overt.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63e0697294ce0040fba58daa0a1de4e45dc4c677
---

 libavcodec/crystalhd.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
index 4fd2cdf..632d774 100644
--- a/libavcodec/crystalhd.c
+++ b/libavcodec/crystalhd.c
@@ -794,7 +794,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
     CopyRet rec_ret;
     CHDContext *priv   = avctx->priv_data;
     HANDLE dev         = priv->dev;
+    uint8_t *in_data   = avpkt->data;
     int len            = avpkt->size;
+    int free_data      = 0;
     uint8_t pic_type   = 0;
 
     av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_frame\n");
@@ -819,15 +821,14 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
         int32_t tx_free = (int32_t)DtsTxFreeSize(dev);
 
         if (priv->parser) {
-            uint8_t *in_data = avpkt->data;
-            int in_len = len;
             int ret = 0;
 
             if (priv->bsfc) {
                 ret = av_bitstream_filter_filter(priv->bsfc, avctx, NULL,
-                                                 &in_data, &in_len,
+                                                 &in_data, &len,
                                                  avpkt->data, len, 0);
             }
+            free_data = ret > 0;
 
             if (ret >= 0) {
                 uint8_t *pout;
@@ -836,13 +837,13 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
                 H264Context *h = priv->parser->priv_data;
 
                 index = av_parser_parse2(priv->parser, avctx, &pout, &psize,
-                                         in_data, in_len, avctx->pkt->pts,
+                                         in_data, len, avctx->pkt->pts,
                                          avctx->pkt->dts, 0);
                 if (index < 0) {
                     av_log(avctx, AV_LOG_WARNING,
                            "CrystalHD: Failed to parse h.264 packet to "
                            "detect interlacing.\n");
-                } else if (index != in_len) {
+                } else if (index != len) {
                     av_log(avctx, AV_LOG_WARNING,
                            "CrystalHD: Failed to parse h.264 packet "
                            "completely. Interlaced frames may be "
@@ -859,9 +860,6 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
                        "packet. Interlaced frames may be incorrectly "
                        "detected.\n");
             }
-            if (ret > 0) {
-                av_freep(&in_data);
-            }
         }
 
         if (len < tx_free - 1024) {
@@ -876,11 +874,17 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
              */
             uint64_t pts = opaque_list_push(priv, avctx->pkt->pts, pic_type);
             if (!pts) {
+                if (free_data) {
+                    av_freep(&in_data);
+                }
                 return AVERROR(ENOMEM);
             }
             av_log(priv->avctx, AV_LOG_VERBOSE,
                    "input \"pts\": %"PRIu64"\n", pts);
-            ret = DtsProcInput(dev, avpkt->data, len, pts, 0);
+            ret = DtsProcInput(dev, in_data, len, pts, 0);
+            if (free_data) {
+                av_freep(&in_data);
+            }
             if (ret == BC_STS_BUSY) {
                 av_log(avctx, AV_LOG_WARNING,
                        "CrystalHD: ProcInput returned busy\n");



More information about the ffmpeg-cvslog mailing list