Browse code

avfilter/vf_stereo3d: add interleave columns input support

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2015/12/19 06:00:31
Showing 2 changed files
... ...
@@ -10784,6 +10784,12 @@ interleaved rows (left eye has top row, right eye starts on next row)
10784 10784
 @item irr
10785 10785
 interleaved rows (right eye has top row, left eye starts on next row)
10786 10786
 
10787
+@item icl
10788
+interleaved columns, left eye first
10789
+
10790
+@item icr
10791
+interleaved columns, right eye first
10792
+
10787 10793
 Default value is @samp{sbsl}.
10788 10794
 @end table
10789 10795
 
... ...
@@ -170,6 +170,8 @@ static const AVOption stereo3d_options[] = {
170 170
     { "sbsr",  "side by side right first",            0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL},    0, 0, FLAGS, "in" },
171 171
     { "irl",   "interleave rows left first",          0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_LR}, 0, 0, FLAGS, "in" },
172 172
     { "irr",   "interleave rows right first",         0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_RL}, 0, 0, FLAGS, "in" },
173
+    { "icl",   "interleave columns left first",       0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_LR}, 0, 0, FLAGS, "in" },
174
+    { "icr",   "interleave columns right first",      0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_RL}, 0, 0, FLAGS, "in" },
173 175
     { "out",   "set output format", OFFSET(out.format),  AV_OPT_TYPE_INT,   {.i64=ANAGLYPH_RC_DUBOIS}, 0, STEREO_CODE_COUNT-1, FLAGS, "out"},
174 176
     { "ab2l",  "above below half height left first",  0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR},   0, 0, FLAGS, "out" },
175 177
     { "ab2r",  "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL},   0, 0, FLAGS, "out" },
... ...
@@ -312,6 +314,26 @@ static inline uint8_t ana_convert(const int *coeff, const uint8_t *left, const u
312 312
     return av_clip_uint8(sum >> 16);
313 313
 }
314 314
 
315
+static void anaglyph_ic(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
316
+                        ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize,
317
+                        int width, int height,
318
+                        const int *ana_matrix_r, const int *ana_matrix_g, const int *ana_matrix_b)
319
+{
320
+    int x, y, o;
321
+
322
+    for (y = 0; y < height; y++) {
323
+        for (o = 0, x = 0; x < width; x++, o+= 3) {
324
+            dst[o    ] = ana_convert(ana_matrix_r, lsrc + o * 2, rsrc + o * 2);
325
+            dst[o + 1] = ana_convert(ana_matrix_g, lsrc + o * 2, rsrc + o * 2);
326
+            dst[o + 2] = ana_convert(ana_matrix_b, lsrc + o * 2, rsrc + o * 2);
327
+        }
328
+
329
+        dst  += dst_linesize;
330
+        lsrc += l_linesize;
331
+        rsrc += r_linesize;
332
+    }
333
+}
334
+
315 335
 static void anaglyph(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
316 336
                      ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize,
317 337
                      int width, int height,
... ...
@@ -344,6 +366,8 @@ static int config_output(AVFilterLink *outlink)
344 344
     int ret;
345 345
 
346 346
     switch (s->in.format) {
347
+    case INTERLEAVE_COLS_LR:
348
+    case INTERLEAVE_COLS_RL:
347 349
     case SIDE_BY_SIDE_2_LR:
348 350
     case SIDE_BY_SIDE_LR:
349 351
     case SIDE_BY_SIDE_2_RL:
... ...
@@ -408,6 +432,10 @@ static int config_output(AVFilterLink *outlink)
408 408
         fps.den        *= 2;
409 409
         tb.num         *= 2;
410 410
         break;
411
+    case INTERLEAVE_COLS_RL:
412
+    case INTERLEAVE_COLS_LR:
413
+        s->width        = inlink->w / 2;
414
+        break;
411 415
     case INTERLEAVE_ROWS_LR:
412 416
     case INTERLEAVE_ROWS_RL:
413 417
         s->in.row_step  = 2;
... ...
@@ -504,8 +532,10 @@ static int config_output(AVFilterLink *outlink)
504 504
         s->out.off_lstep = 1;
505 505
         break;
506 506
     case MONO_R:
507
-        s->in.off_left   = s->in.off_right;
508
-        s->in.row_left   = s->in.row_right;
507
+        if (s->in.format != INTERLEAVE_COLS_LR) {
508
+            s->in.off_left = s->in.off_right;
509
+            s->in.row_left = s->in.row_right;
510
+        }
509 511
         if (s->in.format == INTERLEAVE_ROWS_LR)
510 512
             FFSWAP(int, s->in.off_lstep, s->in.off_rstep);
511 513
         break;
... ...
@@ -531,6 +561,17 @@ static int config_output(AVFilterLink *outlink)
531 531
         return AVERROR(EINVAL);
532 532
     }
533 533
 
534
+    if (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) {
535
+        if ((s->in.format & 1) != (s->out.format & 1)) {
536
+            FFSWAP(int, s->in.row_left,   s->in.row_right);
537
+            FFSWAP(int, s->in.off_lstep,  s->in.off_rstep);
538
+            FFSWAP(int, s->in.off_left,   s->in.off_right);
539
+            FFSWAP(int, s->out.row_left,  s->out.row_right);
540
+            FFSWAP(int, s->out.off_lstep, s->out.off_rstep);
541
+            FFSWAP(int, s->out.off_left,  s->out.off_right);
542
+        }
543
+    }
544
+
534 545
     outlink->w = s->out.width;
535 546
     outlink->h = s->out.height;
536 547
     outlink->frame_rate = fps;
... ...
@@ -582,6 +623,43 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
582 582
     return 0;
583 583
 }
584 584
 
585
+static void interleave_cols_to_any(Stereo3DContext *s, int *out_off, int p, AVFrame *in, AVFrame *out, int d)
586
+{
587
+    int y, x;
588
+
589
+    for (y = 0; y < s->pheight[p]; y++) {
590
+        const uint8_t *src = (const uint8_t*)in->data[p] + y * in->linesize[p] + d * s->pixstep[p];
591
+        uint8_t *dst = out->data[p] + out_off[p] + y * out->linesize[p] * s->out.row_step;
592
+
593
+        switch (s->pixstep[p]) {
594
+        case 1:
595
+            for (x = 0; x < s->linesize[p]; x++)
596
+                dst[x] = src[x * 2];
597
+            break;
598
+        case 2:
599
+            for (x = 0; x < s->linesize[p]; x+=2)
600
+                AV_WN16(&dst[x], AV_RN16(&src[x * 2]));
601
+            break;
602
+        case 3:
603
+            for (x = 0; x < s->linesize[p]; x+=3)
604
+                AV_WB24(&dst[x], AV_RB24(&src[x * 2]));
605
+            break;
606
+        case 4:
607
+            for (x = 0; x < s->linesize[p]; x+=4)
608
+                AV_WN32(&dst[x], AV_RN32(&src[x * 2]));
609
+            break;
610
+        case 6:
611
+            for (x = 0; x < s->linesize[p]; x+=6)
612
+                AV_WB48(&dst[x], AV_RB48(&src[x * 2]));
613
+            break;
614
+        case 8:
615
+            for (x = 0; x < s->linesize[p]; x+=8)
616
+                AV_WN64(&dst[x], AV_RN64(&src[x * 2]));
617
+            break;
618
+        }
619
+    }
620
+}
621
+
585 622
 static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
586 623
 {
587 624
     AVFilterContext *ctx  = inlink->dst;
... ...
@@ -761,17 +839,27 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
761 761
     case INTERLEAVE_ROWS_LR:
762 762
     case INTERLEAVE_ROWS_RL:
763 763
 copy:
764
-        for (i = 0; i < s->nb_planes; i++) {
765
-            av_image_copy_plane(oleft->data[i] + out_off_left[i],
766
-                                oleft->linesize[i] * s->out.row_step,
767
-                                ileft->data[i] + s->in_off_left[i],
768
-                                ileft->linesize[i] * s->in.row_step,
769
-                                s->linesize[i], s->pheight[i]);
770
-            av_image_copy_plane(oright->data[i] + out_off_right[i],
771
-                                oright->linesize[i] * s->out.row_step,
772
-                                iright->data[i] + s->in_off_right[i],
773
-                                iright->linesize[i] * s->in.row_step,
774
-                                s->linesize[i], s->pheight[i]);
764
+        if (s->in.format == INTERLEAVE_COLS_LR ||
765
+            s->in.format == INTERLEAVE_COLS_RL) {
766
+            for (i = 0; i < s->nb_planes; i++) {
767
+                int d = (s->in.format & 1) != (s->out.format & 1);
768
+
769
+                interleave_cols_to_any(s, out_off_left,  i, ileft,  oleft,   d);
770
+                interleave_cols_to_any(s, out_off_right, i, iright, oright, !d);
771
+            }
772
+        } else {
773
+            for (i = 0; i < s->nb_planes; i++) {
774
+                av_image_copy_plane(oleft->data[i] + out_off_left[i],
775
+                                    oleft->linesize[i] * s->out.row_step,
776
+                                    ileft->data[i] + s->in_off_left[i],
777
+                                    ileft->linesize[i] * s->in.row_step,
778
+                                    s->linesize[i], s->pheight[i]);
779
+                av_image_copy_plane(oright->data[i] + out_off_right[i],
780
+                                    oright->linesize[i] * s->out.row_step,
781
+                                    iright->data[i] + s->in_off_right[i],
782
+                                    iright->linesize[i] * s->in.row_step,
783
+                                    s->linesize[i], s->pheight[i]);
784
+            }
775 785
         }
776 786
         break;
777 787
     case MONO_L:
... ...
@@ -798,6 +886,14 @@ copy:
798 798
                 out->data[i] += s->in_off_left[i];
799 799
             }
800 800
             break;
801
+        case INTERLEAVE_COLS_LR:
802
+        case INTERLEAVE_COLS_RL:
803
+            for (i = 0; i < s->nb_planes; i++) {
804
+                const int d = (s->in.format & 1) != (s->out.format & 1);
805
+
806
+                interleave_cols_to_any(s, out_off_right, i, iright, out, d);
807
+            }
808
+            break;
801 809
         default:
802 810
             for (i = 0; i < s->nb_planes; i++) {
803 811
                 av_image_copy_plane(out->data[i], out->linesize[i],
... ...
@@ -822,11 +918,25 @@ copy:
822 822
     case ANAGLYPH_YB_HALF:
823 823
     case ANAGLYPH_YB_COLOR:
824 824
     case ANAGLYPH_YB_DUBOIS: {
825
-        ThreadData td;
825
+        if (s->in.format == INTERLEAVE_COLS_LR ||
826
+            s->in.format == INTERLEAVE_COLS_RL) {
827
+            const int d = (s->in.format & 1);
828
+
829
+            anaglyph_ic(out->data[0],
830
+                ileft ->data[0] + s->in_off_left [0] +   d  * 3,
831
+                iright->data[0] + s->in_off_right[0] + (!d) * 3,
832
+                out->linesize[0],
833
+                ileft->linesize[0] * s->in.row_step,
834
+                iright->linesize[0] * s->in.row_step,
835
+                s->out.width, s->out.height,
836
+                s->ana_matrix[0], s->ana_matrix[1], s->ana_matrix[2]);
837
+        } else {
838
+            ThreadData td;
826 839
 
827
-        td.ileft = ileft; td.iright = iright; td.out = out;
828
-        ctx->internal->execute(ctx, filter_slice, &td, NULL,
829
-                               FFMIN(s->out.height, ctx->graph->nb_threads));
840
+            td.ileft = ileft; td.iright = iright; td.out = out;
841
+            ctx->internal->execute(ctx, filter_slice, &td, NULL,
842
+                                   FFMIN(s->out.height, ctx->graph->nb_threads));
843
+        }
830 844
         break;
831 845
     }
832 846
     case CHECKERBOARD_RL:
... ...
@@ -836,47 +946,50 @@ copy:
836 836
 
837 837
             for (y = 0; y < s->pheight[i]; y++) {
838 838
                 uint8_t *dst = out->data[i] + out->linesize[i] * y;
839
-                uint8_t *left = ileft->data[i] + ileft->linesize[i] * y + s->in_off_left[i];
840
-                uint8_t *right = iright->data[i] + iright->linesize[i] * y + s->in_off_right[i];
839
+                const int d1 = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) && (s->in.format & 1) != (s->out.format & 1);
840
+                const int d2 = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) ? !d1 : 0;
841
+                const int m = 1 + (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL);
842
+                uint8_t *left  = ileft->data[i]  + ileft->linesize[i]  * y + s->in_off_left[i]  + d1 * s->pixstep[i];
843
+                uint8_t *right = iright->data[i] + iright->linesize[i] * y + s->in_off_right[i] + d2 * s->pixstep[i];
841 844
                 int p, b;
842 845
 
843
-                if (s->out.format == CHECKERBOARD_RL)
846
+                if (s->out.format == CHECKERBOARD_RL && s->in.format != INTERLEAVE_COLS_LR && s->in.format != INTERLEAVE_COLS_RL)
844 847
                     FFSWAP(uint8_t*, left, right);
845 848
                 switch (s->pixstep[i]) {
846 849
                 case 1:
847
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b++) {
848
-                        dst[x  ] = (b&1) == (y&1) ? left[p] : right[p];
849
-                        dst[x+1] = (b&1) != (y&1) ? left[p] : right[p];
850
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b+=2) {
851
+                        dst[x  ] = (b&1) == (y&1) ? left[p*m] : right[p*m];
852
+                        dst[x+1] = (b&1) != (y&1) ? left[p*m] : right[p*m];
850 853
                     }
851 854
                     break;
852 855
                 case 2:
853
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b++) {
854
-                        AV_WN16(&dst[x  ], (b&1) == (y&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p]));
855
-                        AV_WN16(&dst[x+2], (b&1) != (y&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p]));
856
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b+=2) {
857
+                        AV_WN16(&dst[x  ], (b&1) == (y&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
858
+                        AV_WN16(&dst[x+2], (b&1) != (y&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
856 859
                     }
857 860
                     break;
858 861
                 case 3:
859
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b++) {
860
-                        AV_WB24(&dst[x  ], (b&1) == (y&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p]));
861
-                        AV_WB24(&dst[x+3], (b&1) != (y&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p]));
862
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b+=2) {
863
+                        AV_WB24(&dst[x  ], (b&1) == (y&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
864
+                        AV_WB24(&dst[x+3], (b&1) != (y&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
862 865
                     }
863 866
                     break;
864 867
                 case 4:
865
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b++) {
866
-                        AV_WN32(&dst[x  ], (b&1) == (y&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p]));
867
-                        AV_WN32(&dst[x+4], (b&1) != (y&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p]));
868
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b+=2) {
869
+                        AV_WN32(&dst[x  ], (b&1) == (y&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
870
+                        AV_WN32(&dst[x+4], (b&1) != (y&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
868 871
                     }
869 872
                     break;
870 873
                 case 6:
871
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b++) {
872
-                        AV_WB48(&dst[x  ], (b&1) == (y&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p]));
873
-                        AV_WB48(&dst[x+6], (b&1) != (y&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p]));
874
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b+=2) {
875
+                        AV_WB48(&dst[x  ], (b&1) == (y&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
876
+                        AV_WB48(&dst[x+6], (b&1) != (y&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
874 877
                     }
875 878
                     break;
876 879
                 case 8:
877
-                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b++) {
878
-                        AV_WN64(&dst[x  ], (b&1) == (y&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p]));
879
-                        AV_WN64(&dst[x+8], (b&1) != (y&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p]));
880
+                    for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b+=2) {
881
+                        AV_WN64(&dst[x  ], (b&1) == (y&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
882
+                        AV_WN64(&dst[x+8], (b&1) != (y&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
880 883
                     }
881 884
                     break;
882 885
                 }
... ...
@@ -886,11 +999,13 @@ copy:
886 886
     case INTERLEAVE_COLS_LR:
887 887
     case INTERLEAVE_COLS_RL:
888 888
         for (i = 0; i < s->nb_planes; i++) {
889
+            const int d = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL);
890
+            const int m = 1 + d;
889 891
             int x, y;
890 892
 
891 893
             for (y = 0; y < s->pheight[i]; y++) {
892 894
                 uint8_t *dst = out->data[i] + out->linesize[i] * y;
893
-                uint8_t *left = ileft->data[i] + ileft->linesize[i] * y * s->in.row_step + s->in_off_left[i];
895
+                uint8_t *left = ileft->data[i] + ileft->linesize[i] * y * s->in.row_step + s->in_off_left[i] + d * s->pixstep[i];
894 896
                 uint8_t *right = iright->data[i] + iright->linesize[i] * y * s->in.row_step + s->in_off_right[i];
895 897
                 int p, b;
896 898
 
... ...
@@ -900,38 +1015,38 @@ copy:
900 900
                 switch (s->pixstep[i]) {
901 901
                 case 1:
902 902
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b+=2) {
903
-                        dst[x  ] =   b&1  ? left[p] : right[p];
904
-                        dst[x+1] = !(b&1) ? left[p] : right[p];
903
+                        dst[x  ] =   b&1  ? left[p*m] : right[p*m];
904
+                        dst[x+1] = !(b&1) ? left[p*m] : right[p*m];
905 905
                     }
906 906
                     break;
907 907
                 case 2:
908 908
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b+=2) {
909
-                        AV_WN16(&dst[x  ],   b&1  ? AV_RN16(&left[p]) : AV_RN16(&right[p]));
910
-                        AV_WN16(&dst[x+2], !(b&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p]));
909
+                        AV_WN16(&dst[x  ],   b&1  ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
910
+                        AV_WN16(&dst[x+2], !(b&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
911 911
                     }
912 912
                     break;
913 913
                 case 3:
914 914
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b+=2) {
915
-                        AV_WB24(&dst[x  ],   b&1  ? AV_RB24(&left[p]) : AV_RB24(&right[p]));
916
-                        AV_WB24(&dst[x+3], !(b&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p]));
915
+                        AV_WB24(&dst[x  ],   b&1  ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
916
+                        AV_WB24(&dst[x+3], !(b&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
917 917
                     }
918 918
                     break;
919 919
                 case 4:
920 920
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b+=2) {
921
-                        AV_WN32(&dst[x  ],   b&1  ? AV_RN32(&left[p]) : AV_RN32(&right[p]));
922
-                        AV_WN32(&dst[x+4], !(b&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p]));
921
+                        AV_WN32(&dst[x  ],   b&1  ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
922
+                        AV_WN32(&dst[x+4], !(b&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
923 923
                     }
924 924
                     break;
925 925
                 case 6:
926 926
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b+=2) {
927
-                        AV_WB48(&dst[x  ],   b&1  ? AV_RB48(&left[p]) : AV_RB48(&right[p]));
928
-                        AV_WB48(&dst[x+6], !(b&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p]));
927
+                        AV_WB48(&dst[x  ],   b&1  ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
928
+                        AV_WB48(&dst[x+6], !(b&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
929 929
                     }
930 930
                     break;
931 931
                 case 8:
932 932
                     for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b+=2) {
933
-                        AV_WN64(&dst[x  ],   b&1 ?  AV_RN64(&left[p]) : AV_RN64(&right[p]));
934
-                        AV_WN64(&dst[x+8], !(b&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p]));
933
+                        AV_WN64(&dst[x  ],   b&1 ?  AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
934
+                        AV_WN64(&dst[x+8], !(b&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
935 935
                     }
936 936
                     break;
937 937
                 }