@@ -453,9 +453,11 @@ inline void nv12_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
453
453
g3 = g3 < 0 ? 0 : (g3 > 255 ) ? 255 : g3;
454
454
b3 = b3 < 0 ? 0 : (b3 > 255 ) ? 255 : b3;
455
455
456
- *ptr_bgr1++ = b1;
457
- *ptr_bgr1++ = g1;
458
- *ptr_bgr1++ = r1;
456
+ if (j + 1 < srcw) {
457
+ *ptr_bgr1++ = b1;
458
+ *ptr_bgr1++ = g1;
459
+ *ptr_bgr1++ = r1;
460
+ }
459
461
460
462
*ptr_bgr2++ = b2;
461
463
*ptr_bgr2++ = g2;
@@ -465,9 +467,11 @@ inline void nv12_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
465
467
ptr_y2 += 2 ;
466
468
ptr_vu += 2 ;
467
469
468
- *ptr_bgr2++ = b3;
469
- *ptr_bgr2++ = g3;
470
- *ptr_bgr2++ = r3;
470
+ if (j + 1 < srcw) {
471
+ *ptr_bgr2++ = b3;
472
+ *ptr_bgr2++ = g3;
473
+ *ptr_bgr2++ = r3;
474
+ }
471
475
}
472
476
}
473
477
delete[] zerobuf;
@@ -788,9 +792,11 @@ inline void nv21_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
788
792
g3 = g3 < 0 ? 0 : (g3 > 255 ) ? 255 : g3;
789
793
b3 = b3 < 0 ? 0 : (b3 > 255 ) ? 255 : b3;
790
794
791
- *ptr_bgr1++ = b1;
792
- *ptr_bgr1++ = g1;
793
- *ptr_bgr1++ = r1;
795
+ if (j + 1 < srcw) {
796
+ *ptr_bgr1++ = b1;
797
+ *ptr_bgr1++ = g1;
798
+ *ptr_bgr1++ = r1;
799
+ }
794
800
795
801
*ptr_bgr2++ = b2;
796
802
*ptr_bgr2++ = g2;
@@ -800,9 +806,11 @@ inline void nv21_to_bgr(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
800
806
ptr_y2 += 2 ;
801
807
ptr_vu += 2 ;
802
808
803
- *ptr_bgr2++ = b3;
804
- *ptr_bgr2++ = g3;
805
- *ptr_bgr2++ = r3;
809
+ if (j + 1 < srcw) {
810
+ *ptr_bgr2++ = b3;
811
+ *ptr_bgr2++ = g3;
812
+ *ptr_bgr2++ = r3;
813
+ }
806
814
}
807
815
}
808
816
delete[] zerobuf;
@@ -1128,10 +1136,12 @@ inline void nv12_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
1128
1136
g3 = g3 < 0 ? 0 : (g3 > 255 ) ? 255 : g3;
1129
1137
b3 = b3 < 0 ? 0 : (b3 > 255 ) ? 255 : b3;
1130
1138
1131
- *ptr_bgr1++ = b1;
1132
- *ptr_bgr1++ = g1;
1133
- *ptr_bgr1++ = r1;
1134
- *ptr_bgr1++ = 255 ;
1139
+ if (j + 1 < srcw) {
1140
+ *ptr_bgr1++ = b1;
1141
+ *ptr_bgr1++ = g1;
1142
+ *ptr_bgr1++ = r1;
1143
+ *ptr_bgr1++ = 255 ;
1144
+ }
1135
1145
1136
1146
*ptr_bgr2++ = b2;
1137
1147
*ptr_bgr2++ = g2;
@@ -1142,10 +1152,12 @@ inline void nv12_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
1142
1152
ptr_y2 += 2 ;
1143
1153
ptr_vu += 2 ;
1144
1154
1145
- *ptr_bgr2++ = b3;
1146
- *ptr_bgr2++ = g3;
1147
- *ptr_bgr2++ = r3;
1148
- *ptr_bgr2++ = 255 ;
1155
+ if (j + 1 < srcw) {
1156
+ *ptr_bgr2++ = b3;
1157
+ *ptr_bgr2++ = g3;
1158
+ *ptr_bgr2++ = r3;
1159
+ *ptr_bgr2++ = 255 ;
1160
+ }
1149
1161
}
1150
1162
}
1151
1163
delete[] zerobuf;
@@ -1471,10 +1483,12 @@ inline void nv21_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
1471
1483
g3 = g3 < 0 ? 0 : (g3 > 255 ) ? 255 : g3;
1472
1484
b3 = b3 < 0 ? 0 : (b3 > 255 ) ? 255 : b3;
1473
1485
1474
- *ptr_bgr1++ = b1;
1475
- *ptr_bgr1++ = g1;
1476
- *ptr_bgr1++ = r1;
1477
- *ptr_bgr1++ = 255 ;
1486
+ if (j + 1 < srcw) {
1487
+ *ptr_bgr1++ = b1;
1488
+ *ptr_bgr1++ = g1;
1489
+ *ptr_bgr1++ = r1;
1490
+ *ptr_bgr1++ = 255 ;
1491
+ }
1478
1492
1479
1493
*ptr_bgr2++ = b2;
1480
1494
*ptr_bgr2++ = g2;
@@ -1485,10 +1499,12 @@ inline void nv21_to_bgra(const uint8_t* src, uint8_t* dst, int srcw, int srch) {
1485
1499
ptr_y2 += 2 ;
1486
1500
ptr_vu += 2 ;
1487
1501
1488
- *ptr_bgr2++ = b3;
1489
- *ptr_bgr2++ = g3;
1490
- *ptr_bgr2++ = r3;
1491
- *ptr_bgr2++ = 255 ;
1502
+ if (j + 1 < srcw) {
1503
+ *ptr_bgr2++ = b3;
1504
+ *ptr_bgr2++ = g3;
1505
+ *ptr_bgr2++ = r3;
1506
+ *ptr_bgr2++ = 255 ;
1507
+ }
1492
1508
}
1493
1509
}
1494
1510
delete[] zerobuf;
0 commit comments