Re: [FFmpeg-devel] [PATCH] mxfenc: ensure mxf-body_partition_offset is not NULL before using it

2015-03-17 Thread Andreas Cadhalpun
On 17.03.2015 10:17, tomas.har...@codemill.se wrote:
 On 2015-03-14 18:03, Andreas Cadhalpun wrote:
 [PATCH 2/2] mxfenc: don't try to write footer without header:
 
 +if (!mxf-header_written ||
 +(s-oformat == ff_mxf_opatom_muxer  
 !mxf-body_partition_offset)) {
 +err = AVERROR_UNKNOWN;
 +goto end;
 +}
 +
 
 AVERROR_UNKNOWN?

It's unclear why the header was not written or body_partition_offset
not allocated. It could e.g. be due to invalid options, not supported
codecs, or just out of memory.
Do you think AVERROR(EINVAL) or even just -1 would be better?

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] Add ability to pause transcoding via keyboard interaction

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 07:44:54AM -0500, Jeremy Luce wrote:
 It appears that c/C doesn't pause the input threads, which results in
 higher CPU usage than the 'p' pause method. Also, since the input
 threads continue to read data, the input buffer will continue to grow,
 which may lead to undesirable results. I'm not sure if this is by
 design or not, so I'm hesitant to attempt to fix it. These are the
 main reasons why my method was implemented differently than c/C.
 
 If I were to add some visual feedback for 'p', is there anything I
 could tweak that would make you more comfortable with this approach?
 If not, would pausing the input threads on c/C be a viable option?

i think pausing the input threads with c/C is what should be done

thanks

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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


[FFmpeg-devel] [PATCH] 3GPP TS 26.245 Timed Text decoder: decode rich formatting in sample modifier boxes

2015-03-17 Thread Wesley Castro
Bold, italic, and underlined type will be converted to their equivilent ASS 
styles when encountered in a text style sample modifier box.

Signed-off-by: Wesley Castro root...@gmail.com
---
 libavcodec/movtextdec.c | 72 ++---
 1 file changed, 69 insertions(+), 3 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 1c7ffea..4dba1e4 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -26,9 +26,25 @@
 #include libavutil/bprint.h
 #include libavutil/intreadwrite.h
 
-static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
+#define STYLE_FLAG_BOLD 1
+#define STYLE_FLAG_ITALIC   2
+#define STYLE_FLAG_UNDERLINE4
+
+static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
+   const char *style_start, const char *style_end,
+   const int style_flags)
 {
 while (text  text_end) {
+if (style_flags  text == style_start)
+{
+if (style_flags  STYLE_FLAG_BOLD)
+av_bprintf(buf, {\\b1});
+if (style_flags  STYLE_FLAG_ITALIC)
+av_bprintf(buf, {\\i1});
+if (style_flags  STYLE_FLAG_UNDERLINE)
+av_bprintf(buf, {\\u1});
+}
+
 switch (*text) {
 case '\r':
 break;
@@ -36,9 +52,22 @@ static int text_to_ass(AVBPrint *buf, const char *text, 
const char *text_end)
 av_bprintf(buf, \\N);
 break;
 default:
+
 av_bprint_chars(buf, *text, 1);
+
 break;
 }
+
+if (style_flags  text == style_end)
+{
+if (style_flags  STYLE_FLAG_BOLD)
+av_bprintf(buf, {\\b1});
+if (style_flags  STYLE_FLAG_ITALIC)
+av_bprintf(buf, {\\i1});
+if (style_flags  STYLE_FLAG_UNDERLINE)
+av_bprintf(buf, {\\u1});
+}
+
 text++;
 }
 
@@ -63,6 +92,9 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
 AVBPrint buf;
 const char *ptr = avpkt-data;
 const char *end;
+int text_length, tsmb_type, style_entries, style_flags;
+const char *style_start, *style_end;
+const uint8_t *tsmb;
 
 if (!ptr || avpkt-size  2)
 return AVERROR_INVALIDDATA;
@@ -82,7 +114,9 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
  * In complex cases, there are style descriptors appended to the string
  * so we can't just assume the packet size is the string size.
  */
-end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt-size);
+text_length = AV_RB16(ptr);
+
+end = ptr + FFMIN(2 + text_length, avpkt-size);
 ptr += 2;
 
 ts_start = av_rescale_q(avpkt-pts,
@@ -94,7 +128,39 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
 
 // Note that the spec recommends lines be no longer than 2048 characters.
 av_bprint_init(buf, 0, AV_BPRINT_SIZE_UNLIMITED);
-text_to_ass(buf, ptr, end);
+
+if (text_length + 2 != avpkt-size)
+{
+tsmb = ptr + text_length;
+
+//tsmb_size = AV_RB32(tsmb);
+tsmb += 4;
+tsmb_type = AV_RB32(tsmb);
+tsmb += 4;
+
+if (tsmb_type == MKTAG('s','t','y','l'))
+{
+style_entries = AV_RB16(tsmb);
+tsmb += 2;
+
+for(int i = 0; i  style_entries;i++)
+{
+style_start = ptr + AV_RB16(tsmb);
+tsmb += 2;
+style_end = ptr + AV_RB16(tsmb);
+tsmb += 2;
+// fontID = AV_RB16(tsmb);
+tsmb += 2;
+style_flags = AV_RB8(tsmb++);
+
+
+text_to_ass(buf, ptr, end, style_start, style_end, 
style_flags);
+}
+}
+}
+else
+text_to_ass(buf, ptr, end, NULL, NULL, 0);
+
 ret = ff_ass_add_rect_bprint(sub, buf, ts_start, ts_end-ts_start);
 av_bprint_finalize(buf, NULL);
 if (ret  0)
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] [GSoC] movtextdec: decode rich formatting from text sample modifier boxes in 3GPP timed text subtitles

2015-03-17 Thread Wesley Castro
This is to partially fulfil my qualification task for the Implement full
support for 3GPP Timed Text (movtext, QuickTime?) subtitle as part of this
year's GSoC. This does not meet all the requirements of the task, but I will
submit additional patches before the end of the application period to implement
encoding of rich text from text sample modifier boxes as well as
decoding/encoding to/from the default style record in sample descriptions.

Bold, italic, and underline styles from mid-stream sample modifiers are
converted to ASS subtitles. I verified this behaviour using a 3GP video with
embedded subtitles displaying text in various styles (this can be provided if
needed to verify my code). A text sample can have multiple text style sample
modifiers associated with it (zero or more), but each modifier's starting
offset will never be before the ending offset of preceding records, if they
exist. This makes it easy to read modifiers sequentially and avoid needing a
stack to store the records before generating styles, which is done in
microdvddec.

Please review this patch and let me know if it looks good or can be improved.

Thank you,
Wesley Castro

Wesley Castro (1):
  3GPP TS 26.245 Timed Text decoder: decode rich formatting in sample
modifier boxes

 libavcodec/movtextdec.c | 72 ++---
 1 file changed, 69 insertions(+), 3 deletions(-)

-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] 3GPP TS 26.245 Timed Text decoder: decode rich formatting in sample modifier boxes

2015-03-17 Thread Wes
My cover letter was sent in a separate email, apologies!

Wesley

On Tue, Mar 17, 2015 at 9:09 PM, Wesley Castro root...@gmail.com wrote:

 Bold, italic, and underlined type will be converted to their equivilent
 ASS styles when encountered in a text style sample modifier box.

 Signed-off-by: Wesley Castro root...@gmail.com
 ---
  libavcodec/movtextdec.c | 72
 ++---
  1 file changed, 69 insertions(+), 3 deletions(-)

 diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
 index 1c7ffea..4dba1e4 100644
 --- a/libavcodec/movtextdec.c
 +++ b/libavcodec/movtextdec.c
 @@ -26,9 +26,25 @@
  #include libavutil/bprint.h
  #include libavutil/intreadwrite.h

 -static int text_to_ass(AVBPrint *buf, const char *text, const char
 *text_end)
 +#define STYLE_FLAG_BOLD 1
 +#define STYLE_FLAG_ITALIC   2
 +#define STYLE_FLAG_UNDERLINE4
 +
 +static int text_to_ass(AVBPrint *buf, const char *text, const char
 *text_end,
 +   const char *style_start, const char *style_end,
 +   const int style_flags)
  {
  while (text  text_end) {
 +if (style_flags  text == style_start)
 +{
 +if (style_flags  STYLE_FLAG_BOLD)
 +av_bprintf(buf, {\\b1});
 +if (style_flags  STYLE_FLAG_ITALIC)
 +av_bprintf(buf, {\\i1});
 +if (style_flags  STYLE_FLAG_UNDERLINE)
 +av_bprintf(buf, {\\u1});
 +}
 +
  switch (*text) {
  case '\r':
  break;
 @@ -36,9 +52,22 @@ static int text_to_ass(AVBPrint *buf, const char *text,
 const char *text_end)
  av_bprintf(buf, \\N);
  break;
  default:
 +
  av_bprint_chars(buf, *text, 1);
 +
  break;
  }
 +
 +if (style_flags  text == style_end)
 +{
 +if (style_flags  STYLE_FLAG_BOLD)
 +av_bprintf(buf, {\\b1});
 +if (style_flags  STYLE_FLAG_ITALIC)
 +av_bprintf(buf, {\\i1});
 +if (style_flags  STYLE_FLAG_UNDERLINE)
 +av_bprintf(buf, {\\u1});
 +}
 +
  text++;
  }

 @@ -63,6 +92,9 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
  AVBPrint buf;
  const char *ptr = avpkt-data;
  const char *end;
 +int text_length, tsmb_type, style_entries, style_flags;
 +const char *style_start, *style_end;
 +const uint8_t *tsmb;

  if (!ptr || avpkt-size  2)
  return AVERROR_INVALIDDATA;
 @@ -82,7 +114,9 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
   * In complex cases, there are style descriptors appended to the
 string
   * so we can't just assume the packet size is the string size.
   */
 -end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt-size);
 +text_length = AV_RB16(ptr);
 +
 +end = ptr + FFMIN(2 + text_length, avpkt-size);
  ptr += 2;

  ts_start = av_rescale_q(avpkt-pts,
 @@ -94,7 +128,39 @@ static int mov_text_decode_frame(AVCodecContext *avctx,

  // Note that the spec recommends lines be no longer than 2048
 characters.
  av_bprint_init(buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 -text_to_ass(buf, ptr, end);
 +
 +if (text_length + 2 != avpkt-size)
 +{
 +tsmb = ptr + text_length;
 +
 +//tsmb_size = AV_RB32(tsmb);
 +tsmb += 4;
 +tsmb_type = AV_RB32(tsmb);
 +tsmb += 4;
 +
 +if (tsmb_type == MKTAG('s','t','y','l'))
 +{
 +style_entries = AV_RB16(tsmb);
 +tsmb += 2;
 +
 +for(int i = 0; i  style_entries;i++)
 +{
 +style_start = ptr + AV_RB16(tsmb);
 +tsmb += 2;
 +style_end = ptr + AV_RB16(tsmb);
 +tsmb += 2;
 +// fontID = AV_RB16(tsmb);
 +tsmb += 2;
 +style_flags = AV_RB8(tsmb++);
 +
 +
 +text_to_ass(buf, ptr, end, style_start, style_end,
 style_flags);
 +}
 +}
 +}
 +else
 +text_to_ass(buf, ptr, end, NULL, NULL, 0);
 +
  ret = ff_ass_add_rect_bprint(sub, buf, ts_start, ts_end-ts_start);
  av_bprint_finalize(buf, NULL);
  if (ret  0)
 --
 1.9.1


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


Re: [FFmpeg-devel] [PATCH] 3GPP TS 26.245 Timed Text decoder: decode rich formatting in sample modifier boxes

2015-03-17 Thread Philip Langdale
On Tue, 17 Mar 2015 21:12:43 -0700
Wes root...@gmail.com wrote:

 My cover letter was sent in a separate email, apologies!

No need to apologise. That's how git send-email works, and it's to be
expected.

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


Re: [FFmpeg-devel] [PATCH 1/2] libavutil: add av_zhb

2015-03-17 Thread Reimar Döffinger
On 17.03.2015, at 05:08, James Almer jamr...@gmail.com wrote:

 Signed-off-by: James Almer jamr...@gmail.com
 ---
 Better name (av_zero_high_bits?) and doxygen welcome.

Maybe av_wrap_intp2? (to align with clip function naming)
Or av_mod_p2?
Essentially it does a modulo with a power of 2.
Otherwise clear high bits seems a more natural name than zero.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/ac3dec_fixed: fix compilation when ac3dec is disabled

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 05:08:27PM -0300, James Almer wrote:
 Signed-off-by: James Almer jamr...@gmail.com
 ---
  libavcodec/ac3dec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


[FFmpeg-devel] [PATCH] replace cookies with updated values

2015-03-17 Thread Micah Galizia
Hi,

The current Set-Cookie handling appends cookies to the string without
checking to see if a cookie with the same name should have its value
updated.

This is my second attempt to fix this issue -- last time it was a bit
of a string parsing nightmare. This time its a little less complex
(using a dictionary).

Before we start the the existing implementation sucks, change it
discussion I've looked into passing them around in their dictionary
form (an only using the string to initialize cookies from an external
source) but so far as I can tell, AVDictonary cannot be retrieved
using av_opt_get or av_opt_find right now.

Anyway, I hope this is sufficient for inclusion.

TIA
-- 
The mark of an immature man is that he wants to die nobly for a
cause, while the mark of the mature man is that he wants to live
humbly for one.   --W. Stekel
From 18b00063d177965facd805d6b89eb96af371de94 Mon Sep 17 00:00:00 2001
From: Micah Galizia micahgali...@gmail.com
Date: Tue, 17 Mar 2015 20:22:59 +1100
Subject: [PATCH 3/3] replace cookies with updated values instead of appending
 forever

---
 libavformat/http.c | 65 +++---
 1 file changed, 52 insertions(+), 13 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 86380b2..da3c9be 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -77,6 +77,8 @@ typedef struct HTTPContext {
 int is_akamai;
 int is_mediagateway;
 char *cookies;  /// holds newline (\n) delimited Set-Cookie header field values (without the Set-Cookie:  field name)
+/* A dictionary containing cookies keyed by cookie name */
+AVDictionary *cookie_dict;
 int icy;
 /* how much data was read since the last ICY metadata packet */
 int icy_data_read;
@@ -466,6 +468,43 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
 return 0;
 }
 
+static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
+{
+char *eql, *name;
+
+// duplicate the cookie name (dict will dupe the value)
+if (!(eql = strchr(p, '='))) return AVERROR(EINVAL);
+if (!(name = av_strndup(p, eql - p))) return AVERROR(ENOMEM);
+
+// add the cookie to the dictionary
+av_dict_set(cookies, name, eql, AV_DICT_DONT_STRDUP_KEY);
+
+return 0;
+}
+
+static int cookie_string(AVDictionary *dict, char **cookies)
+{
+AVDictionaryEntry *e = NULL;
+int len = 1;
+
+// determine how much memory is needed for the cookies string
+while (e = av_dict_get(dict, , e, AV_DICT_IGNORE_SUFFIX))
+len += strlen(e-key) + strlen(e-value) + 1;
+
+// reallocate the cookies
+e = NULL;
+if (*cookies) av_free(*cookies);
+*cookies = av_malloc(len);
+if (!cookies) return AVERROR(ENOMEM);
+*cookies[0] = '\0';
+
+// write out the cookies
+while (e = av_dict_get(dict, , e, AV_DICT_IGNORE_SUFFIX))
+av_strlcatf(*cookies, len, %s%s\n, e-key, e-value);
+
+return 0;
+}
+
 static int process_line(URLContext *h, char *line, int line_count,
 int *new_location)
 {
@@ -537,19 +576,8 @@ static int process_line(URLContext *h, char *line, int line_count,
 av_free(s-mime_type);
 s-mime_type = av_strdup(p);
 } else if (!av_strcasecmp(tag, Set-Cookie)) {
-if (!s-cookies) {
-if (!(s-cookies = av_strdup(p)))
-return AVERROR(ENOMEM);
-} else {
-char *tmp = s-cookies;
-size_t str_size = strlen(tmp) + strlen(p) + 2;
-if (!(s-cookies = av_malloc(str_size))) {
-s-cookies = tmp;
-return AVERROR(ENOMEM);
-}
-snprintf(s-cookies, str_size, %s\n%s, tmp, p);
-av_free(tmp);
-}
+if (parse_cookie(s, p, s-cookie_dict))
+av_log(h, AV_LOG_WARNING, Unable to parse '%s'\n, p);
 } else if (!av_strcasecmp(tag, Icy-MetaInt)) {
 s-icy_metaint = strtoll(p, NULL, 10);
 } else if (!av_strncasecmp(tag, Icy-, 4)) {
@@ -580,12 +608,19 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
 
 if (!set_cookies) return AVERROR(EINVAL);
 
+// destroy any cookies in the dictionary.
+av_dict_free(s-cookie_dict);
+
 *cookies = NULL;
 while ((cookie = av_strtok(set_cookies, \n, next))) {
 int domain_offset = 0;
 char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL;
 set_cookies = NULL;
 
+// store the cookie in a dict in case it is updated in the response
+if (parse_cookie(s, cookie, s-cookie_dict))
+av_log(s, AV_LOG_WARNING, Unable to parse '%s'\n, cookie);
+
 while ((param = av_strtok(cookie, ; , next_param))) {
 if (cookie) {
 // first key-value pair is the actual cookie value
@@ -693,6 +728,10 @@ static int http_read_header(URLContext 

Re: [FFmpeg-devel] [PATCH] mxfenc: ensure mxf-body_partition_offset is not NULL before using it

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 10:17:06AM +0100, tomas.har...@codemill.se wrote:
 On 2015-03-14 18:03, Andreas Cadhalpun wrote:
 On 14.03.2015 02:17, Mark Reid wrote:
 On Fri, Mar 13, 2015 at 6:02 AM, Andreas Cadhalpun 
 andreas.cadhal...@googlemail.com wrote:
[...]

 Memleak patch is obviously OK.

applied

thanks

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

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


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


Re: [FFmpeg-devel] [FFMpeg-Devel] Ideas for changes to libpostproc

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 08:39:02PM -0400, Tucker DiNapoli wrote:
 This isn't really a patch, but it's easiest to express my ideas in the form of
 code. As a patch it creates a single file which is mostly composed of a 
 rewrite
 of the main postprocessing loop. I've tried to express most of my ideas in
 the form of changes to the code, but in cases where that would be too much
 work, or wouldn't make sense in this file I've written my ideas in comments.
 
 I'm mostly looking for opinions/critisims on my ideas, not necessarily the 
 code itself. I'm fully willing to change code, but I'm more intrested in
 weather or not my ideas make sense or not.
 

 Updating libpostproc is something I plan to do for the google summer of code,
 so I can't make all the changes I'd like now. I need to have some sort of 
 qualification task complete within the next week, I've submitted some patches 
 to

it would be good to have some patch next week, sure, but there is
more time, the 27th is the deadline for submiting an application to
google, there is more time for the qualification task


[...]

 +else if(mode  V_DEBLOCK){
 +//Not sure how to convert this to simd, I was thinking 
 vertClassify
 +//would return a mask classifying multiple blocks, but 
 even if it
 +//does I'm not sure how to run the filters
 +
 +//I guess I could test the mask, and if it's not uniform
 +//run both filters and choose which one to use for each 
 block
 +//based on the mask

yes, you have correctly analyzed the situation.
It would be possible to fall back to call the MMX code multiple times
when the type differs and makes AVX/SSE inppossible or both filters
could be run in AVX/SSE and then some mask  combine could be used

One possibility to move towards this in manageable steps could be to
first change the existing code so instead of doing
for each 8x8 block do
h filter (categorize and apply filter based on that)
transpose
v filter (categorize and apply filter based on that)
transpose
dering
...

-for each 8x8 block do
+for each 4 8x8 blocks do
+for i in 4 do

then the next step:
+H categorize 4 blocks
 for i in 4 do
-   H categorize
H Filter depending on categorize

then here one could add
 H categorize 4 blocks
+if all have the same categorization
+   H Filter in AVX2
+else if 2 match
+   H Filter in SSE2
+else
 for i in 4 do
H Filter depending on categorize

or the same could be done with the next step in the filtering
pipeline


also iam not sure its worth it to have the main loop block size
variable, it might be easier to always go by steps of 4 8-pixel blocks
horizontally and 1 8pixel block vertically



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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [FFMpeg-Devel] Ideas for changes to libpostproc

2015-03-17 Thread Michael Niedermayer
On Wed, Mar 18, 2015 at 02:30:29AM +0100, Michael Niedermayer wrote:
 On Tue, Mar 17, 2015 at 08:39:02PM -0400, Tucker DiNapoli wrote:
  This isn't really a patch, but it's easiest to express my ideas in the form 
  of
  code. As a patch it creates a single file which is mostly composed of a 
  rewrite
  of the main postprocessing loop. I've tried to express most of my ideas in
  the form of changes to the code, but in cases where that would be too much
  work, or wouldn't make sense in this file I've written my ideas in comments.
  
  I'm mostly looking for opinions/critisims on my ideas, not necessarily the 
  code itself. I'm fully willing to change code, but I'm more intrested in
  weather or not my ideas make sense or not.
  
 
  Updating libpostproc is something I plan to do for the google summer of 
  code,
  so I can't make all the changes I'd like now. I need to have some sort of 
  qualification task complete within the next week, I've submitted some 
  patches to
 
 it would be good to have some patch next week, sure, but there is
 more time, the 27th is the deadline for submiting an application to
 google, there is more time for the qualification task
 
 
 [...]
 
  +else if(mode  V_DEBLOCK){
  +//Not sure how to convert this to simd, I was thinking 
  vertClassify
  +//would return a mask classifying multiple blocks, but 
  even if it
  +//does I'm not sure how to run the filters
  +
  +//I guess I could test the mask, and if it's not 
  uniform
  +//run both filters and choose which one to use for 
  each block
  +//based on the mask
 
 yes, you have correctly analyzed the situation.
 It would be possible to fall back to call the MMX code multiple times
 when the type differs and makes AVX/SSE inppossible or both filters
 could be run in AVX/SSE and then some mask  combine could be used
 
 One possibility to move towards this in manageable steps could be to
 first change the existing code so instead of doing
 for each 8x8 block do
 h filter (categorize and apply filter based on that)
 transpose
 v filter (categorize and apply filter based on that)
 transpose
 dering
 ...
 
 -for each 8x8 block do
 +for each 4 8x8 blocks do
 +for i in 4 do
 
 then the next step:
 +H categorize 4 blocks
  for i in 4 do
 -   H categorize
 H Filter depending on categorize
 
 then here one could add
  H categorize 4 blocks
 +if all have the same categorization
 +   H Filter in AVX2
 +else if 2 match
 +   H Filter in SSE2
 +else
  for i in 4 do
 H Filter depending on categorize
 
 or the same could be done with the next step in the filtering
 pipeline
 
 
 also iam not sure its worth it to have the main loop block size
 variable, it might be easier to always go by steps of 4 8-pixel blocks
 horizontally and 1 8pixel block vertically

also about the postprocessing functions there are several which
are not very important, *X1Filter was just for experimentation, dont
waste time on that

The most important are do_a_deblock() and dering() probably
do_a_deblock() also might be easier than do*LowPass / do*DefFilter
*Classify to optimize as it already works with masks instead of a
single category field

do_a_deblock() is supposed to be an accurate implementation while
do*LowPass / do*DefFilter / *Classify are a approximations

in principle optimizing do_a_deblock() and dering() should
be enough as any system with AVX/SSE will be more then fast
enough to do the accurate ones. So you could after these and
anything else you like to work on in libpostproc, work on optimizing
other parts of the codebase in summer if you like


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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


Re: [FFmpeg-devel] GSoc Qualification Task - Implementing Compression technique B44 as a part of exr format (libavcodec/exr.c)

2015-03-17 Thread Michael Niedermayer
On Mon, Mar 16, 2015 at 11:49:09PM +0530, greeshma wrote:
 Hello ,
 
 I have implemented B44 lossy compression technique.The first patch is
 hereby attached.Please have a look.
 The diff file is also attached.

Did you use any previously existing code to implement this?
If so please add a link to that code and make sure you add
copyright / author attribution of the material you used
to the changed file and make sure its license is compatible

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


[FFmpeg-devel] [FFMpeg-Devel] Ideas for changes to libpostproc

2015-03-17 Thread Tucker DiNapoli
This isn't really a patch, but it's easiest to express my ideas in the form of
code. As a patch it creates a single file which is mostly composed of a rewrite
of the main postprocessing loop. I've tried to express most of my ideas in
the form of changes to the code, but in cases where that would be too much
work, or wouldn't make sense in this file I've written my ideas in comments.

I'm mostly looking for opinions/critisims on my ideas, not necessarily the 
code itself. I'm fully willing to change code, but I'm more intrested in
weather or not my ideas make sense or not.

Updating libpostproc is something I plan to do for the google summer of code,
so I can't make all the changes I'd like now. I need to have some sort of 
qualification task complete within the next week, I've submitted some patches to
the mailing list already, and thoes are more along the lines of what I want to 
do
right now, this code is more of an idea for work to do over the summer.

Tucker DiNapoli

---
 libpostproc/postprocess_main.c | 606 +
 1 file changed, 606 insertions(+)
diff --git a/libpostproc/postprocess_main.c b/libpostproc/postprocess_main.c
new file mode 100644
index 000..9ca62a2


--- /dev/null
+++ b/libpostproc/postprocess_main.c
@@ -0,0 +1,606 @@
+#include postprocess_internal.h
+//the assembler versions are named x264_name_instruction_set
+#if HAVE_AVX2
+#define RENAME(name) x264_##name##_avx2
+#elif HAVE_SSE2
+#define RENAME(name) x264_##name##_sse2
+#elif HAVE_MMX2
+#define RENAME(name) x264_##name##_mmx2
+#else
+#define RENAME(name) name##_C
+#endif
+int  RENAME(vertClassify)(const uint8_t src[], int stride, PPContext *c);
+void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c);
+int  RENAME(vertClassify)(const uint8_t src[], int stride, PPContext *c);
+void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c);
+void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co);
+void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c);
+void RENAME(dering)(uint8_t src[], int stride, PPContext *c);
+void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride);
+void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride);
+void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp);
+void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t 
*tmp2);
+void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp);
+void RENAME(deInterlaceMedian)(uint8_t src[], int stride);
+void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2,
+const uint8_t *src, int srcStride);
+void RENAME(transpose2)(uint8_t *dst, int dstStride, const uint8_t *src);
+void RENAME(tempNoiseReducer)(uint8_t *src, int stride,;
+void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, const PPContext 
*c, int mode){;
+void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], 
int dstStride,
+ int width, int height, const QP_STORE_T 
QPs[],
+ int QPStride, int isColor, PPContext *c);
+void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int 
srcStride,
+   int levelFix, int64_t 
*packedOffsetAndScale);
+void RENAME(duplicate)(uint8_t src[], int stride);
+#if ARCH_X86  HAVE_INLINE_ASM
+static inline void prefetchnta(const void *p)
+{
+__asm__ volatile(   prefetchnta (%0)\n\t
+: : r (p)
+);
+}
+
+static inline void prefetcht0(const void *p)
+{
+__asm__ volatile(   prefetcht0 (%0)\n\t
+: : r (p)
+);
+}
+
+static inline void prefetcht1(const void *p)
+{
+__asm__ volatile(   prefetcht1 (%0)\n\t
+: : r (p)
+);
+}
+
+static inline void prefetcht2(const void *p)
+{
+__asm__ volatile(   prefetcht2 (%0)\n\t
+: : r (p)
+);
+}
+#else
+//judging by the gcc manuals this is a conservative estimate for when
+// __builtin_prefetch was added
+#if AV_GCC_VERSION_AT_LEAST(3,3)
+#define prefetchnta(p) __builtin_prefetch(p,0,0)
+#define prefetcht0(p) __builtin_prefetch(p,0,1)
+#define prefetcht1(p) __builtin_prefetch(p,0,2)
+#define prefetcht2(p) __builtin_prefetch(p,0,3)
+#else
+#define prefetchnta(p)
+#define prefetcht0(p)
+#define prefetcht1(p)
+#define prefetcht2(p)
+#endif
+#endif
+
+/*void deInterlaceInterpolateLinear(const uint8_t *src, int src_stride, 
uint8_t *dst, int dst_stride,
+  int width, int height, PPContext *c){
+//assume 1st line has been delt with
+static const copy_ahead = 5;
+int aligned_height = (height - 16) % c-block_height;
+int aligned_width = width % c-block_width;
+int x,y;
+const int mode= isColor ? c-ppMode.chromMode : c-ppMode.lumMode;
+for(y=0; y  aligned_height; y+=c-block_height){
+const uint8_t *src_block = src+(y * src_stride);
+uint8_t *dst_block = dst+(y * dst_stride);
+

[FFmpeg-devel] [GSOC] Various things

2015-03-17 Thread Michael Niedermayer
Hi

If you are a student,
Make sure you submit an application to google
before the google deadline (27th march) if you dont do that you will
not be able to participate in GSoC

Make sure you submit your qualification task early, patches always
require multiple review and resumbit cycles

If you are a mentor make sure your student is aware of above

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


Re: [FFmpeg-devel] [PATCH] avfilter/showwaves: add single_pic option

2015-03-17 Thread Clément Bœsch
On Mon, Mar 16, 2015 at 04:11:24PM +0100, Stefano Sabatini wrote:
 On date Sunday 2014-12-28 12:48:19 +0100, Clément Bœsch encoded:
  On Fri, Dec 26, 2014 at 01:16:07AM +0100, Stefano Sabatini wrote:
   On date Friday 2014-12-26 00:17:53 +0100, Clément Bœsch encoded:
 [...]
  The first case has its use cases. Random example:
  https://soundcloud.com/explore
  
   
   The two approaches are not mutually exclusive, but the latter is
   probably more flexible.
   
  
  In the second case, you'll probably need successive scaling before you
  reach the targeted size. It's probably a bit more complex than the current
  patch, but might do the trick.
  
  Note that, while I don't think it will matter, the beginning of the track
  will probably suffer from accuracy given how many time it will be
  averaged/scaled.
  
 
   I'll prepare a patch to cover case 2. About case 1, I wonder if having
   a dedicated filter (sharing part of the code of showwaves) wouldn't be
   a better approach, but I'm not sure it will.
  
  I'm a bit lazy to do that, feel free to take over this patch.
 
 What do you think of a separate filter to cover single_pic? See
 attached patch.
 -- 
 FFmpeg = Fiendish and Frenzy Monstrous Puritan Extravagant Guru

 From 5ecb0190806d39bdd869de951634000b1d1e1c0f Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= u...@pkh.me
 Date: Wed, 24 Dec 2014 15:03:26 +0100
 Subject: [PATCH] lavfi: add showwavespic filter
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
 This is a variant of showaves. It is implemented as a different filter so
 that the user is not allowed to use meaningless options which belong to
 showaves (such as rate).
 
 Major edits done by Stefano Sabatini, from a patch by ubitux.
 
 See thread:
 From: Clément Bœsch u...@pkh.me
 To: ffmpeg-devel@ffmpeg.org
 Date: Wed, 24 Dec 2014 15:03:26 +0100
 Subject: [FFmpeg-devel] [PATCH] avfilter/showwaves: add single_pic option
 
 TODO: bump minor
 ---
  doc/filters.texi|  27 +
  libavfilter/Makefile|   1 +
  libavfilter/allfilters.c|   1 +
  libavfilter/avf_showwaves.c | 274 
 ++--
  4 files changed, 268 insertions(+), 35 deletions(-)
 

Good idea, patch LGTM after a quick look, but since it's based on my code
I haven't much comment.

BTW, it might be relevant to add a fate test.

-- 
Clément B.


pgp0QnQOfxZSC.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/ac3dec_fixed: fix compilation when ac3dec is disabled

2015-03-17 Thread James Almer
Signed-off-by: James Almer jamr...@gmail.com
---
 libavcodec/ac3dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 4e6e124..e3bf292 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -196,10 +196,10 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
 s-fdsp = avpriv_alloc_fixed_dsp(avctx-flags  CODEC_FLAG_BITEXACT);
 #else
 s-fdsp = avpriv_float_dsp_alloc(avctx-flags  CODEC_FLAG_BITEXACT);
+ff_fmt_convert_init(s-fmt_conv, avctx);
 #endif
 
 ff_ac3dsp_init(s-ac3dsp, avctx-flags  CODEC_FLAG_BITEXACT);
-ff_fmt_convert_init(s-fmt_conv, avctx);
 av_lfg_init(s-dith_state, 0);
 
 if (USE_FIXED)
-- 
2.3.2

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


Re: [FFmpeg-devel] [PATCH] lavfi/eq: factorize code in process_command through a macro

2015-03-17 Thread Michael Niedermayer
On Sun, Mar 15, 2015 at 02:59:58PM +0100, Stefano Sabatini wrote:
 On date Friday 2015-03-13 20:05:35 +0100, Michael Niedermayer encoded:
  On Fri, Mar 13, 2015 at 05:16:53PM +0100, Stefano Sabatini wrote:
   ---
libavfilter/vf_eq.c | 56 
   ++---
1 file changed, 15 insertions(+), 41 deletions(-)
  
  i would be more in favor of a function than a macro but LGTM either
  way, macros are harder to debug and all kind of line number based
  outputs are basically useless with multiline macros, be that
  static analyzers of dynamic ...
  
  
  
  set_param(cmd, gamma_g, eq-gamma_g_pexp, args, ctx, eq, ret);
  set_param(cmd, gamma_r, eq-gamma_r_pexp, args, ctx, eq, ret);
  if (ret  0)
 
 Up.
 -- 
 FFmpeg = Fantastic Fundamental Miracolous Patchable Elitarian Gargoyle

  vf_eq.c |   66 
 ++--
  1 file changed, 23 insertions(+), 43 deletions(-)
 3adede32119e8d758297b2a29a92b98cb17d1010  
 0001-lavfi-eq-factorize-code-in-process_command.patch
 From ee2157da84a30e043dfa55cf25a86ef751451bba Mon Sep 17 00:00:00 2001
 From: Stefano Sabatini stefa...@gmail.com
 Date: Fri, 13 Mar 2015 16:45:08 +0100
 Subject: [PATCH] lavfi/eq: factorize code in process_command()

LGTM

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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


Re: [FFmpeg-devel] [PATCH 2/2] libavutil: add bmi2 optimized av_zhb

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 01:08:06AM -0300, James Almer wrote:
 Signed-off-by: James Almer jamr...@gmail.com
 ---
 GCC apparently can't generate a bzhi instruction on its own from the c 
 version, so 
 here's a custom implementation.
 
 Before:
 
 gcc -O3
 av_zhb_c:
0:   89 f1   movecx,esi
2:   ba 01 00 00 00  movedx,0x1
7:   d3 e2   shledx,cl
9:   83 ea 01subedx,0x1
c:   89 d0   moveax,edx
e:   21 f8   andeax,edi
   10:   c3  ret
 
 gcc -mbmi2 -O3
 av_zhb_c:
0:   ba 01 00 00 00  movedx,0x1
5:   c4 e2 49 f7 d2  shlx   edx,edx,esi
a:   8d 42 ffleaeax,[rdx-0x1]
d:   21 f8   andeax,edi
f:   c3  ret
 
 After:
 
 gcc -mbmi2 -O3
 av_zhb_bmi2:
0:   c4 e2 48 f5 c7  bzhi   eax,edi,esi
5:   c3  ret
 
 The non-bmi2 example is a bit bloated with movs to have values in ecx (needed 
 for 
 shl) and eax (ret value) since, unlike the actual function, it was not 
 inlined.
 Still, best case scenario is mov + shl + sub/dec/lea + and versus a single 
 bzhi 
 when p is not a constant.

orthogonal to this patch, you or someone might want to submit a patch
to gcc to make it autogenerate this optimization

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH] Add ability to pause transcoding via keyboard interaction

2015-03-17 Thread Jeremy Luce
It appears that c/C doesn't pause the input threads, which results in
higher CPU usage than the 'p' pause method. Also, since the input
threads continue to read data, the input buffer will continue to grow,
which may lead to undesirable results. I'm not sure if this is by
design or not, so I'm hesitant to attempt to fix it. These are the
main reasons why my method was implemented differently than c/C.

If I were to add some visual feedback for 'p', is there anything I
could tweak that would make you more comfortable with this approach?
If not, would pausing the input threads on c/C be a viable option?

Jeremy


 it seems any key unpauses transcoding

 also theres no vissual feedback that ffmpeg is paused or how the
 user can unpause it
 this is bad in case the user pressed p by mistake

 also the c and C keys already effectivly pause ffmpeg
 p should not be implemented entirely differently than how they work.
 If c/C have problems these problems should be fixed

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


Re: [FFmpeg-devel] [PATCH] doc/protocols: Fixed missing example section marker

2015-03-17 Thread Michael Niedermayer
On Tue, Mar 17, 2015 at 02:07:50PM +0100, Tobias Rapp wrote:
 Attached (trivial) patch adds some missing @example section marker
 to protocols.texi
 
 Regards,
 Tobias

  protocols.texi |2 ++
  1 file changed, 2 insertions(+)
 c16beb3e1a1f99bd221417a2343a9fbf9cafa04c  
 0001-doc-protocols-Fixed-missing-example-section-marker.patch
 From 26410261c11aa48622a30b1032023f80fc9062c1 Mon Sep 17 00:00:00 2001
 From: Tobias Rapp t.r...@noa-audio.com
 Date: Wed, 11 Mar 2015 11:22:04 +0100
 Subject: [PATCH] doc/protocols: Fixed missing example section marker

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


[FFmpeg-devel] [PATCH] doc/protocols: Fixed missing example section marker

2015-03-17 Thread Tobias Rapp
Attached (trivial) patch adds some missing @example section marker to 
protocols.texi


Regards,
Tobias
From 26410261c11aa48622a30b1032023f80fc9062c1 Mon Sep 17 00:00:00 2001
From: Tobias Rapp t.r...@noa-audio.com
Date: Wed, 11 Mar 2015 11:22:04 +0100
Subject: [PATCH] doc/protocols: Fixed missing example section marker

---
 doc/protocols.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 5f6dfa8..2a19b41 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1055,7 +1055,9 @@ 
subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
 @end example
 
 Play an AVI file directly from a TAR archive:
+@example
 subfile,,start,183241728,end,366490624,,:archive.tar
+@end example
 
 @section tcp
 
-- 
1.9.1

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


Re: [FFmpeg-devel] GSoc Qualification Task - Implementing Compression technique B44 as a part of exr format (libavcodec/exr.c)

2015-03-17 Thread Michael Niedermayer
Hi

On Mon, Mar 16, 2015 at 11:49:09PM +0530, greeshma wrote:
 Hello ,
 
 I have implemented B44 lossy compression technique.The first patch is
 hereby attached.Please have a look.
 The diff file is also attached.

the inline patch is corrupted by line breaks, the attached patch
is corrupted by an extra newline in the 2nd hunk and a missing
newline later

please use
git format-patch -1
to create a patch, do not edit it after creating it and attach it

also if you are not subscribed to ffmpeg-devel, please subscribe so
you will receive review comments to your patches

Thanks

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

No great genius has ever existed without some touch of madness. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] AAC: [PATCH] AAC: Add support for 7350Hz sampling rates

2015-03-17 Thread Claudio Freire
On Mon, Mar 16, 2015 at 12:41 AM, Michael Niedermayer michae...@gmx.at wrote:
 On Fri, Mar 13, 2015 at 03:53:56PM -0300, Claudio Freire wrote:
 On Fri, Mar 13, 2015 at 3:06 PM, Michael Niedermayer michae...@gmx.at 
 wrote:
  On Fri, Mar 13, 2015 at 02:34:08PM -0300, Claudio Freire wrote:
  On Fri, Mar 13, 2015 at 12:39 PM, Nedeljko Babic
  nedeljko.ba...@imgtec.com wrote:
   btw, i use the qemu from https://github.com/ssvb/QEMU.git
   for mips as it at least years ago supported more extensions, i
   would have guessed these where merged into main qemu but as you list
   all the disables in the wiki, maybe i was guessing wrong
  
   I can confirm that main qemu supports both fpu and dspr1/dspr2 
   extension.
   Appropriate cpu model needs to be selected in order for the extension 
   to be available.
   74Kf supports all extensions, so adding -cpu 74Kf in --target-exec 
   should enable fpu, dspr1 and dspr2 extensions.
 
  As I was building on a more complete reply, the problem I have is with
  the glibc, which is built with the soft float ABI.
 
 
  As soon as I finish all the tests (they take a while) I'll post more
 
  they really shouldnt take much time
 
  a build (with ccache) should be quite fast and you only need to test
  make -jnum fate-aac-s7350-encode
 
  can it be that theres some float rounding somewhere that leads to a
  different decission that causes this ?

 Soft float is slow, add emulation and it's worse. The build is fast
 enough, it's the tests the ones that are slow.

 I'm going to try adding a hard-float version of the glibc in
 opensuse's build service.

 But first I want to get the patch that fixes mips tests verified.

 btw, if you cant reproduce this issue, maybe it would be best to
 just leave this one fate test out and continue, maybe one of the
 subsequent bug fixes will fix this too

I managed to reproduce it with a hardfloat build, so indeed it seems
like a float rounding issue.

Now it only needs solving.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2] mov: Add option to keep exact packet sequence after seeking

2015-03-17 Thread Derek Buitenhuis
The current behavior may produce a different sequence of packets
after seeking, compared to demuxing linearly from the beginning.
This is because the MOV demuxer seeks in each stream individually,
based on timestamp, which may set each stream at a slightly different
position than if the file would have been read sequentially.

This makes implementing certain operations, such as segmenting,
quite hard, and slower than need be.

Therefore, add an option which retains the same packet sequence
after seeking, as when a file is demuxed linearly.
---
Now with more correct pos seeking by Martin.

Also, option is renamed, and set differently by default, although
default behavior remains unchanged.
---
 libavformat/isom.h|  1 +
 libavformat/mov.c | 46 +++---
 libavformat/version.h |  4 ++--
 3 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index d233839..5d48989 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -186,6 +186,7 @@ typedef struct MOVContext {
 int chapter_track;
 int use_absolute_path;
 int ignore_editlist;
+int seek_individually;
 int64_t next_root_atom; /// offset of the next root atom
 int export_all;
 int export_xmp;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index de4004f..ccf73d6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4323,8 +4323,8 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 
 static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t 
sample_time, int flags)
 {
+MOVContext *mc = s-priv_data;
 AVStream *st;
-int64_t seek_timestamp, timestamp;
 int sample;
 int i;
 
@@ -4336,19 +4336,39 @@ static int mov_read_seek(AVFormatContext *s, int 
stream_index, int64_t sample_ti
 if (sample  0)
 return sample;
 
-/* adjust seek timestamp to found sample timestamp */
-seek_timestamp = st-index_entries[sample].timestamp;
+if (mc-seek_individually) {
+/* adjust seek timestamp to found sample timestamp */
+int64_t seek_timestamp = st-index_entries[sample].timestamp;
 
-for (i = 0; i  s-nb_streams; i++) {
-MOVStreamContext *sc = s-streams[i]-priv_data;
-st = s-streams[i];
-st-skip_samples = (sample_time = 0) ? sc-start_pad : 0;
+for (i = 0; i  s-nb_streams; i++) {
+int64_t timestamp;
+MOVStreamContext *sc = s-streams[i]-priv_data;
+st = s-streams[i];
+st-skip_samples = (sample_time = 0) ? sc-start_pad : 0;
 
-if (stream_index == i)
-continue;
+if (stream_index == i)
+continue;
 
-timestamp = av_rescale_q(seek_timestamp, 
s-streams[stream_index]-time_base, st-time_base);
-mov_seek_stream(s, st, timestamp, flags);
+timestamp = av_rescale_q(seek_timestamp, 
s-streams[stream_index]-time_base, st-time_base);
+mov_seek_stream(s, st, timestamp, flags);
+}
+} else {
+for (i = 0; i  s-nb_streams; i++) {
+MOVStreamContext *sc;
+st = s-streams[i];
+sc = st-priv_data;
+sc-current_sample = 0;
+}
+while (1) {
+MOVStreamContext *sc;
+AVIndexEntry *entry = mov_find_next_sample(s, st);
+if (!entry)
+return AVERROR_INVALIDDATA;
+sc = st-priv_data;
+if (sc-ffindex == stream_index  sc-current_sample == sample)
+break;
+sc-current_sample++;
+}
 }
 return 0;
 }
@@ -4360,6 +4380,10 @@ static const AVOption mov_options[] = {
 allow using absolute path when opening alias, this is a possible 
security issue,
 OFFSET(use_absolute_path), FF_OPT_TYPE_INT, {.i64 = 0},
 0, 1, FLAGS},
+{seek_streams_individually,
+Seek each stream individually to the to the closest point,
+OFFSET(seek_individually), AV_OPT_TYPE_INT, { .i64 = 1 },
+0, 1, FLAGS},
 {ignore_editlist, , OFFSET(ignore_editlist), FF_OPT_TYPE_INT, {.i64 = 
0},
 0, 1, FLAGS},
 {use_mfra_for,
diff --git a/libavformat/version.h b/libavformat/version.h
index ba4c7c8..52ecfd0 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
 #include libavutil/version.h
 
 #define LIBAVFORMAT_VERSION_MAJOR 56
-#define LIBAVFORMAT_VERSION_MINOR  25
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR  26
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-- 
1.8.3.1

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


Re: [FFmpeg-devel] GSoc Qualification Task - Implementing Compression technique B44 as a part of exr format (libavcodec/exr.c)

2015-03-17 Thread Paul B Mahol
On 3/16/15, greeshma greeshmabalaba...@gmail.com wrote:
 Hello ,

 I have implemented B44 lossy compression technique.The first patch is
 hereby attached.Please have a look.
 The diff file is also attached.

 diff --git a/libavcodec/exr.c b/libavcodec/exr.c
 index 6251fb7..e540d4c 100644
 --- a/libavcodec/exr.c
 +++ b/libavcodec/exr.c
 @@ -45,6 +45,10 @@
  #include mathops.h
  #include thread.h

 +typedef int bool;
 +#define true 1
 +#define false 0

This appear to be unused.

 +
  enum ExrCompr {
  EXR_RAW,
  EXR_RLE,
 @@ -69,6 +73,19 @@ typedef struct EXRChannel {
  enum ExrPixelType pixel_type;
  } EXRChannel;

 +
 +typedef struct EXRChannelData
 +{
 +unsigned short *start;
 +unsigned short *end;
 +int nx;
 +int ny;
 +int ys;
 +enum ExrPixelType type;
 +bool pLinear;

This seems to be unused.

 +int size;
 +}EXRChannelData;
 +
  typedef struct EXRThreadData {
  uint8_t *uncompressed_data;

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


Re: [FFmpeg-devel] [PATCH] avcodec: add libdcadec decoder

2015-03-17 Thread James Almer
On 17/03/15 1:07 PM, Hendrik Leppkes wrote:
 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index cdc8aa1..48e212f 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -2851,6 +2851,7 @@ typedef struct AVCodecContext {
  #define FF_PROFILE_DTS_96_24   40
  #define FF_PROFILE_DTS_HD_HRA  50
  #define FF_PROFILE_DTS_HD_MA   60
 +#define FF_PROFILE_DTS_EXPRESS 70

Maybe a separate patch?

[...]

 +static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
 +   int *got_frame_ptr, AVPacket *avpkt)
 +{
 +DCADecContext *s = avctx-priv_data;
 +AVFrame *frame = data;
 +int ret, i, k;
 +int **samples, nsamples, channel_mask, sample_rate, bits_per_sample, 
 profile;
 +
 +if ((ret = dcadec_context_parse(s-ctx, avpkt-data, avpkt-size))  0) {
 +av_log(avctx, AV_LOG_ERROR, dcadec_context_parse() failed: %d\n, 
 -ret);
 +return AVERROR_UNKNOWN;

AVERROR_EXTERNAL, or maybe translate the DCADEC_E* error values.

[...]

 +frame-nb_samples = nsamples;
 +if ((ret = ff_get_buffer(avctx, frame, 0))  0)
 +return ret;
 +
 +for (i = 0; i  avctx-channels; i++) {
 +if (frame-format == AV_SAMPLE_FMT_S16P) {
 +int16_t *plane = (int16_t *)frame-extended_data[i];
 +for (k = 0; k  nsamples; k++)
 +plane[k] = samples[i][k];
 +} else {
 +int32_t *plane = (int32_t *)frame-extended_data[i];
 +int shift = 32 - bits_per_sample;
 +for (k = 0; k  nsamples; k++)
 +plane[k] = samples[i][k]  shift;
 +}
 +}

We don't have a generic decorrelate dsp?
I think there was something in fmtconvert, but libav nuked it for being unused.

[...]

 +AVCodec ff_libdcadec_decoder = {
 +.name   = libdcadec,
 +.long_name  = NULL_IF_CONFIG_SMALL(dcadec DCA decoder),
 +.type   = AVMEDIA_TYPE_AUDIO,
 +.id = AV_CODEC_ID_DTS,
 +.priv_data_size = sizeof(DCADecContext),
 +.init   = dcadec_init,
 +.decode = dcadec_decode_frame,
 +.close  = dcadec_close,
 +.flush  = dcadec_flush,
 +.capabilities   = CODEC_CAP_DR1 | CODEC_CAP_CHANNEL_CONF,
 +.sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, 
 AV_SAMPLE_FMT_S16P,
 +  AV_SAMPLE_FMT_NONE },
 +.profiles   = NULL_IF_CONFIG_SMALL(profiles),
 +};

Missing version bump and changelog entry.

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


Re: [FFmpeg-devel] [PATCH 1/2] libavutil: add av_zhb

2015-03-17 Thread James Almer
On 17/03/15 5:28 AM, Reimar Döffinger wrote:
 On 17.03.2015, at 05:08, James Almer jamr...@gmail.com wrote:
 
 Signed-off-by: James Almer jamr...@gmail.com
 ---
 Better name (av_zero_high_bits?) and doxygen welcome.
 
 Maybe av_wrap_intp2? (to align with clip function naming)
 Or av_mod_p2?
 Essentially it does a modulo with a power of 2.
 Otherwise clear high bits seems a more natural name than zero.

Well, the bmi2 instruction uses zero http://www.felixcloutier.com/x86/BZHI.html
Nonetheless, i like av_mod_p2 more than av_zhb, so unless someone else suggests 
something else I'll resend the set using that name.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec: add libdcadec decoder

2015-03-17 Thread Hendrik Leppkes
---

libdcadec is found here: https://github.com/foo86/dcadec

I wrote this mostly for myself, as its lossless and quite stable, and
allows easy comparison to the state of the native decoder.

Since I got a request to share it, I figured I might just send it, may it 
benefit anyone that is interested.

diff --git a/configure b/configure
index 586c26b..94f9d7b 100755
--- a/configure
+++ b/configure
@@ -210,6 +210,7 @@ External library support:
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
+  --enable-libdcadec   enable DCA decoding via libdcadec [no]
   --enable-libfaac enable AAC encoding via libfaac [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
@@ -1353,6 +1354,7 @@ EXTERNAL_LIBRARY_LIST=
 libcdio
 libcelt
 libdc1394
+libdcadec
 libfaac
 libfdk_aac
 libflite
@@ -2359,6 +2361,7 @@ vc1_parser_select=mpegvideo startcode vc1_decoder
 # external libraries
 libaacplus_encoder_deps=libaacplus
 libcelt_decoder_deps=libcelt
+libdcadec_decoder_deps=libdcadec
 libfaac_encoder_deps=libfaac
 libfaac_encoder_select=audio_frame_queue
 libfdk_aac_decoder_deps=libfdk_aac
@@ -4923,6 +4926,7 @@ enabled libceltrequire libcelt celt/celt.h 
celt_decode -lcelt0 
  { check_lib celt/celt.h 
celt_decoder_create_custom -lcelt0 ||
die ERROR: libcelt must be installed and 
version must be = 0.11.0.; }
 enabled libcacarequire_pkg_config caca caca.h caca_create_canvas
+enabled libdcadec  require libdcadec dca_context.h 
dcadec_context_create -ldcadec
 enabled libfaacrequire2 libfaac stdint.h faac.h 
faacEncGetVersion -lfaac
 enabled libfdk_aac require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac
 flite_libs=-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4173f88..1a0c734 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -732,6 +732,7 @@ OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
 # external codec libraries
 OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
+OBJS-$(CONFIG_LIBDCADEC_DECODER)  += libdcadec.o
 OBJS-$(CONFIG_LIBFAAC_ENCODER)+= libfaac.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5194e74..bbf70a6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -512,6 +512,7 @@ void avcodec_register_all(void)
 
 /* external libraries */
 REGISTER_DECODER(LIBCELT,   libcelt);
+REGISTER_DECODER(LIBDCADEC, libdcadec)
 REGISTER_ENCODER(LIBFAAC,   libfaac);
 REGISTER_ENCDEC (LIBFDK_AAC,libfdk_aac);
 REGISTER_ENCDEC (LIBGSM,libgsm);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cdc8aa1..48e212f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2851,6 +2851,7 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_DTS_96_24   40
 #define FF_PROFILE_DTS_HD_HRA  50
 #define FF_PROFILE_DTS_HD_MA   60
+#define FF_PROFILE_DTS_EXPRESS 70
 
 #define FF_PROFILE_MPEG2_4220
 #define FF_PROFILE_MPEG2_HIGH   1
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
new file mode 100644
index 000..3dc1d4d
--- /dev/null
+++ b/libavcodec/libdcadec.c
@@ -0,0 +1,168 @@
+/*
+ * libdcadec decoder wrapper
+ * Copyright (C) 2015 Hendrik Leppkes
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include stdbool.h
+#include inttypes.h
+#include dca_context.h
+
+#include libavutil/avassert.h
+#include libavutil/channel_layout.h
+#include libavutil/common.h
+#include libavutil/opt.h
+#include avcodec.h
+#include internal.h
+
+typedef struct DCADecContext {
+struct dcadec_context *ctx;
+} 

Re: [FFmpeg-devel] [PATCH] avcodec: add libdcadec decoder

2015-03-17 Thread Derek Buitenhuis
On 3/17/2015 4:26 PM, James Almer wrote:
 We don't have a generic decorrelate dsp?
 I think there was something in fmtconvert, but libav nuked it for being 
 unused.

Can we not just use a different return format?

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