Monday, August 13, 2012

Install SystemC 2.3.0 in Mint 13/Fedora


Thanks to these tips from http://archive.pfb.no/2010/10/13/systemc-ubuntu-1010/ and http://noxim.sourceforge.net/pub/Noxim_User_Guide.pdf.

Begin borrowed material


Step 0: Prepare.

Obviously, you need to have a compiler. Do this step in case you haven't done so.

$ sudo apt-get install build-essential

Step 1: Download.

Next: register, and download from http://www.systemc.org using your Web browser then unpack it....but the tgz file has wrong extension. Do these steps to unpack the file:

$ mv systemc-2.2.0.tgz systemc-2.3.0.tar
$ tar xvf systemc-2.3.0.tar

In any case, create a build directory and enter into it for the following steps:

$ cd systemc-2.3.0
$ sudo mkdir /usr/local/systemc
$ mkdir objdir
$ cd objdir
$ export CXX=g++
$ sudo ../configure --prefix=/usr/local/systemc CPPFLAGS=-fpermissive

Step 2: Compile

$ make
$ sudo make install
$ make check
$ cd ..
$ rm -rf objdir

The command make check is optional. What is does is to compile SystemC source files to see if the files can run. I strongly suggest that you run it.

Step 3: Tell your compiler where to find SystemC

Since we do not install SystemC with a standard location we need to specifically tell the compiler where to look for the libraries. We do this with an environment variable.

$ export SYSTEMC=/usr/local/systemc/

This, however will disappear on the next login. To permanently add it to your environment, alter ~/.profile or ~/.bash_profile if it exists. For system wide changes, edit /etc/environment. (newline with expression: SYSTEMC_HOME=”/usr/local/systemc/“) To compile a systemC program simply use this expression:

$ g++ -I. -I$SYSTEMC/include -L. -L$SYSTEMC/lib-linux -o OUTFILE INPUT.cpp -lsystemc -lm

End borrowed/adapted material


HOWEVER, version 2.3.0 is not really ready. Any problems...you're on your own, since it's so new. That's why I'm back at 2.2.0.

Tuesday, March 20, 2012

Extracting Pages from PDF

First, install PDFTK on Linux.

Then, do this command:

pdftk foo.pdf cat 2-3 output abstract.pdf dont_ask

Where foo.pdf is the original PDF file, 2-3 is the range of pages (you can type 2-end to extract to EOF), and abstract.pdf is the output PDF file.

Saturday, March 10, 2012

FFMPEG Convert AVI to JPEG

$ ffmpeg -i input.avi -qscale 1 -qcomp 0 file-%03d.jpg


  • qscale[:stream_specifier] q (output,per-stream)’
    • Use fixed quality scale (VBR). The meaning of q is codec-dependent.
    • qscale constant quality buf variable bitrate. n = 1 for best quality, n = 31 for worst quality
  • qcomp compression
    • video quantizer scale compression (VBR) (default 0.5). Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
  • qblur blur
    • video quantizer scale blur (VBR) (range 0.0 - 1.0)
    • Previously tested with qblur option of 0 and 1, and outputs were exactly the same

Friday, March 9, 2012

Converting HD720 to 320x240

$ ffmpeg -i input.avi -vcodec huffyuv -vf "crop:960;720:0:0" -y intermediate.avi
$ ffmpeg -i intermediate.avi -vcodec libx264 -s qvga -y output.m4v

HuffYUV is a lossless codec. From Wikipedia:

Huffyuv (or HuffYUV) is a lossless video codec created by Ben Rudiak-Gould which is meant to replace uncompressed YCbCr as a video capture format.

Despite the "YUV" in the name, it does not compress the YUV color space, but YCbCr.[citation needed] The codec can also compress in the RGB color space.



-vf "..." replaces -croptop, -cropbottom, -padtop, -padbottom etc of older versions of FFMPEG