[FFmpeg-devel] avcodec/h264dec: remove unnecessary checks in h264_decode_frame

Submitted by Zhao Zhili on Sept. 6, 2018, 9:01 a.m.

Details

Message ID 20180906090149.32444-1-quinkblack@foxmail.com
State New
Headers show

Commit Message

Zhao Zhili Sept. 6, 2018, 9:01 a.m.
These conditions are checked again in is_extra(). This patch makes no
functional changes.
---
 libavcodec/h264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhao Zhili Sept. 6, 2018, 9:23 a.m.
On 2018年09月06日 17:01, Zhao Zhili wrote:
> These conditions are checked again in is_extra(). This patch makes no
> functional changes.

I made a mistake. The patch makes no functional changes only after
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-September/233991.html

> ---
>   libavcodec/h264dec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index b2447e9..bffce52 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -1000,7 +1000,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
>                                        &h->ps, &h->is_avc, &h->nal_length_size,
>                                        avctx->err_recognition, avctx);
>       }
> -    if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
> +    if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC) {
>           if (is_extra(buf, buf_size))
>               return ff_h264_decode_extradata(buf, buf_size,
>                                               &h->ps, &h->is_avc, &h->nal_length_size,
Michael Niedermayer Sept. 7, 2018, 6:36 p.m.
On Thu, Sep 06, 2018 at 05:01:49PM +0800, Zhao Zhili wrote:
> These conditions are checked again in is_extra(). This patch makes no
> functional changes.
> ---
>  libavcodec/h264dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply with patch this depends on

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b2447e9..bffce52 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1000,7 +1000,7 @@  static int h264_decode_frame(AVCodecContext *avctx, void *data,
                                      &h->ps, &h->is_avc, &h->nal_length_size,
                                      avctx->err_recognition, avctx);
     }
-    if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
+    if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC) {
         if (is_extra(buf, buf_size))
             return ff_h264_decode_extradata(buf, buf_size,
                                             &h->ps, &h->is_avc, &h->nal_length_size,