aboutsummaryrefslogtreecommitdiff
path: root/multimedia/dirac
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/dirac')
-rw-r--r--multimedia/dirac/dirac.SlackBuild4
-rw-r--r--multimedia/dirac/encoder.patch52
-rw-r--r--multimedia/dirac/gcc45.patch42
3 files changed, 98 insertions, 0 deletions
diff --git a/multimedia/dirac/dirac.SlackBuild b/multimedia/dirac/dirac.SlackBuild
index 3007b5b1a034..f1a1187865cb 100644
--- a/multimedia/dirac/dirac.SlackBuild
+++ b/multimedia/dirac/dirac.SlackBuild
@@ -72,6 +72,10 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Apply some upstream patches
+patch -p1 < $CWD/encoder.patch
+patch -p1 < $CWD/gcc45.patch
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
diff --git a/multimedia/dirac/encoder.patch b/multimedia/dirac/encoder.patch
new file mode 100644
index 000000000000..a1b8d9bcb011
--- /dev/null
+++ b/multimedia/dirac/encoder.patch
@@ -0,0 +1,52 @@
+From 88fae6224b54ecf92ac6e3ae5083c3f352adc798 Mon Sep 17 00:00:00 2001
+From: Anuradha Suraparaju <anuradha@hoyle.rd.bbc.co.uk>
+Date: Fri, 17 Apr 2009 17:47:27 +1000
+Subject: [PATCH] Fix uninitialised memory read that causes the encoder to crash when using
+ non-overlapping blocks.
+
+---
+ libdirac_common/mot_comp.cpp | 21 +++++++++++++++------
+ 1 files changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/libdirac_common/mot_comp.cpp b/libdirac_common/mot_comp.cpp
+index aa8d37c..e0ec2ff 100644
+--- a/libdirac_common/mot_comp.cpp
++++ b/libdirac_common/mot_comp.cpp
+@@ -306,6 +306,8 @@ void MotionCompensator::CompensateComponent( Picture* pic ,
+
+ int save_from_row = m_bparams.Ybsep()-m_bparams.Yoffset();
+
++ bool row_overlap = ((m_bparams.Yblen() - m_bparams.Ybsep()) > 0);
++
+ // unpadded picture dimensions
+ const int x_end_data = pic_data_out.FirstX() + std::min(pic_data_out.LengthX(), pic_size.x );
+ const int y_end_data = pic_data_out.FirstY() + std::min(pic_data_out.LengthY(), pic_size.y );
+@@ -489,12 +491,19 @@ void MotionCompensator::CompensateComponent( Picture* pic ,
+ //Increment the block vertical position
+ pos.y += m_bparams.Ybsep();
+
+- // Copy the rows required to motion compensate the next row of block.
+- // This is usually Yblen-Ybsep rows.
+- memmove (pic_data[0], pic_data[save_from_row], (m_bparams.Yblen() - save_from_row)*pic_data.LengthX()*sizeof(ValueType));
+- memset( pic_data[m_bparams.Yblen() - save_from_row], 0, save_from_row*pic_data.LengthX()*sizeof(ValueType) );
+- save_from_row = m_bparams.Ybsep();
+-
++ if (row_overlap)
++ {
++ // Copy the rows required to motion compensate the next row of
++ // blocks. This is usually Yblen-Ybsep rows.
++ memmove (pic_data[0], pic_data[save_from_row], (m_bparams.Yblen() - save_from_row)*pic_data.LengthX()*sizeof(ValueType));
++ memset( pic_data[m_bparams.Yblen() - save_from_row], 0, save_from_row*pic_data.LengthX()*sizeof(ValueType) );
++ save_from_row = m_bparams.Ybsep();
++ }
++ else
++ {
++ // no row overlap. So reset pic_data to 0.
++ memset( pic_data[0], 0, m_bparams.Yblen()*pic_data.LengthX()*sizeof(ValueType) );
++ }
+ }//yblock
+
+ if ( m_add_or_sub == SUBTRACT)
+--
+1.7.0.4
+
diff --git a/multimedia/dirac/gcc45.patch b/multimedia/dirac/gcc45.patch
new file mode 100644
index 000000000000..a26d37a20fd4
--- /dev/null
+++ b/multimedia/dirac/gcc45.patch
@@ -0,0 +1,42 @@
+From c99cf8d2cb1e9e69b464f4df2dcae9f9baab49dc Mon Sep 17 00:00:00 2001
+From: Anuradha Suraparaju <asuraparaju@gmail.com>
+Date: Sun, 9 May 2010 14:04:43 +1000
+Subject: [PATCH] Fixed #2984304. Fix compilation errors reported by gcc 4.5.0.
+
+---
+ libdirac_encoder/quant_chooser.cpp | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libdirac_encoder/quant_chooser.cpp b/libdirac_encoder/quant_chooser.cpp
+index 16ffcb3..7baa129 100644
+--- a/libdirac_encoder/quant_chooser.cpp
++++ b/libdirac_encoder/quant_chooser.cpp
+@@ -333,14 +333,14 @@ void QuantChooser::SelectBestQuant()
+ void QuantChooser::SetSkip( CodeBlock& cblock , const int qidx)
+ {
+ const int u_threshold = dirac_quantiser_lists.QuantFactor4( qidx );
+-
++
+ // Sets the skip flag for a codeblock
+ bool can_skip = true;
+ for (int j=cblock.Ystart(); j<cblock.Yend(); ++j )
+ {
+ for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
+ {
+- if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
++ if ( (static_cast<int>(std::abs(m_coeff_data[j][i]))<<2) >= u_threshold )
+ can_skip = false;
+ }
+ }
+@@ -355,7 +355,7 @@ CoeffType QuantChooser::BlockAbsMax( const Subband& node )
+ {
+ for (int i=node.Xp() ; i<node.Xp()+node.Xl(); ++i)
+ {
+- val = std::max( val , std::abs(m_coeff_data[j][i]) );
++ val = std::max( val , static_cast<int>(std::abs(m_coeff_data[j][i])) );
+ }// i
+ }// j
+
+--
+1.7.0.4
+