Re: [FFmpeg-soc] [PATCH] updated! vf_overlay alpha patch and watermarking using PNG with alpha

2009-12-01 Thread Artur Bodera
On Tue, Dec 1, 2009 at 12:50 AM, Vitor Sessak vitor1...@gmail.com wrote:


 While I normally oppose making non-committed code more complex, I think
 this feature is so often requested that it is worth the extra work in the
 future. Stefano, Michael, any strong opinion about this?


I think the vf_overlay should be modified altogether. Although
mathematically alpha-blending is more expensive than opaque pixel
replacement, I think that it should be automatically decided by analyzing
the overlay format.

So the alpha-blending should be a built-in functionality (not a switchable
parameter) and should be implicitly functional with any overlay stream/image
that has alpha channel (i.e. rgba). If there is no alpha channel, then pixel
overriding would be used. This makes much more sense.

This would also help keep the code clean!


Because the whole overlay concept is very universal, there is no need for
vf_logo or any other strange mockup. You can implement all the vf_logo
functionality with overlay+scale. As a convenience, a mockup vf_logo could
be built - which would just be a shortcut for automatically splitting and
inserting vf_overlay in the right spot (just like scale or format filter is
inserted automatically). This would mean the core code is still in
vf_overlay and is easier to maintain in the long run.


Arthur.

-- 

 __
/.)\   +48 695 600 936
\(./   abod...@gmail.com
___
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc


[FFmpeg-soc] [soc]: r5475 - aac-sbr/aacsbr.c

2009-12-01 Thread alexc
Author: alexc
Date: Tue Dec  1 21:42:18 2009
New Revision: 5475

Log:
Remove some unsigned type qualifiers. They make comparisons to negative values
not work as needed and no integer divides are used on these values.

Modified:
   aac-sbr/aacsbr.c

Modified: aac-sbr/aacsbr.c
==
--- aac-sbr/aacsbr.cMon Nov 30 20:14:48 2009(r5474)
+++ aac-sbr/aacsbr.cTue Dec  1 21:42:18 2009(r5475)
@@ -841,10 +841,10 @@ int ff_decode_sbr_extension(AACContext *
 static int sbr_time_freq_grid(AACContext *ac, SpectralBandReplication *sbr,
   SBRData *ch_data, int ch)
 {
-unsigned int abs_bord_lead  =  ch_data-bs_frame_class = 2 ? 
ch_data-bs_var_bord[0] : 0;
+int abs_bord_lead  =  ch_data-bs_frame_class = 2 ? 
ch_data-bs_var_bord[0] : 0;
 // frameLengthFlag ? 15 : 16; 960 sample length frames unsupported; this 
value is numTimeSlots
-unsigned int abs_bord_trail = (ch_data-bs_frame_class  1 ? 
ch_data-bs_var_bord[1] : 0) + 16;
-unsigned int n_rel_lead, n_rel_trail;
+int abs_bord_trail = (ch_data-bs_frame_class  1 ? 
ch_data-bs_var_bord[1] : 0) + 16;
+int n_rel_lead, n_rel_trail;
 int i;
 
 if (ch_data-bs_frame_class == FIXFIX) {
___
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc


[FFmpeg-soc] [soc]: r5476 - in aac-sbr: aacsbr.c aacsbr.h

2009-12-01 Thread alexc
Author: alexc
Date: Tue Dec  1 21:42:20 2009
New Revision: 5476

Log:
Move SBR synthesis filterbank sample buffer from the local stack to the SBRData 
context.

Modified:
   aac-sbr/aacsbr.c
   aac-sbr/aacsbr.h

Modified: aac-sbr/aacsbr.c
==
--- aac-sbr/aacsbr.cTue Dec  1 21:42:18 2009(r5475)
+++ aac-sbr/aacsbr.cTue Dec  1 21:42:20 2009(r5476)
@@ -1033,10 +1033,10 @@ static void sbr_qmf_analysis(const float
 // Synthesis QMF Bank (14496-3 sp04 p206)
 // Downsampled Synthesis QMF Bank (14496-3 sp04 p206)
 static void sbr_qmf_synthesis(float *out, const float **X,
-  const unsigned int div)
+  float *v, const unsigned int div)
 {
 int k, l, n;
-float v[1280], w[640];
+float w[640];
 for (l = 0; l  32; l++) {
 memmove(v[128 / div], v, (1280 - 128) / div * sizeof(float));
 for (n = 0; n  128 / div; n++) {

Modified: aac-sbr/aacsbr.h
==
--- aac-sbr/aacsbr.hTue Dec  1 21:42:18 2009(r5475)
+++ aac-sbr/aacsbr.hTue Dec  1 21:42:20 2009(r5476)
@@ -101,6 +101,7 @@ typedef struct {
 uint32_t   bs_data_noise[2][5];
 uint8_tbs_add_harmonic[32];
 uint8_tbs_amp_res;
+float  synthesis_filterbank_samples[1280];
 } SBRData;
 
 /**
___
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc


[FFmpeg-soc] [soc]: r5477 - in aac-sbr: aacsbr.c aacsbr.h

2009-12-01 Thread alexc
Author: alexc
Date: Tue Dec  1 21:42:22 2009
New Revision: 5477

Log:
Don't read past the end of the input frame. Create an SBR analysis filterbank
sample buffer in the SBRData context.

Modified:
   aac-sbr/aacsbr.c
   aac-sbr/aacsbr.h

Modified: aac-sbr/aacsbr.c
==
--- aac-sbr/aacsbr.cTue Dec  1 21:42:20 2009(r5476)
+++ aac-sbr/aacsbr.cTue Dec  1 21:42:22 2009(r5477)
@@ -1004,9 +1004,11 @@ static void sbr_dequant(SpectralBandRepl
  * @param   x   pointer to the beginning of the first sample window
  * @param   W   array of complex-valued samples split into subbands
  */
-static void sbr_qmf_analysis(const float *x, float W[32][32][2])
+static void sbr_qmf_analysis(const float *in, float *x, float W[32][32][2])
 {
 int i, k, l, n;
+memcpy(x, x+1024, (320-32)*sizeof(x[0]));
+memcpy(x+288, in, 1024*sizeof(x[0]));
 x += 319;
 for (l = 0; l  32; l++) { // 32 = numTimeSlots*RATE = 16*2 as 960 sample 
frames are not supported
 float z[320], u[64];

Modified: aac-sbr/aacsbr.h
==
--- aac-sbr/aacsbr.hTue Dec  1 21:42:20 2009(r5476)
+++ aac-sbr/aacsbr.hTue Dec  1 21:42:22 2009(r5477)
@@ -102,6 +102,7 @@ typedef struct {
 uint8_tbs_add_harmonic[32];
 uint8_tbs_amp_res;
 float  synthesis_filterbank_samples[1280];
+float  analysis_filterbank_samples [1312];
 } SBRData;
 
 /**
___
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc


[FFmpeg-soc] [soc]: r5478 - aac-sbr/aacsbr.c

2009-12-01 Thread alexc
Author: alexc
Date: Tue Dec  1 21:42:24 2009
New Revision: 5478

Log:
Fix SBR output scaling

Modified:
   aac-sbr/aacsbr.c

Modified: aac-sbr/aacsbr.c
==
--- aac-sbr/aacsbr.cTue Dec  1 21:42:22 2009(r5477)
+++ aac-sbr/aacsbr.cTue Dec  1 21:42:24 2009(r5478)
@@ -1046,7 +1046,7 @@ static void sbr_qmf_synthesis(float *out
 for (k = 1; k  64 / div; k++) {
 v[n] += X[k][l] * cosf((k + 0.5f) * (2.0f * n - 255.0f / div) 
* M_PI / (128.0f / div));
 }
-v[n] /= 64.0f * 64 / div;
+v[n] /= 64.0f / div;
 }
 for (n = 0; n = 4; n++) {
 int temp1 = 128 / div * n, temp2 = temp1  1;
___
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc


[FFmpeg-soc] [PATCH]aacsbr: Add the ff_sbr_apply() function

2009-12-01 Thread Alex Converse
Should this be split more?

I left out the half of this patch that wires this into aac.c since
that is still ugly.

This also doesn't yet handle downsampled SBR and is only tested with
SBR in pure upsampling mode. Still it decodes al_sbr_qmf_* perfectly.

With this commit I'd also like to add myself to the copyright.
From 41bb8f8efff6ca7c8dd68f07a0ee0e70d5476fd3 Mon Sep 17 00:00:00 2001
From: Alex Converse alex.conve...@gmail.com
Date: Tue, 1 Dec 2009 15:52:03 -0500
Subject: [PATCH 1/4] Add the ff_sbr_apply() function.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 aacsbr.c  |  132 ++---
 aacsbr.h  |   12 -
 aacsbr_internal.h |1 +
 3 files changed, 116 insertions(+), 29 deletions(-)


--1
Content-Type: text/x-patch; name=0001-Add-the-ff_sbr_apply-function.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-Add-the-ff_sbr_apply-function.patch

diff --git a/aacsbr.c b/aacsbr.c
index 1cec490..a26aafe 100644
--- a/aacsbr.c
+++ b/aacsbr.c
@@ -422,7 +422,9 @@ static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
 
 memcpy(sbr-f_tablehigh, sbr-f_master[sbr-spectrum_params[1].bs_xover_band],
(sbr-n[1] + 1) * sizeof(sbr-f_master[0]));
+sbr-mold = sbr-m;
 sbr-m= sbr-f_tablehigh[sbr-n[1]] - sbr-f_tablehigh[0];
+sbr-k[4] = sbr-k[3];
 sbr-k[3] = sbr-f_tablehigh[0];
 
 // Requirements (14496-3 sp04 p205)
@@ -860,6 +862,7 @@ static int sbr_time_freq_grid(AACContext *ac, SpectralBandReplication *sbr,
 
 n_rel_trail = ch_data-bs_frame_class  1 ? ch_data-bs_num_rel[1] : 0;
 
+sbr-t_env_num_env_old[ch] = sbr-t_env[ch][ch_data-bs_num_env[0]]; //FIXME move me into a setup next frame area
 sbr-t_env[ch][0]  = abs_bord_lead;
 sbr-t_env[ch][ch_data-bs_num_env[1]] = abs_bord_trail;
 
@@ -1004,9 +1007,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac, int ch)
  * @param   x   pointer to the beginning of the first sample window
  * @param   W   array of complex-valued samples split into subbands
  */
-static void sbr_qmf_analysis(const float *in, float *x, float W[32][32][2])
+static void sbr_qmf_analysis(const float *in, float *x, float W[2][32][32][2])
 {
 int i, k, l, n;
+memcpy(W[1], W[0], sizeof(W[0]));
 memcpy(x, x+1024, (320-32)*sizeof(x[0]));
 memcpy(x+288, in, 1024*sizeof(x[0]));
 x += 319;
@@ -1019,13 +1023,13 @@ static void sbr_qmf_analysis(const float *in, float *x, float W[32][32][2])
 for (k = 0; k  32; k++) {
 float temp1 = u[0] * 2.0f;
 float temp2 = -(k + 0.5f) * M_PI / 128.0f;
-W[k][l][0] = temp1 * cosf(temp2);
-W[k][l][1] = temp1 * sinf(temp2);
+W[0][k][l][0] = temp1 * cosf(temp2);
+W[0][k][l][1] = temp1 * sinf(temp2);
 for (n = 1; n  64; n++) {
 temp1 = u[n] * 2.0f;
 temp2 = (n - 0.25f) * (k + 0.5f) * M_PI / 32.0f;
-W[k][l][0] += temp1 * cosf(temp2);
-W[k][l][1] += temp1 * sinf(temp2);
+W[0][k][l][0] += temp1 * cosf(temp2);
+W[0][k][l][1] += temp1 * sinf(temp2);
 }
 }
 x += 32;
@@ -1034,7 +1038,7 @@ static void sbr_qmf_analysis(const float *in, float *x, float W[32][32][2])
 
 // Synthesis QMF Bank (14496-3 sp04 p206)
 // Downsampled Synthesis QMF Bank (14496-3 sp04 p206)
-static void sbr_qmf_synthesis(float *out, const float **X,
+static void sbr_qmf_synthesis(float *out, float X[64][40][2],
   float *v, const unsigned int div)
 {
 int k, l, n;
@@ -1042,9 +1046,11 @@ static void sbr_qmf_synthesis(float *out, const float **X,
 for (l = 0; l  32; l++) {
 memmove(v[128 / div], v, (1280 - 128) / div * sizeof(float));
 for (n = 0; n  128 / div; n++) {
-v[n] = X[0][l] * cosf((2.0f * n - 255.0f / div) * M_PI / (256.0f / div));
+v[n] = X[0][l][0] * cosf((2.0f * n - 255.0f / div) * M_PI / (256.0f / div)) -
+   X[0][l][1] * sinf((2.0f * n - 255.0f / div) * M_PI / (256.0f / div));
 for (k = 1; k  64 / div; k++) {
-v[n] += X[k][l] * cosf((k + 0.5f) * (2.0f * n - 255.0f / div) * M_PI / (128.0f / div));
+v[n] += X[k][l][0] * cosf((k + 0.5f) * (2.0f * n - 255.0f / div) * M_PI / (128.0f / div)) -
+X[k][l][1] * sinf((k + 0.5f) * (2.0f * n - 255.0f / div) * M_PI / (128.0f / div));
 }
 v[n] /= 64.0f / div;
 }
@@ -1066,8 +1072,8 @@ static void sbr_qmf_synthesis(float *out, const float **X,
 // High Frequency Generation (14496-3 sp04 p214+)
 
 // Inverse Filtering (14496-3 sp04 p214)