Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: Use non_j_pixfmt() in the format match code

2015-10-11 Thread wm4
On Sun, 11 Oct 2015 21:16:26 +0200
Michael Niedermayer  wrote:

> From: Michael Niedermayer 
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h264_slice.c |   24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index a346ccb..cce97d9 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -865,6 +865,17 @@ static void init_scan_tables(H264Context *h)
>  }
>  }
>  
> +static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
> +{
> +switch (a) {
> +case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
> +case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
> +case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
> +default:
> +return a;
> +}
> +}
> +
>  static enum AVPixelFormat get_pixel_format(H264Context *h, int 
> force_callback)
>  {
>  #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
> @@ -972,7 +983,7 @@ static enum AVPixelFormat get_pixel_format(H264Context 
> *h, int force_callback)
>  *fmt = AV_PIX_FMT_NONE;
>  
>  for (i=0; choices[i] != AV_PIX_FMT_NONE; i++)
> -if (choices[i] == h->avctx->pix_fmt && !force_callback)
> +if (non_j_pixfmt(choices[i]) == non_j_pixfmt(h->avctx->pix_fmt) && 
> !force_callback)
>  return choices[i];
>  return ff_thread_get_format(h->avctx, choices);
>  }
> @@ -1129,17 +1140,6 @@ fail:
>  return ret;
>  }
>  
> -static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
> -{
> -switch (a) {
> -case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
> -case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
> -case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
> -default:
> -return a;
> -}
> -}
> -
>  /**
>   * Decode a slice header.
>   * This will (re)intialize the decoder and call h264_frame_start() as needed.

Not particularly fond of this weird thing spreading.

Can't we finally execute the half-decade old deprecation of the J
formats?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: Use non_j_pixfmt() in the format match code

2015-10-11 Thread Michael Niedermayer
From: Michael Niedermayer 

Signed-off-by: Michael Niedermayer 
---
 libavcodec/h264_slice.c |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a346ccb..cce97d9 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -865,6 +865,17 @@ static void init_scan_tables(H264Context *h)
 }
 }
 
+static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
+{
+switch (a) {
+case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
+case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
+case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
+default:
+return a;
+}
+}
+
 static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
 {
 #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
@@ -972,7 +983,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 *fmt = AV_PIX_FMT_NONE;
 
 for (i=0; choices[i] != AV_PIX_FMT_NONE; i++)
-if (choices[i] == h->avctx->pix_fmt && !force_callback)
+if (non_j_pixfmt(choices[i]) == non_j_pixfmt(h->avctx->pix_fmt) && 
!force_callback)
 return choices[i];
 return ff_thread_get_format(h->avctx, choices);
 }
@@ -1129,17 +1140,6 @@ fail:
 return ret;
 }
 
-static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
-{
-switch (a) {
-case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
-case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
-case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
-default:
-return a;
-}
-}
-
 /**
  * Decode a slice header.
  * This will (re)intialize the decoder and call h264_frame_start() as needed.
-- 
1.7.9.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel