1. I think I understood what is giving you segmentation fault. The mask that I am creating is going out of bounds for the boundary pixels. I will try to fix it. But, I am curious why is it working on my laptop? 2. Thank you Clement for the mode part. It made the code look smaller. Also, I chose numbers instead of alphabets because I was initially accessing the required values by considering the numbers as indices of a matrix. If you want, I can convert it to alphabets instead. 3. I think 4x can be done fast enough, but 3x will take time. 4. I tried reading the hqx code, I am not very sure with what they have done in init part. It will be grateful if you can maybe explain the algorithm or maybe provide me with a link which explicitly explains it.
On Sun, Oct 26, 2014 at 8:44 PM, Clément Bœsch <u...@pkh.me> wrote: > On Sun, Oct 26, 2014 at 02:51:48PM +0530, arwa arif wrote: > [...] > > +/** > > +* Mixes a pixel A, with pixel B, with B's transperancy set to 'a' > > +* In other words, A is a solid color (bottom) and B is a transparent > color (top) > > +**/ > > +static int mix(AVFrame *in,int x1,int y1,int x2,int y2,int a,int mode){ > > > + /*If red color*/ > > + int col1,col2; > > + if(mode==0){ > > + col1 = *(in->data[0] + y1 * in->linesize[0] + x1*3); > > + col2 = *(in->data[0] + y2 * in->linesize[0] + x2*3); > > + } > > + > > + /*If green color*/ > > + else if(mode==1){ > > + col1 = *(in->data[0] + y1 * in->linesize[0] + x1*3 + 1); > > + col2 = *(in->data[0] + y2 * in->linesize[0] + x2*3 + 1); > > + } > > + > > + /*If blue color*/ > > + else{ > > + col1 = *(in->data[0] + y1 * in->linesize[0] + x1*3 + 2); > > + col2 = *(in->data[0] + y2 * in->linesize[0] + x2*3 + 2); > > + } > > All of this can be probably be simplified to: > > const int col1 = in->data[0][y1 * in->linesize[0] + x1*3 + mode]; > const int col2 = in->data[0][y2 * in->linesize[0] + x2*3 + mode]; > > And "mode" is badly named, "layer", "color" or "channel" would be more > appropriate. > > [...] > > +/** > > +* Applies the xBR filter rules. > > +**/ > > +static void apply_edge_detection_rules(AVFrame *in,AVFrame *out,int > x,int y){ > > + > > + /* Matrix: (10 is 0,0 i.e: current pixel) > > + -2 | -1| 0| +1| +2 (x) > > + ______________________________ > > + -2 | [ 0][ 1][ 2] > > + -1 | [ 3][ 4][ 5][ 6][ 7] > > + 0 | [ 8][ 9][10][11][12] > > + +1 | [13][14][15][16][17] > > + +2 | [18][19][20] > > + |(y)| > > Why are the spaces totally broken here? > > Unless I'm mistaken, you want this: > > -2 | -1| 0| +1| +2 > +----------------------> (x) > -2 | [ 0][ 1][ 2] > -1 | [ 3][ 4][ 5][ 6][ 7] > 0 | [ 8][ 9][10][11][12] > +1 | [13][14][15][16][17] > +2 | [18][19][20] > | > (y) v > > And then my question becomes: why don't you pick the original naming with > the letters as in the specs? > > [...] > > -- > Clément B. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel