|
|
@@ -703,11 +703,15 @@ jsmpeg.prototype.decodeMotionVectors = function() {
|
|
703
|
703
|
}
|
|
704
|
704
|
};
|
|
705
|
705
|
|
|
706
|
|
-jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
|
706
|
+jsmpeg.prototype.copyMacroblock = function(motionH, motionV, sY, sCr, sCb ) {
|
|
707
|
707
|
var
|
|
708
|
708
|
width, scan,
|
|
709
|
709
|
H, V, oddH, oddV,
|
|
710
|
710
|
src, dest, last;
|
|
|
711
|
+
|
|
|
712
|
+ var dY = this.currentY;
|
|
|
713
|
+ var dCb = this.currentCb;
|
|
|
714
|
+ var dCr = this.currentCr;
|
|
711
|
715
|
|
|
712
|
716
|
// Luminance
|
|
713
|
717
|
width = this.codedWidth;
|
|
|
@@ -721,12 +725,13 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
721
|
725
|
src = ((this.mbRow << 4) + V) * width + (this.mbCol << 4) + H;
|
|
722
|
726
|
dest = (this.mbRow * width + this.mbCol) << 4;
|
|
723
|
727
|
last = dest + (width << 4);
|
|
724
|
|
-
|
|
|
728
|
+
|
|
|
729
|
+
|
|
725
|
730
|
if( oddH ) {
|
|
726
|
731
|
if( oddV ) {
|
|
727
|
732
|
while( dest < last ) {
|
|
728
|
733
|
for( var x = 0; x < 16; x++ ) {
|
|
729
|
|
- this.currentY[dest] = (Y[src] + Y[src+1] + Y[src+width] + Y[src+width+1] + 2) >> 2;
|
|
|
734
|
+ dY[dest] = (sY[src] + sY[src+1] + sY[src+width] + sY[src+width+1] + 2) >> 2;
|
|
730
|
735
|
dest++; src++;
|
|
731
|
736
|
}
|
|
732
|
737
|
dest += scan; src += scan;
|
|
|
@@ -735,7 +740,7 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
735
|
740
|
else {
|
|
736
|
741
|
while( dest < last ) {
|
|
737
|
742
|
for( var x = 0; x < 16; x++ ) {
|
|
738
|
|
- this.currentY[dest] = (Y[src] + Y[src+1] + 1) >> 1;
|
|
|
743
|
+ dY[dest] = (sY[src] + sY[src+1] + 1) >> 1;
|
|
739
|
744
|
dest++; src++;
|
|
740
|
745
|
}
|
|
741
|
746
|
dest += scan; src += scan;
|
|
|
@@ -746,7 +751,7 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
746
|
751
|
if( oddV ) {
|
|
747
|
752
|
while( dest < last ) {
|
|
748
|
753
|
for( var x = 0; x < 16; x++ ) {
|
|
749
|
|
- this.currentY[dest] = (Y[src] + Y[src+width] + 1) >> 1;
|
|
|
754
|
+ dY[dest] = (sY[src] + sY[src+width] + 1) >> 1;
|
|
750
|
755
|
dest++; src++;
|
|
751
|
756
|
}
|
|
752
|
757
|
dest += scan; src += scan;
|
|
|
@@ -755,7 +760,7 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
755
|
760
|
else {
|
|
756
|
761
|
while( dest < last ) {
|
|
757
|
762
|
for( var x = 0; x < 16; x++ ) {
|
|
758
|
|
- this.currentY[dest] = Y[src];
|
|
|
763
|
+ dY[dest] = sY[src];
|
|
759
|
764
|
dest++; src++;
|
|
760
|
765
|
}
|
|
761
|
766
|
dest += scan; src += scan;
|
|
|
@@ -782,8 +787,8 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
782
|
787
|
if( oddV ) {
|
|
783
|
788
|
while( dest < last ) {
|
|
784
|
789
|
for( var x = 0; x < 8; x++ ) {
|
|
785
|
|
- this.currentCr[dest] = (Cr[src] + Cr[src+1] + Cr[src+width] + Cr[src+width+1] + 2) >> 2;
|
|
786
|
|
- this.currentCb[dest] = (Cb[src] + Cb[src+1] + Cb[src+width] + Cb[src+width+1] + 2) >> 2;
|
|
|
790
|
+ dCr[dest] = (sCr[src] + sCr[src+1] + sCr[src+width] + sCr[src+width+1] + 2) >> 2;
|
|
|
791
|
+ dCb[dest] = (sCb[src] + sCb[src+1] + sCb[src+width] + sCb[src+width+1] + 2) >> 2;
|
|
787
|
792
|
dest++; src++;
|
|
788
|
793
|
}
|
|
789
|
794
|
dest += scan; src += scan;
|
|
|
@@ -792,8 +797,8 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
792
|
797
|
else {
|
|
793
|
798
|
while( dest < last ) {
|
|
794
|
799
|
for( var x = 0; x < 8; x++ ) {
|
|
795
|
|
- this.currentCr[dest] = (Cr[src] + Cr[src+1] + 1) >> 1;
|
|
796
|
|
- this.currentCb[dest] = (Cb[src] + Cb[src+1] + 1) >> 1;
|
|
|
800
|
+ dCr[dest] = (sCr[src] + sCr[src+1] + 1) >> 1;
|
|
|
801
|
+ dCb[dest] = (sCb[src] + sCb[src+1] + 1) >> 1;
|
|
797
|
802
|
dest++; src++;
|
|
798
|
803
|
}
|
|
799
|
804
|
dest += scan; src += scan;
|
|
|
@@ -804,8 +809,8 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
804
|
809
|
if( oddV ) {
|
|
805
|
810
|
while( dest < last ) {
|
|
806
|
811
|
for( var x = 0; x < 8; x++ ) {
|
|
807
|
|
- this.currentCr[dest] = (Cr[src] + Cr[src+width] + 1) >> 1;
|
|
808
|
|
- this.currentCb[dest] = (Cb[src] + Cb[src+width] + 1) >> 1;
|
|
|
812
|
+ dCr[dest] = (sCr[src] + sCr[src+width] + 1) >> 1;
|
|
|
813
|
+ dCb[dest] = (sCb[src] + sCb[src+width] + 1) >> 1;
|
|
809
|
814
|
dest++; src++;
|
|
810
|
815
|
}
|
|
811
|
816
|
dest += scan; src += scan;
|
|
|
@@ -814,8 +819,8 @@ jsmpeg.prototype.copyMacroblock = function(motionH, motionV, Y, Cr, Cb ) {
|
|
814
|
819
|
else {
|
|
815
|
820
|
while( dest < last ) {
|
|
816
|
821
|
for( var x = 0; x < 8; x++ ) {
|
|
817
|
|
- this.currentCr[dest] = Cr[src];
|
|
818
|
|
- this.currentCb[dest] = Cb[src];
|
|
|
822
|
+ dCr[dest] = sCr[src];
|
|
|
823
|
+ dCb[dest] = sCb[src];
|
|
819
|
824
|
dest++; src++;
|
|
820
|
825
|
}
|
|
821
|
826
|
dest += scan; src += scan;
|