Merge pull request #12922 from igsha/dirac

dirac: init at 1.0.2
This commit is contained in:
zimbatm 2016-02-17 10:17:59 +00:00
commit 078e85e0e5
4 changed files with 394 additions and 0 deletions

View file

@ -143,6 +143,7 @@
iand675 = "Ian Duncan <ian@iankduncan.com>";
ianwookim = "Ian-Woo Kim <ianwookim@gmail.com>";
iElectric = "Domen Kozar <domen@dev.si>";
igsha = "Igor Sharonov <igor.sharonov@gmail.com>";
ikervagyok = "Balázs Lengyel <ikervagyok@gmail.com>";
iyzsong = "Song Wenwu <iyzsong@gmail.com>";
j-keck = "Jürgen Keck <jhyphenkeck@gmail.com>";

View file

@ -0,0 +1,29 @@
{ stdenv, fetchurl, doxygen }:
stdenv.mkDerivation rec {
version = "1.0.2";
name = "dirac-${version}";
src = fetchurl {
url = "mirror://sourceforge/dirac/${name}.tar.gz";
sha256 = "1z803yzp17cj69wn11iyb13swqdd9xdzr58dsk6ghpr3ipqicsw1";
};
buildInputs = [ doxygen ];
enableParallelBuilding = true;
patches = [ ./dirac-1.0.2.patch ];
postInstall = ''
# keep only necessary binaries
find $out/bin \( -name '*RGB*' -or -name '*YUV*' -or -name create_dirac_testfile.pl \) -delete
'';
meta = with stdenv.lib; {
homepage = http://sourceforge.net/projects/dirac;
description = "A general-purpose video codec based on wavelets";
platforms = platforms.all;
license = with licenses; [ mpl11 gpl2 lgpl21 ];
maintainer = maintainers.igsha;
};
}

View file

@ -0,0 +1,362 @@
diff -aur dirac-1.0.2/libdirac_byteio/parseunit_byteio.cpp dirac-1.0.2-modif/libdirac_byteio/parseunit_byteio.cpp
--- dirac-1.0.2/libdirac_byteio/parseunit_byteio.cpp 2008-05-02 09:57:19.000000000 +0400
+++ dirac-1.0.2-modif/libdirac_byteio/parseunit_byteio.cpp 2016-02-10 19:39:09.838443767 +0300
@@ -124,12 +124,9 @@
if(prefix==PU_PREFIX)
{
- unsigned char next_parse_code;
-
- next_parse_code = InputUnByte();
+ (void)InputUnByte();
// input next unit parse-offsets
- int next_unit_next_parse_offset;
- next_unit_next_parse_offset = ReadUintLit(PU_NEXT_PARSE_OFFSET_SIZE);
+ (void)ReadUintLit(PU_NEXT_PARSE_OFFSET_SIZE);
int next_unit_previous_parse_offset;
next_unit_previous_parse_offset = ReadUintLit(PU_PREVIOUS_PARSE_OFFSET_SIZE);
diff -aur dirac-1.0.2/libdirac_common/mot_comp.cpp dirac-1.0.2-modif/libdirac_common/mot_comp.cpp
--- dirac-1.0.2/libdirac_common/mot_comp.cpp 2008-10-01 05:26:47.000000000 +0400
+++ dirac-1.0.2-modif/libdirac_common/mot_comp.cpp 2016-02-10 19:50:18.453051800 +0300
@@ -1064,10 +1064,10 @@
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
- rmdr.x * (2 - rmdr.y), //tr
- (2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr.x) * (2 - rmdr.y)), //tl
+ ValueType(rmdr.x * (2 - rmdr.y)), //tr
+ ValueType((2 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
for(int c = 0, uY = ref_start.y,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen);
@@ -1116,10 +1116,10 @@
const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
- rmdr.x * (4 - rmdr.y), //tr
- (4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((4 - rmdr.x) * (4 - rmdr.y)), //tl
+ ValueType(rmdr.x * (4 - rmdr.y)), //tr
+ ValueType((4 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
diff -aur dirac-1.0.2/libdirac_common/mot_comp_mmx.cpp dirac-1.0.2-modif/libdirac_common/mot_comp_mmx.cpp
--- dirac-1.0.2/libdirac_common/mot_comp_mmx.cpp 2008-01-09 13:50:23.000000000 +0300
+++ dirac-1.0.2-modif/libdirac_common/mot_comp_mmx.cpp 2016-02-10 19:59:51.792793538 +0300
@@ -244,10 +244,10 @@
// We're 2doing bounds checking because we'll fall off the edge of the reference otherwise.
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
- rmdr.x * (2 - rmdr.y), //tr
- (2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr.x) * (2 - rmdr.y)), //tl
+ ValueType(rmdr.x * (2 - rmdr.y)), //tr
+ ValueType((2 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
ValueType act_cols1[4], act_cols2[4];
int uX, uY, c, l;
diff -aur dirac-1.0.2/libdirac_common/mv_codec.cpp dirac-1.0.2-modif/libdirac_common/mv_codec.cpp
--- dirac-1.0.2/libdirac_common/mv_codec.cpp 2008-10-01 05:26:47.000000000 +0400
+++ dirac-1.0.2-modif/libdirac_common/mv_codec.cpp 2016-02-10 19:51:57.634838245 +0300
@@ -159,7 +159,7 @@
// Main code function
void PredModeCodec::DoWorkCode( MvData& in_data )
{
- int step,max;
+ int step;
int split_depth;
for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
@@ -169,7 +169,7 @@
split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
step = 4 >> (split_depth);
- max = (1 << split_depth);
+ //max = (1 << split_depth);
//now do all the block modes and mvs in the mb
for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
@@ -334,7 +334,7 @@
// Main code function
void VectorElementCodec::DoWorkCode( MvData& in_data )
{
- int step,max;
+ int step;
int split_depth;
for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
@@ -344,7 +344,7 @@
split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
step = 4 >> (split_depth);
- max = (1 << split_depth);
+ //max = (1 << split_depth);
//now do all the block modes and mvs in the mb
for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
@@ -500,7 +500,7 @@
// Main code function
void DCCodec::DoWorkCode( MvData& in_data )
{
- int step,max;
+ int step;
int split_depth;
for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
@@ -510,7 +510,7 @@
split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
step = 4 >> (split_depth);
- max = (1 << split_depth);
+ //max = (1 << split_depth);
//now do all the block modes and mvs in the mb
for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
diff -aur dirac-1.0.2/libdirac_common/wavelet_utils.cpp dirac-1.0.2-modif/libdirac_common/wavelet_utils.cpp
--- dirac-1.0.2/libdirac_common/wavelet_utils.cpp 2008-10-20 08:21:02.000000000 +0400
+++ dirac-1.0.2-modif/libdirac_common/wavelet_utils.cpp 2016-02-10 19:58:16.205006445 +0300
@@ -198,7 +198,6 @@
const bool field_coding = encparams.FieldCoding();
const ChromaFormat cformat = pparams.CFormat();
const float cpd = encparams.CPD()*cpd_scale_factor;
- const PictureSort psort = pparams.PicSort();
int xlen, ylen, xl, yl, xp, yp;
float xfreq, yfreq;
diff -aur dirac-1.0.2/libdirac_encoder/picture_compress.cpp dirac-1.0.2-modif/libdirac_encoder/picture_compress.cpp
--- dirac-1.0.2/libdirac_encoder/picture_compress.cpp 2009-01-21 08:20:57.000000000 +0300
+++ dirac-1.0.2-modif/libdirac_encoder/picture_compress.cpp 2016-02-10 20:08:17.935731263 +0300
@@ -413,14 +413,12 @@
const int depth=m_encparams.TransformDepth();
- PicArray* comp_data[3];
CoeffArray* coeff_data[3];
OneDArray<unsigned int>* est_bits[3];
float lambda[3];
// Construction and definition of objects
for (int c=0;c<3;++c){
- comp_data[c] = &my_picture.Data((CompSort) c );
coeff_data[c] = &my_picture.WltData((CompSort) c );
est_bits[c] = new OneDArray<unsigned int>( Range( 1, 3*depth+1 ) );
}// c
diff -aur dirac-1.0.2/libdirac_encoder/quant_chooser.cpp dirac-1.0.2-modif/libdirac_encoder/quant_chooser.cpp
--- dirac-1.0.2/libdirac_encoder/quant_chooser.cpp 2009-01-21 08:22:05.000000000 +0300
+++ dirac-1.0.2-modif/libdirac_encoder/quant_chooser.cpp 2016-02-10 20:15:43.792954708 +0300
@@ -340,7 +340,7 @@
{
for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
{
- if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
+ if ( (int(std::abs(m_coeff_data[j][i]))<<2) >= u_threshold )
can_skip = false;
}
}
@@ -349,13 +349,13 @@
CoeffType QuantChooser::BlockAbsMax( const Subband& node )
{
- int val( 0 );
+ CoeffType val( 0 );
for (int j=node.Yp() ; j<node.Yp()+node.Yl(); ++j)
{
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 , CoeffType(std::abs(m_coeff_data[j][i])) );
}// i
}// j
diff -aur dirac-1.0.2/libdirac_encoder/seq_compress.cpp dirac-1.0.2-modif/libdirac_encoder/seq_compress.cpp
--- dirac-1.0.2/libdirac_encoder/seq_compress.cpp 2008-10-29 05:42:06.000000000 +0300
+++ dirac-1.0.2-modif/libdirac_encoder/seq_compress.cpp 2016-02-10 20:16:24.108885403 +0300
@@ -663,7 +663,6 @@
int FrameSequenceCompressor::CodedToDisplay( const int cnum )
{
- int div;
if (m_L1_sep>0)
{
@@ -672,7 +671,6 @@
return 0;
else if ((cnum-1)% m_L1_sep==0)
{//we have L1 or subsequent I pictures
- div=(cnum-1)/m_L1_sep;
return cnum+m_L1_sep-1;
}
else//we have L2 pictures
diff -aur dirac-1.0.2/libdirac_motionest/me_utils.cpp dirac-1.0.2-modif/libdirac_motionest/me_utils.cpp
--- dirac-1.0.2/libdirac_motionest/me_utils.cpp 2008-10-21 08:55:46.000000000 +0400
+++ dirac-1.0.2-modif/libdirac_motionest/me_utils.cpp 2016-02-10 20:04:40.068175649 +0300
@@ -684,10 +684,10 @@
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
// weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
- rmdr.x * (2 - rmdr.y), //tr
- (2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr.x) * (2 - rmdr.y)), //tl
+ ValueType(rmdr.x * (2 - rmdr.y)), //tr
+ ValueType((2 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
const int refXlen( m_ref_data.LengthX() );
const int refYlen( m_ref_data.LengthY() );
@@ -848,10 +848,10 @@
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
// weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
- rmdr.x * (2 - rmdr.y), //tr
- (2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr.x) * (2 - rmdr.y)), //tl
+ ValueType(rmdr.x * (2 - rmdr.y)), //tr
+ ValueType((2 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
const int refXlen( m_ref_data.LengthX() );
const int refYlen( m_ref_data.LengthY() );
@@ -908,10 +908,10 @@
const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
- rmdr.x * (4 - rmdr.y), //tr
- (4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((4 - rmdr.x) * (4 - rmdr.y)), //tl
+ ValueType(rmdr.x * (4 - rmdr.y)), //tr
+ ValueType((4 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
bool bounds_check( false );
@@ -1039,10 +1039,10 @@
const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
- rmdr.x * (4 - rmdr.y), //tr
- (4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y }; //br
+ const ValueType linear_wts[4] = { ValueType((4 - rmdr.x) * (4 - rmdr.y)), //tl
+ ValueType(rmdr.x * (4 - rmdr.y)), //tr
+ ValueType((4 - rmdr.x) * rmdr.y), //bl
+ ValueType(rmdr.x * rmdr.y) }; //br
bool bounds_check( false );
@@ -1403,10 +1403,10 @@
}
else
{
- const ValueType linear_wts[4] = { (2 - rmdr1.x) * (2 - rmdr1.y), //tl
- rmdr1.x * (2 - rmdr1.y), //tr
- (2 - rmdr1.x) * rmdr1.y, //bl
- rmdr1.x * rmdr1.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr1.x) * (2 - rmdr1.y)), //tl
+ ValueType(rmdr1.x * (2 - rmdr1.y)), //tr
+ ValueType((2 - rmdr1.x) * rmdr1.y), //bl
+ ValueType(rmdr1.x * rmdr1.y) }; //br
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY());
@@ -1513,10 +1513,10 @@
}
else
{
- const ValueType linear_wts[4] = { (2 - rmdr2.x) * (2 - rmdr2.y), //tl
- rmdr2.x * (2 - rmdr2.y), //tr
- (2 - rmdr2.x) * rmdr2.y, //bl
- rmdr2.x * rmdr2.y }; //br
+ const ValueType linear_wts[4] = { ValueType((2 - rmdr2.x) * (2 - rmdr2.y)), //tl
+ ValueType(rmdr2.x * (2 - rmdr2.y)), //tr
+ ValueType((2 - rmdr2.x) * rmdr2.y), //bl
+ ValueType(rmdr2.x * rmdr2.y) }; //br
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
for( int y=dparams.Yl(), ry=ref_start2.y, by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY());
@@ -1564,14 +1564,14 @@
const MVector rmdr2( mv2.x & 3 , mv2.y & 3 );
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts1[4] = { (4 - rmdr1.x) * (4 - rmdr1.y), //tl
- rmdr1.x * (4 - rmdr1.y), //tr
- (4 - rmdr1.x) * rmdr1.y, //bl
- rmdr1.x * rmdr1.y }; //br
- const ValueType linear_wts2[4] = { (4 - rmdr2.x) * (4 - rmdr2.y), //tl
- rmdr2.x * (4 - rmdr2.y), //tr
- (4 - rmdr2.x) * rmdr2.y, //bl
- rmdr2.x * rmdr2.y }; //br
+ const ValueType linear_wts1[4] = { ValueType((4 - rmdr1.x) * (4 - rmdr1.y)), //tl
+ ValueType(rmdr1.x * (4 - rmdr1.y)), //tr
+ ValueType((4 - rmdr1.x) * rmdr1.y), //bl
+ ValueType(rmdr1.x * rmdr1.y) }; //br
+ const ValueType linear_wts2[4] = { ValueType((4 - rmdr2.x) * (4 - rmdr2.y)), //tl
+ ValueType(rmdr2.x * (4 - rmdr2.y)), //tr
+ ValueType((4 - rmdr2.x) * rmdr2.y), //bl
+ ValueType(rmdr2.x * rmdr2.y) }; //br
//Where to start in the upconverted images
const ImageCoords ref_start1( ( dparams.Xp()<<1 ) + roundvec1.x ,( dparams.Yp()<<1 ) + roundvec1.y );
diff -aur dirac-1.0.2/util/conversion/common/bitmap.cpp dirac-1.0.2-modif/util/conversion/common/bitmap.cpp
--- dirac-1.0.2/util/conversion/common/bitmap.cpp 2004-06-30 20:44:52.000000000 +0400
+++ dirac-1.0.2-modif/util/conversion/common/bitmap.cpp 2016-02-10 20:19:58.355494888 +0300
@@ -142,14 +142,9 @@
char signature[2];
int fileSize;
int dataOffset;
- int size;
int planes;
int bitCount;
int compression;
- int imageSize;
- int xPixelsPerM, yPixelsPerM;
- int coloursUsed;
- int coloursImportant;
//Define buffer to read bytes into.
const int bufferSize = 54;
char buffer[bufferSize];
@@ -175,7 +170,7 @@
//Reposition input buffer to skip over extra header data if necessary
//Should check success of operation (see The C++ Stand Lib, Josuttis, p665)
if (dataOffset>54) inbuf.pubseekoff(dataOffset-54, std::ios_base::cur, std::ios_base::in);
- size = read4bytes(buffer+14);
+ (void)read4bytes(buffer+14); // size
w = read4bytes(buffer+18);
h = read4bytes(buffer+22);
if ( fileSize != (dataOffset + height()*lineBufferSize()) ) input.setstate(std::ios::failbit);
@@ -185,11 +180,11 @@
if ( bitCount != 24 ) input.setstate(std::ios::failbit);
compression = read4bytes(buffer+30);
if ( compression != 0 ) input.setstate(std::ios::failbit);
- imageSize = read4bytes(buffer+34);
- xPixelsPerM = read4bytes(buffer+38);
- yPixelsPerM = read4bytes(buffer+42);
- coloursUsed = read4bytes(buffer+46);
- coloursImportant = read4bytes(buffer+50);
+ (void)read4bytes(buffer+34); // imageSize
+ (void)read4bytes(buffer+38); // xPixelsPerM
+ (void)read4bytes(buffer+42); // yPixelsPerM
+ (void)read4bytes(buffer+46); // coloursUsed
+ (void)read4bytes(buffer+50); // coloursImportant
return input; }
} // end namespace dirac_vu

View file

@ -6491,6 +6491,8 @@ let
fltk = fltk13;
};
dirac = callPackage ../development/libraries/dirac { };
directfb = callPackage ../development/libraries/directfb { };
dlib = callPackage ../development/libraries/dlib { };