Re: [FFmpeg-devel] [PATCH] avcodec/hevc_parser: use avpriv_find_start_code in hevc_split()

2015-03-09 Thread zhaoxiu.zeng
在 2015/3/8 20:14, Michael Niedermayer 写道:
 On Sat, Mar 07, 2015 at 11:47:08PM +0800, zhaoxiu.zeng wrote:
 From ab12e3081ba987c2e05d819be97cde96952f1c2a Mon Sep 17 00:00:00 2001
 From: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
 Date: Sat, 7 Mar 2015 23:29:46 +0800
 Subject: [PATCH 1/1] avcodec/hevc_parser: use avpriv_find_start_code in
  hevc_split()

 Signed-off-by: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
 ---
  libavcodec/hevc_parser.c | 26 +-
  1 file changed, 13 insertions(+), 13 deletions(-)

 diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
 index a6fdbb7..91fc0d4 100644
 --- a/libavcodec/hevc_parser.c
 +++ b/libavcodec/hevc_parser.c
 @@ -286,21 +286,21 @@ static int hevc_parse(AVCodecParserContext *s,
  // Split after the parameter sets at the beginning of the stream if they 
 exist.
  static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int 
 buf_size)
  {
 -int i;
 +const uint8_t *ptr = buf, end = buf + buf_size;
 
 end is a uint8_t, that will not work
 also please make sure to test the code you change
 

Sorry for my carelessness. (I tested with make fate only)
Thanks!

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

The new patch:

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index a6fdbb7..7076897 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -286,21 +286,21 @@ static int hevc_parse(AVCodecParserContext *s,
 // Split after the parameter sets at the beginning of the stream if they exist.
 static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 {
-int i;
+const uint8_t *ptr = buf, *end = buf + buf_size;
 uint32_t state = -1;
-int has_ps = 0;
+int has_ps = 0, nut;
 
-for (i = 0; i  buf_size; i++) {
-state = (state  8) | buf[i];
-if (((state  8)  0xFF) == START_CODE) {
-int nut = (state  1)  0x3F;
-if (nut = NAL_VPS  nut = NAL_PPS)
-has_ps = 1;
-else if (has_ps)
-return i - 3;
-else // no parameter set at the beginning of the stream
-return 0;
-}
+while (ptr  end) {
+ptr = avpriv_find_start_code(ptr, end, state);
+if ((state  8) != START_CODE)
+break;
+nut = (state  1)  0x3F;
+if (nut = NAL_VPS  nut = NAL_PPS)
+has_ps = 1;
+else if (has_ps)
+return ptr - 4 - buf;
+else // no parameter set at the beginning of the stream
+return 0;
 }
 return 0;
 }

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


Re: [FFmpeg-devel] [PATCH] avcodec/hevc_parser: use avpriv_find_start_code in hevc_split()

2015-03-09 Thread Michael Niedermayer
On Tue, Mar 10, 2015 at 12:57:57AM +0800, zhaoxiu.zeng wrote:
 在 2015/3/8 20:14, Michael Niedermayer 写道:
  On Sat, Mar 07, 2015 at 11:47:08PM +0800, zhaoxiu.zeng wrote:
  From ab12e3081ba987c2e05d819be97cde96952f1c2a Mon Sep 17 00:00:00 2001
  From: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
  Date: Sat, 7 Mar 2015 23:29:46 +0800
  Subject: [PATCH 1/1] avcodec/hevc_parser: use avpriv_find_start_code in
   hevc_split()
 
  Signed-off-by: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
  ---
   libavcodec/hevc_parser.c | 26 +-
   1 file changed, 13 insertions(+), 13 deletions(-)
 
  diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
  index a6fdbb7..91fc0d4 100644
  --- a/libavcodec/hevc_parser.c
  +++ b/libavcodec/hevc_parser.c
  @@ -286,21 +286,21 @@ static int hevc_parse(AVCodecParserContext *s,
   // Split after the parameter sets at the beginning of the stream if they 
  exist.
   static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int 
  buf_size)
   {
  -int i;
  +const uint8_t *ptr = buf, end = buf + buf_size;
  
  end is a uint8_t, that will not work
  also please make sure to test the code you change
  
 
 Sorry for my carelessness. (I tested with make fate only)
 Thanks!
 
  [...]
  
  
  
  ___
  ffmpeg-devel mailing list
  ffmpeg-devel@ffmpeg.org
  http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
  
 
 The new patch:

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/hevc_parser: use avpriv_find_start_code in hevc_split()

2015-03-09 Thread Michael Niedermayer
On Mon, Mar 09, 2015 at 09:49:04PM +0100, Reimar Döffinger wrote:
 On Tue, Mar 10, 2015 at 12:57:57AM +0800, zhaoxiu.zeng wrote:
  在 2015/3/8 20:14, Michael Niedermayer 写道:
   On Sat, Mar 07, 2015 at 11:47:08PM +0800, zhaoxiu.zeng wrote:
   From ab12e3081ba987c2e05d819be97cde96952f1c2a Mon Sep 17 00:00:00 2001
   From: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
   Date: Sat, 7 Mar 2015 23:29:46 +0800
   Subject: [PATCH 1/1] avcodec/hevc_parser: use avpriv_find_start_code in
hevc_split()
  
   Signed-off-by: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
   ---
libavcodec/hevc_parser.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
  
   diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
   index a6fdbb7..91fc0d4 100644
   --- a/libavcodec/hevc_parser.c
   +++ b/libavcodec/hevc_parser.c
   @@ -286,21 +286,21 @@ static int hevc_parse(AVCodecParserContext *s,
// Split after the parameter sets at the beginning of the stream if 
   they exist.
static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int 
   buf_size)
{
   -int i;
   +const uint8_t *ptr = buf, end = buf + buf_size;
   
   end is a uint8_t, that will not work
   also please make sure to test the code you change
   
  
  Sorry for my carelessness. (I tested with make fate only)
 
 What would be needed so that this will be tested by make fate?
 At least from my side contributions to tests are highly appreciated.

some case that inputs a raw hevc stream and then uses extradata on
the outside, maybe some hevc-something with headers streamcopy

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
Rare item - Common item with rare defect or maybe just a lie
Professional - 'Toy' made in china, not functional except as doorstop
Experts will know - The seller hopes you are not an expert


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/hevc_parser: use avpriv_find_start_code in hevc_split()

2015-03-08 Thread Michael Niedermayer
On Sat, Mar 07, 2015 at 11:47:08PM +0800, zhaoxiu.zeng wrote:
 From ab12e3081ba987c2e05d819be97cde96952f1c2a Mon Sep 17 00:00:00 2001
 From: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
 Date: Sat, 7 Mar 2015 23:29:46 +0800
 Subject: [PATCH 1/1] avcodec/hevc_parser: use avpriv_find_start_code in
  hevc_split()
 
 Signed-off-by: Zeng Zhaoxiu zhaoxiu.z...@gmail.com
 ---
  libavcodec/hevc_parser.c | 26 +-
  1 file changed, 13 insertions(+), 13 deletions(-)
 
 diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
 index a6fdbb7..91fc0d4 100644
 --- a/libavcodec/hevc_parser.c
 +++ b/libavcodec/hevc_parser.c
 @@ -286,21 +286,21 @@ static int hevc_parse(AVCodecParserContext *s,
  // Split after the parameter sets at the beginning of the stream if they 
 exist.
  static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int 
 buf_size)
  {
 -int i;
 +const uint8_t *ptr = buf, end = buf + buf_size;

end is a uint8_t, that will not work
also please make sure to test the code you change

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel