[10/13] h264: Only initialize dsputils if error resilience is enabled

Message ID 1364995179-98359-10-git-send-email-martin@martin.st
State Committed
Commit 85deb51a01f1ecc5ac5faa52ad8ea141c384e23a
Headers show

Commit Message

Martin Storsjö April 3, 2013, 1:19 p.m.
From: "Ronald S. Bultje" <rsbultje@gmail.com>

It is only used for error resilience. This allows building the
h264 decoder without dsputils, if error resilience is disabled.
---
 libavcodec/h264.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Luca Barbato April 3, 2013, 1:47 p.m. | #1
On 03/04/13 15:19, Martin Storsjö wrote:
> From: "Ronald S. Bultje" <rsbultje@gmail.com>
> 
> It is only used for error resilience. This allows building the
> h264 decoder without dsputils, if error resilience is disabled.
> ---
>  libavcodec/h264.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Ok, I guess, I wonder if ER can be implemented w/out dsputils lately.

lu
Diego Biurrun April 3, 2013, 4:14 p.m. | #2
On Wed, Apr 03, 2013 at 04:19:36PM +0300, Martin Storsjö wrote:
> From: "Ronald S. Bultje" <rsbultje@gmail.com>
> 
> It is only used for error resilience. This allows building the
> h264 decoder without dsputils, if error resilience is disabled.

s/dsputils/dsputil/

Otherwise probably OK..

Diego

Patch

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index d89feb7..43bbb2b 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1440,7 +1440,8 @@  av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     h->dequant_coeff_pps = -1;
 
     /* needed so that IDCT permutation is known early */
-    ff_dsputil_init(&h->dsp, h->avctx);
+    if (CONFIG_ERROR_RESILIENCE)
+        ff_dsputil_init(&h->dsp, h->avctx);
     ff_videodsp_init(&h->vdsp, 8);
 
     memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
@@ -2912,7 +2913,8 @@  static int h264_set_parameter_from_sps(H264Context *h)
             ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
                               h->sps.chroma_format_idc);
             h->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
-            ff_dsputil_init(&h->dsp, h->avctx);
+            if (CONFIG_ERROR_RESILIENCE)
+                ff_dsputil_init(&h->dsp, h->avctx);
             ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
         } else {
             av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",