Re: [FFmpeg-devel] libavutil: added camellia block cipher
Hello, I have modified the LR128 function slightly to make it more compact. Thanks, Supraja On Wed, Dec 31, 2014 at 9:53 PM, supraja reddy supraja0...@gmail.com wrote: Hello, I have made the following changes. create mode 100644 libavutil/camellia.h Missing changelog entry. I have updated the changelog. I had earlier ignored this because i also had to update changelog for cast128 cbc mode and wanted to do both together. We don't need it in this case, but this will probably not work with x=64 or x=128. Also, please move this function after the sboxes. Fixed the function , but I was wondering if we need to do this , apart from writing a complete function, since anyways there won't be any case at all with x=64 or x=128 . +Zl = (F_IN 32) ^ (KE 32); +Zr = (F_IN MASK32) ^ (KE MASK32); Use: KE ^= F_IN; Zl = KE 32; Zr = KE MASK32; as Michael suggested. Sorry about this. I had overlooked this change. Changed accordingly in the code. Nit: unneeded space before i = + Nit: you can delete this blank line Fixed the above two changes. Please move camellia_decrypt() after camellia_encrypt(). Changed accordingly. Why not use only one vector, rpt[32], instead of rpt and rpt2? Fixed this and temp variable. +av_camellia_init(cs, Key[2], 256); +av_camellia_crypt(cs, temp2, rpt2, 2, NULL, 0); +av_camellia_crypt(cs, temp2, temp2, 2, NULL, 1); +for (i = 0; i 32; i++) { +if (rpt2[i] != temp2[i]) { +av_log(NULL, AV_LOG_ERROR, %d %02x %02x\n, i, rpt2[i], temp2[i]); +err = 1; +} +} You are testing ECB again with a longer pt here, is it not redundant or am I missing something? This was an extra test case which I forgot to remove. Removed it . Also fixed the blank lines in camellia.h Please let me know if there are any further changes with the updated patch . Thanks, Supraja From c8e7f6173102435bd788c0501d667e052d4f42ba Mon Sep 17 00:00:00 2001 From: Supraja Meedinti supraja0...@gmail.com Date: Wed, 31 Dec 2014 21:50:18 +0530 Subject: [PATCH] libavutil: Added Camellia symmetric block cipher Signed-off-by: Supraja Meedinti supraja0...@gmail.com --- Changelog| 1 + libavutil/Makefile | 3 + libavutil/camellia.c | 458 +++ libavutil/camellia.h | 70 4 files changed, 532 insertions(+) create mode 100644 libavutil/camellia.c create mode 100644 libavutil/camellia.h diff --git a/Changelog b/Changelog index 37ce0f0..ca4695f 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,7 @@ version next: - RTP/mpegts muxer - non continuous cache protocol support - tblend filter +- Camellia symmetric block cipher version 2.5: diff --git a/libavutil/Makefile b/libavutil/Makefile index c1aa8aa..4db89b8 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -16,6 +16,7 @@ HEADERS = adler32.h \ bswap.h \ buffer.h \ cast5.h \ + camellia.h\ channel_layout.h \ common.h \ cpu.h \ @@ -84,6 +85,7 @@ OBJS = adler32.o\ bprint.o \ buffer.o \ cast5.o \ + camellia.o \ channel_layout.o \ cpu.o\ crc.o\ @@ -154,6 +156,7 @@ TESTPROGS = adler32 \ blowfish\ bprint \ cast5 \ +camellia\ cpu \ crc \ des \ diff --git a/libavutil/camellia.c b/libavutil/camellia.c new file mode 100644 index 000..fcbf970 --- /dev/null +++ b/libavutil/camellia.c @@ -0,0 +1,458 @@ +/* + * An implementation of the CAMELLIA algorithm as mentioned in
Re: [FFmpeg-devel] libavutil: added camellia block cipher
On Fri, Jan 02, 2015 at 02:03:05PM +0530, supraja reddy wrote: Hello, I have modified the LR128 function slightly to make it more compact. Thanks, Supraja On Wed, Dec 31, 2014 at 9:53 PM, supraja reddy supraja0...@gmail.com wrote: Hello, I have made the following changes. create mode 100644 libavutil/camellia.h Missing changelog entry. I have updated the changelog. I had earlier ignored this because i also had to update changelog for cast128 cbc mode and wanted to do both together. We don't need it in this case, but this will probably not work with x=64 or x=128. Also, please move this function after the sboxes. Fixed the function , but I was wondering if we need to do this , apart from writing a complete function, since anyways there won't be any case at all with x=64 or x=128 . +Zl = (F_IN 32) ^ (KE 32); +Zr = (F_IN MASK32) ^ (KE MASK32); Use: KE ^= F_IN; Zl = KE 32; Zr = KE MASK32; as Michael suggested. Sorry about this. I had overlooked this change. Changed accordingly in the code. Nit: unneeded space before i = + Nit: you can delete this blank line Fixed the above two changes. Please move camellia_decrypt() after camellia_encrypt(). Changed accordingly. Why not use only one vector, rpt[32], instead of rpt and rpt2? Fixed this and temp variable. +av_camellia_init(cs, Key[2], 256); +av_camellia_crypt(cs, temp2, rpt2, 2, NULL, 0); +av_camellia_crypt(cs, temp2, temp2, 2, NULL, 1); +for (i = 0; i 32; i++) { +if (rpt2[i] != temp2[i]) { +av_log(NULL, AV_LOG_ERROR, %d %02x %02x\n, i, rpt2[i], temp2[i]); +err = 1; +} +} You are testing ECB again with a longer pt here, is it not redundant or am I missing something? This was an extra test case which I forgot to remove. Removed it . Also fixed the blank lines in camellia.h Please let me know if there are any further changes with the updated patch . Thanks, Supraja Changelog|1 libavutil/Makefile |3 libavutil/camellia.c | 458 +++ libavutil/camellia.h | 70 +++ 4 files changed, 532 insertions(+) dc4da200e97aed4922c5b42d25c1b6494fbe8069 camellia7.patch From c8e7f6173102435bd788c0501d667e052d4f42ba Mon Sep 17 00:00:00 2001 From: Supraja Meedinti supraja0...@gmail.com Date: Wed, 31 Dec 2014 21:50:18 +0530 Subject: [PATCH] libavutil: Added Camellia symmetric block cipher i assume giorgio is ok with the patch as he previously said rest LGTM so applied maybe you can add a fate test for it thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] doc/ffmpeg: mention both ffpreset/avpreset in documentation, remove superfluous example
ffmpeg looks for both .ffpreset and .avpreset files depending on whether the -[avsf]pre or -pre option is used. Added two sections for each type of preset including the rules according to which files are searched. (Notably, the lookup order is swapped for avpreset files, because it first looks for codec_arg.avpreset and then for arg.avpreset.) This removes the section explaining -pre only, which was under Examples, where it did not really make sense. Signed-off-by: Werner Robitza werner.robi...@gmail.com --- doc/ffmpeg.texi | 40 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 6de5004..396c623 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1214,7 +1214,10 @@ awkward to specify on the command line. Lines starting with the hash ('#') character are ignored and are used to provide comments. Check the @file{presets} directory in the FFmpeg source tree for examples. -Preset files are specified with the @code{vpre}, @code{apre}, +There are two types of preset files: ffpreset and avpreset files. + +@subsection ffpreset files +ffpreset files are specified with the @code{vpre}, @code{apre}, @code{spre}, and @code{fpre} options. The @code{fpre} option takes the filename of the preset instead of a preset name as input and can be used for any kind of codec. For the @code{vpre}, @code{apre}, and @@ -1239,6 +1242,26 @@ directories, where @var{codec_name} is the name of the codec to which the preset file options will be applied. For example, if you select the video codec with @code{-vcodec libvpx} and use @code{-vpre 1080p}, then it will search for the file @file{libvpx-1080p.ffpreset}. + +@subsection avpreset files +avpreset files are specified with the @code{pre} option. They work similar to +ffpreset files, but they only allow encoder- specific options. Therefore, an +@var{option}=@var{value} pair specifying an encoder cannot be used. + +When the @code{pre} option is specified, ffmpeg will look for files with the +suffix .avpreset in the directories @file{$AVCONV_DATADIR} (if set), and +@file{$HOME/.avconv}, and in the datadir defined at configuration time (usually +@file{PREFIX/share/ffmpeg}), in that order. + +First ffmpeg searches for a file named @var{codec_name}-@var{arg}.avpreset in +the above-mentioned directories, where @var{codec_name} is the name of the codec +to which the preset file options will be applied. For example, if you select the +video codec with @code{-vcodec libvpx} and use @code{-pre 1080p}, then it will +search for the file @file{libvpx-1080p.avpreset}. + +If no such file is found, then ffmpeg will search for a file named +@var{arg}.avpreset in the same directories. + @c man end OPTIONS @chapter Tips @@ -1285,21 +1308,6 @@ quality). @chapter Examples @c man begin EXAMPLES -@section Preset files - -A preset file contains a sequence of @var{option=value} pairs, one for -each line, specifying a sequence of options which can be specified also on -the command line. Lines starting with the hash ('#') character are ignored and -are used to provide comments. Empty lines are also ignored. Check the -@file{presets} directory in the FFmpeg source tree for examples. - -Preset files are specified with the @code{pre} option, this option takes a -preset name as input. FFmpeg searches for a file named @var{preset_name}.avpreset in -the directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in -the data directory defined at configuration time (usually @file{$PREFIX/share/ffmpeg}) -in that order. For example, if the argument is @code{libx264-max}, it will -search for the file @file{libx264-max.avpreset}. - @section Video and Audio grabbing If you specify the input format and device then ffmpeg can grab video -- 1.9.3 (Apple Git-50) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Changelog: Add cropdetect non 8bpp
On Thu, Jan 01, 2015 at 10:25:00AM +0100, Reimar Döffinger wrote: On Thu, Jan 01, 2015 at 03:34:15AM +0100, Michael Niedermayer wrote: Suggested-by: Reimar Signed-off-by: Michael Niedermayer michae...@gmx.at --- Changelog |1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 37ce0f0..e9d8355 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,7 @@ version next: - RTP/mpegts muxer - non continuous cache protocol support - tblend filter +- cropdetect support for non 8bpp with both aboslute and relative (0.0-1.0) threshold abSOlute. Also I now realized I misread your patch, the old behaviour should be unchanged. I would maybe write absolute (if limit = 1) and relative (if limit 1.0) threshold to make the sudden behaviour change at 1.0 more explicit. changed But it's good and my main concern was addressed by simply reading your original patch correctly anyway :) applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg mention both ffpreset/avpreset in documentation, remove superfluous example
On Fri, Jan 02, 2015 at 11:13:29AM +0100, Werner Robitza wrote: On Fri, Jan 2, 2015 at 12:13 AM, Michael Niedermayer michae...@gmx.at wrote: its not as simple, -pre uses .avpreset and -apre/-fpre/-vpre/-spre uses ffpreset they work differently, avpreset only allows encoder options so for example you cannot put vcodec=libvpx in it New patch on the way. (By the way, should I use in-reply-to or do you want separate threads for new patches? The developer doc doesn't say.) as far as iam concerned, whatever you prefer [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] how to add configuration option to ffmepg
Hi, dear ffmpeg developer, below is a peace of code in libx264.c. static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx-priv_data; int sw,sh; if (avctx-global_quality 0) av_log(avctx, AV_LOG_WARNING, -qscale is ignored, -crf is recommended.\n); #if HAVE_STUDY //my study code. #endif x264_param_default(x4-params); x4-params.b_deblocking_filter = avctx-flags CODEC_FLAG_LOOP_FILTER; .. } I want to add some of my code which control by HAVE_STUDY micro, I hope that it is close by default, and when I configure the ffmpeg with --enable-study option, the HAVE_STUDY is true, how can I reach this aim? can someone kindly help me? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/ffmpeg mention both ffpreset/avpreset in documentation, remove superfluous example
On Fri, Jan 2, 2015 at 12:13 AM, Michael Niedermayer michae...@gmx.at wrote: its not as simple, -pre uses .avpreset and -apre/-fpre/-vpre/-spre uses ffpreset they work differently, avpreset only allows encoder options so for example you cannot put vcodec=libvpx in it New patch on the way. (By the way, should I use in-reply-to or do you want separate threads for new patches? The developer doc doesn't say.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avformat/mov: move edit list heuristics into mov_build_index()
On Mon, Dec 01, 2014 at 11:10:14PM +0100, Clément Bœsch wrote: From: Clément Bœsch clem...@stupeflix.com mov_read_elst() is now only responsible from storing the table in a data structure; this is consistent with other table readers functions. --- libavformat/isom.h | 10 +-- libavformat/mov.c | 78 +- 2 files changed, 56 insertions(+), 32 deletions(-) Applied -- Clément B. pgpMM4W4ei33n.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avformat/mov: reindent after previous commit
On Mon, Dec 01, 2014 at 11:10:15PM +0100, Clément Bœsch wrote: From: Clément Bœsch clem...@stupeflix.com --- libavformat/mov.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) Applied [...] -- Clément B. pgpmknIC5tBQZ.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavutil: added camellia block cipher
Hello, 2015-01-02 15:17 GMT+01:00 Michael Niedermayer michae...@gmx.at: i assume giorgio is ok with the patch as he previously said rest LGTM so applied thank you Supraja for the good work and thanks Michael for applying the patch. I spotted only minor things, attached some patches from most important to less important. maybe you can add a fate test for it Yes please, a fate test would be nice. Giorgio Vazzana From bdd85f3b5727f0e64f4bbae02c9023b379e50f4c Mon Sep 17 00:00:00 2001 From: Giorgio Vazzana mywin...@gmail.com Date: Fri, 2 Jan 2015 16:33:17 +0100 Subject: [PATCH 1/4] avutil/camellia: fix documentation for av_camellia_crypt() Signed-off-by: Giorgio Vazzana mywin...@gmail.com --- libavutil/camellia.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/camellia.h b/libavutil/camellia.h index fc3b570..e674c9b 100644 --- a/libavutil/camellia.h +++ b/libavutil/camellia.h @@ -58,7 +58,7 @@ int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); * @param ctx an AVCAMELLIA context * @param dst destination array, can be equal to src * @param src source array, can be equal to dst - * @param count number of 8 byte blocks + * @param count number of 16 byte blocks * @paran iv initialization vector for CBC mode, NULL for ECB mode * @param decrypt 0 for encryption, 1 for decryption */ -- 1.7.9.5 From 826b3d152aa13cf462f6be4605bcc1cefae6a79c Mon Sep 17 00:00:00 2001 From: Giorgio Vazzana mywin...@gmail.com Date: Fri, 2 Jan 2015 16:49:12 +0100 Subject: [PATCH 2/4] avutil/camellia: make LR128() more robust Signed-off-by: Giorgio Vazzana mywin...@gmail.com --- libavutil/camellia.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/camellia.c b/libavutil/camellia.c index fcbf970..2e719be 100644 --- a/libavutil/camellia.c +++ b/libavutil/camellia.c @@ -126,14 +126,14 @@ static const uint8_t SBOX4[256] = const int av_camellia_size = sizeof(AVCAMELLIA); -static void LR128(uint64_t* d, uint64_t *K, int x) +static void LR128(uint64_t d[2], const uint64_t K[2], int x) { int i = 0; if (x =64 x 128) { i = 1; x -= 64; } -if (!x || x == 128) { +if (x = 0 || x = 128) { d[0] = K[i]; d[1] = K[!i]; return; -- 1.7.9.5 From 39f8200e5894f23a3d3ee12c699af251e77d5cff Mon Sep 17 00:00:00 2001 From: Giorgio Vazzana mywin...@gmail.com Date: Fri, 2 Jan 2015 16:57:09 +0100 Subject: [PATCH 3/4] avutil/camellia: use K[2] instead of *K in generate_round_keys() Additionally, change parameters order. Signed-off-by: Giorgio Vazzana mywin...@gmail.com --- libavutil/camellia.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/camellia.c b/libavutil/camellia.c index 2e719be..15b63f3 100644 --- a/libavutil/camellia.c +++ b/libavutil/camellia.c @@ -190,7 +190,7 @@ static const uint8_t vars[2][12] = { {3,1,2,3,0,2,1,3,0,1,2,0} }; -static void generate_round_keys(AVCAMELLIA* cs, uint64_t *Ka, uint64_t *Kb, uint64_t *Kl, uint64_t *Kr) +static void generate_round_keys(AVCAMELLIA* cs, uint64_t Kl[2], uint64_t Kr[2], uint64_t Ka[2], uint64_t Kb[2]) { int i; uint64_t *Kd[4], d[2]; @@ -374,7 +374,7 @@ av_cold int av_camellia_init(AVCAMELLIA* cs, const uint8_t *key, int key_bits) Kb[0] = D1; Kb[1] = D2; } -generate_round_keys(cs, Ka, Kb, Kl, Kr); +generate_round_keys(cs, Kl, Kr, Ka, Kb); return 0; } -- 1.7.9.5 From 2ef08a16ff7a5ceadaf83cd3b61908e07fc44d2b Mon Sep 17 00:00:00 2001 From: Giorgio Vazzana mywin...@gmail.com Date: Fri, 2 Jan 2015 17:05:30 +0100 Subject: [PATCH 4/4] avutil/camellia: cosmetic fixes Signed-off-by: Giorgio Vazzana mywin...@gmail.com --- libavutil/camellia.c | 163 +- 1 file changed, 80 insertions(+), 83 deletions(-) diff --git a/libavutil/camellia.c b/libavutil/camellia.c index 15b63f3..7382414 100644 --- a/libavutil/camellia.c +++ b/libavutil/camellia.c @@ -44,84 +44,80 @@ typedef struct AVCAMELLIA { int key_bits; } AVCAMELLIA; -static const uint8_t SBOX1[256] = -{ -112, 130, 44, 236, 179, 39, 192, 229, 228, 133, 87, 53, 234, 12, 174, 65, -35, 239, 107, 147, 69, 25, 165, 33, 237, 14, 79, 78, 29, 101, 146, 189, -134, 184, 175, 143, 124, 235, 31, 206, 62, 48, 220, 95, 94, 197, 11, 26, -166, 225, 57, 202, 213, 71, 93, 61, 217, 1, 90, 214, 81, 86, 108, 77, -139, 13, 154, 102, 251, 204, 176, 45, 116, 18, 43, 32, 240, 177, 132, 153, -223, 76, 203, 194, 52, 126, 118, 5, 109, 183, 169, 49, 209, 23, 4, 215, -20, 88, 58, 97, 222, 27, 17, 28, 50, 15, 156, 22, 83, 24, 242, 34, -254, 68, 207, 178, 195, 181, 122, 145, 36, 8, 232, 168, 96, 252, 105, 80, -170, 208, 160, 125, 161, 137, 98, 151, 84, 91, 30, 149, 224, 255, 100, 210, -16, 196, 0, 72, 163, 247, 117, 219, 138, 3, 230, 218, 9, 63, 221, 148, -135, 92, 131, 2, 205, 74, 144, 51, 115, 103, 246,
Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder
On Wed, Dec 31, 2014 at 07:09:33PM +0530, Anshul wrote: [...] +static void build_parity_table(int *parity_table) +{ +unsigned int byte; +int parity_v; +for (byte = 0; byte = 127; byte++) { +parity_v = av_popcount(byte) 1; +parity_table[byte] = parity_v; +parity_table[byte | 0x80] = !parity_v; +} +} This should not be needed, av_popcount(byte) 1 could be used directly or you could use something like this: (untested) (0x6996 ((byte ^ (byte4)) 15)) 1 the code using the parity stuff does not seem speed critical but maybe iam missing something ? [...] +static void handle_pac( CCaptionSubContext *ctx, uint8_t hi, uint8_t lo ) +{ +static const uint8_t row_map[] = { +11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10 +}; you are having negative values in a unsigned 8bit table i assume either of these is not intended [...] +static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint8_t lo) +{ +int ret = 0; +#define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) ) +if ( hi == ctx-prev_cmd[0] lo == ctx-prev_cmd[1]) { +/* ignore redundant command */ +} else if ( (hi == 0x10 (lo = 0x40 || lo = 0x5f)) || + ( (hi = 0x11 hi = 0x17) (lo = 0x40 lo = 0x7f) ) ) { +handle_pac(ctx, hi, lo); +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x20 ) { +/* resume caption loading */ +ctx-mode = CCMODE_POPON; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x25 ) { +ctx-rollup = 2; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x26 ) { +ctx-rollup = 3; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x27 ) { +ctx-rollup = 4; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x29 ) { +/* resume direct captioning */ +ctx-mode = CCMODE_PAINTON; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2C ) { +/* erase display memory */ +ret = handle_edm(ctx, pts); +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2D ) { +/* carriage return */ +av_log(ctx, AV_LOG_DEBUG,cdp (handle cr)\n); +ctx-row_cnt++; +if(ctx-row_cnt == ctx-rollup) { +ctx-row_cnt = 0; +ret = handle_edm(ctx, pts); +ctx-active_screen = !ctx-active_screen; +} +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2F ) { +/* end of caption */ +ret = handle_eoc(ctx, pts); +} else if (hi=0x20) { +/* Standard characters (always in pairs) */ +handle_char(ctx, hi, lo, pts); +} else { +/* Ignoring all other non data code */ +} + +/* set prev command */ + ctx-prev_cmd[0] = hi; + ctx-prev_cmd[1] = lo; + +#undef COR3 +return ret; + +} +static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt) +{ +CCaptionSubContext *ctx = avctx-priv_data; +AVSubtitle *sub = data; +uint8_t *bptr = avpkt-data; The input packets data is read only unless you do something (dup/memcpy/whatever) so this should be const +int len = avpkt-size; +int ret = 0; +int i; + +for (i = 0; i len; i += 3) { +uint8_t cc_type = *(bptr + i) 3; +if (validate_cc_data_pair( bptr + i, ctx-parity_table ) ) +continue; +/* ignoring data field 1 */ +if(cc_type == 1) +continue; +else +process_cc608(ctx, avpkt-pts, *(bptr + i + 1), *(bptr + i + 2)); +} +if(ctx-erase_display_memory *ctx-buffer.str) +{ +int start_time = av_rescale_q(ctx-start_time, avctx-time_base, (AVRational){ 1, 100 }); +int end_time = av_rescale_q(ctx-end_time, avctx-time_base, (AVRational){ 1, 100 }); + av_log(ctx, AV_LOG_DEBUG,cdp writing data (%s)\n,ctx-buffer.str); tabs, also theres a alot of deug av_logs in the code, it might make sense to remove or disable these before its pushed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 100% positive feedback - All either got their money back or didnt complain Best seller ever, very honest - Seller refunded buyer after failed scam signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] how to add configuration option to ffmepg
On Fri, Jan 02, 2015 at 09:44:10PM +0800, llj wrote: Hi, dear ffmpeg developer, below is a peace of code in libx264.c. static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx-priv_data; int sw,sh; if (avctx-global_quality 0) av_log(avctx, AV_LOG_WARNING, -qscale is ignored, -crf is recommended.\n); #if HAVE_STUDY //my study code. #endif x264_param_default(x4-params); x4-params.b_deblocking_filter = avctx-flags CODEC_FLAG_LOOP_FILTER; .. } I want to add some of my code which control by HAVE_STUDY micro, I hope that it is close by default, and when I configure the ffmpeg with --enable-study option, the HAVE_STUDY is true, how can I reach this aim? can someone kindly help me? look at commits that added other --enable-* options [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavd/v4l2: implement list device callback
On 21 December 2014 at 23:39, Lukasz Marek lukasz.m.lu...@gmail.com wrote: On 21.12.2014 22:43, Lukasz Marek wrote: Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- libavdevice/v4l2.c | 58 ++ 1 file changed, 58 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 2969980..9d4d7ae 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -1006,6 +1006,63 @@ static int v4l2_read_close(AVFormatContext *ctx) return 0; } +static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list) +{ +struct video_data *s = ctx-priv_data; +AVDeviceInfo *device = NULL; +struct v4l2_capability cap; +int i, ret = 0; + +if (!device_list) +return AVERROR(EINVAL); + +for (i = 0; i = 31; i++) { +snprintf(ctx-filename, sizeof(ctx-filename), /dev/video%d, i); I wasn't sure this is correct. I changed this loop to opendir/readdir - similar way v4l-utils does. ping on patchset ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/lavfi: allow to extract subcc.
On Thu, Dec 04, 2014 at 01:37:08PM +0100, Nicolas George wrote: Signed-off-by: Nicolas George geo...@nsup.org --- doc/indevs.texi | 14 libavdevice/lavfi.c | 92 + 2 files changed, 99 insertions(+), 7 deletions(-) Correctly rebased today, with some extra doc. If the decoder is applied before this patch, then we can change the example to output SRT or ASS, this would be even better. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] web/contact: Suggest that patch authors subscribe to ffmpeg-devel
On Thu, 1 Jan 2015 20:54:43 +0100, Michael Niedermayer wrote: --- src/contact |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contact b/src/contact index 130addf..7233806 100644 --- a/src/contact +++ b/src/contact @@ -35,7 +35,8 @@ a class=list-group-item href=https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel/; strongffmpeg-devel/strongbr For discussions involving development of FFmpeg. Patches for FFmpeg should be submitted - here. It is strongnot/strong for development of software that use the FFmpeg libraries + here. Make sure you are subsribed so you will receive comments and reviews for your + patches. It is strongnot/strong for development of software that use the FFmpeg libraries and strongnot/strong for bug reports unless you are submitting a patch that fixes the problem. /a LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavutil: added camellia block cipher
On Fri, Jan 02, 2015 at 05:13:33PM +0100, Giorgio Vazzana wrote: Hello, 2015-01-02 15:17 GMT+01:00 Michael Niedermayer michae...@gmx.at: i assume giorgio is ok with the patch as he previously said rest LGTM so applied thank you Supraja for the good work and thanks Michael for applying the patch. I spotted only minor things, attached some patches from most important to less important. patches applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange 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] cmdutils: use helper functions for listing sinks/sources
On 21 December 2014 at 21:04, Lukasz Marek lukasz.m.lu...@gmail.com wrote: List device callback must be able to return valid list without opening device. This callback should return input values for open function, not vice-versa. Read header funtion is very likey to fail without proper configuration provided. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- cmdutils.c | 27 ++- 1 file changed, 2 insertions(+), 25 deletions(-) ping on patchset ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder
On 01/03/2015 01:42 AM, Michael Niedermayer wrote: On Wed, Dec 31, 2014 at 07:09:33PM +0530, Anshul wrote: [...] +static void build_parity_table(int *parity_table) +{ +unsigned int byte; +int parity_v; +for (byte = 0; byte = 127; byte++) { +parity_v = av_popcount(byte) 1; +parity_table[byte] = parity_v; +parity_table[byte | 0x80] = !parity_v; +} +} This should not be needed, av_popcount(byte) 1 could be used directly or you could use something like this: (untested) (0x6996 ((byte ^ (byte4)) 15)) 1 the code using the parity stuff does not seem speed critical but maybe iam missing something ? parity is checked for each byte of data in closed caption, so I thought it would be speed critical. only 7 bits are used in each byte. 1 bit is fr parity. [...] +static void handle_pac( CCaptionSubContext *ctx, uint8_t hi, uint8_t lo ) +{ +static const uint8_t row_map[] = { +11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10 +}; you are having negative values in a unsigned 8bit table i assume either of these is not intended done, -1 was needed. changed uint8_t to int8_t [...] +static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint8_t lo) +{ +int ret = 0; +#define COR3(var, with1, with2, with3) ( (var) == (with1) || (var) == (with2) || (var) == (with3) ) +if ( hi == ctx-prev_cmd[0] lo == ctx-prev_cmd[1]) { +/* ignore redundant command */ +} else if ( (hi == 0x10 (lo = 0x40 || lo = 0x5f)) || + ( (hi = 0x11 hi = 0x17) (lo = 0x40 lo = 0x7f) ) ) { +handle_pac(ctx, hi, lo); +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x20 ) { +/* resume caption loading */ +ctx-mode = CCMODE_POPON; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x25 ) { +ctx-rollup = 2; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x26 ) { +ctx-rollup = 3; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x27 ) { +ctx-rollup = 4; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x29 ) { +/* resume direct captioning */ +ctx-mode = CCMODE_PAINTON; +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2C ) { +/* erase display memory */ +ret = handle_edm(ctx, pts); +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2D ) { +/* carriage return */ +av_log(ctx, AV_LOG_DEBUG,cdp (handle cr)\n); +ctx-row_cnt++; +if(ctx-row_cnt == ctx-rollup) { +ctx-row_cnt = 0; +ret = handle_edm(ctx, pts); +ctx-active_screen = !ctx-active_screen; +} +} else if ( COR3(hi, 0x14, 0x15, 0x1C) lo == 0x2F ) { +/* end of caption */ +ret = handle_eoc(ctx, pts); +} else if (hi=0x20) { +/* Standard characters (always in pairs) */ +handle_char(ctx, hi, lo, pts); +} else { +/* Ignoring all other non data code */ +} + +/* set prev command */ + ctx-prev_cmd[0] = hi; + ctx-prev_cmd[1] = lo; + +#undef COR3 +return ret; + +} +static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt) +{ +CCaptionSubContext *ctx = avctx-priv_data; +AVSubtitle *sub = data; +uint8_t *bptr = avpkt-data; The input packets data is read only unless you do something (dup/memcpy/whatever) so this should be const copied data in AVbufferRef. +int len = avpkt-size; +int ret = 0; +int i; + +for (i = 0; i len; i += 3) { +uint8_t cc_type = *(bptr + i) 3; +if (validate_cc_data_pair( bptr + i, ctx-parity_table ) ) +continue; +/* ignoring data field 1 */ +if(cc_type == 1) +continue; +else +process_cc608(ctx, avpkt-pts, *(bptr + i + 1), *(bptr + i + 2)); +} +if(ctx-erase_display_memory *ctx-buffer.str) +{ +int start_time = av_rescale_q(ctx-start_time, avctx-time_base, (AVRational){ 1, 100 }); +int end_time = av_rescale_q(ctx-end_time, avctx-time_base, (AVRational){ 1, 100 }); +av_log(ctx, AV_LOG_DEBUG,cdp writing data (%s)\n,ctx-buffer.str); tabs, also theres a alot of deug av_logs in the code, it might make sense to remove or disable these before its pushed most of the logs I have removed, others I have disabled. I have attached 2 pacth 1 improvement of this other is info regarding 1st one. -Anshul From 17a564409b84fc18293833cc3f2151792209bb8b Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari anshul.ffm...@gmail.com Date: Sat, 3 Jan 2015 12:40:35 +0530 Subject: [PATCH 1/2] Adding Closed caption Support Signed-off-by: Anshul Maheshwari anshul.ffm...@gmail.com To test Closed caption use following command /ffmpeg -f lavfi -i movie=/home/a141982112/test_videos/Starship_Troopers.vob[out0+subcc] -map s some.srt --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c| 1 + libavcodec/ccaption_dec.c | 361
Re: [FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources
On Sat, Jan 03, 2015 at 04:45:56AM +0100, Lukasz Marek wrote: On 21 December 2014 at 21:04, Lukasz Marek lukasz.m.lu...@gmail.com wrote: List device callback must be able to return valid list without opening device. This callback should return input values for open function, not vice-versa. Read header funtion is very likey to fail without proper configuration provided. Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com --- cmdutils.c | 27 ++- 1 file changed, 2 insertions(+), 25 deletions(-) ping on patchset in absence of other comments, i think these 2 patches should be ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel