int i;
unsigned acc = 0;
- for (i = 0; i < dstW - 1; i += 2) {
+ for (i = 0; i < dstW; i += 2) {
int j;
int Y1 = 1 << 18;
int Y2 = 1 << 18;
output_pixel(*dest++, acc);
}
}
+
+ if (i & 6) {
+ output_pixel(*dest, acc);
+ }
}
static av_always_inline void
{
const int16_t *buf0 = buf[0], *buf1 = buf[1];
const uint8_t * const d128 = dither_8x8_220[y & 7];
- int yalpha1 = 4095 - yalpha;
+ int yalpha1 = 4096 - yalpha;
int i;
- for (i = 0; i < dstW - 7; i += 8) {
+ for (i = 0; i < dstW; i += 8) {
int Y, acc = 0;
Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
const uint8_t * const d128 = dither_8x8_220[y & 7];
int i;
- for (i = 0; i < dstW - 7; i += 8) {
+ for (i = 0; i < dstW; i += 8) {
int acc = 0;
accumulate_bit(acc, (buf0[i + 0] >> 7) + d128[0]);
{
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j;
int Y1 = 1 << 18;
int Y2 = 1 << 18;
const int16_t *buf0 = buf[0], *buf1 = buf[1],
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
*vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
int i;
if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;
{
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j;
int Y1 = -0x40000000;
int Y2 = -0x40000000;
const int32_t *buf0 = buf[0], *buf1 = buf[1],
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
*vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14;
int i;
if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + (-128 << 11)) >> 2;
}
} else {
const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
{
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j, A1, A2;
int Y1 = 1 << 18;
int Y2 = 1 << 18;
*vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
*abuf0 = hasAlpha ? abuf[0] : NULL,
*abuf1 = hasAlpha ? abuf[1] : NULL;
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
int i;
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
+ const void *r, *g, *b;
Y1 = av_clip_uint8(Y1);
Y2 = av_clip_uint8(Y2);
U = av_clip_uint8(U);
V = av_clip_uint8(V);
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
if (hasAlpha) {
A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19;
A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;
int i;
if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
int V = vbuf0[i] >> 7;
int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
+ const void *r, *g, *b;
Y1 = av_clip_uint8(Y1);
Y2 = av_clip_uint8(Y2);
U = av_clip_uint8(U);
V = av_clip_uint8(V);
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
if (hasAlpha) {
A1 = abuf0[i * 2 ] >> 7;
A2 = abuf0[i * 2 + 1] >> 7;
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
- for (i = 0; i < (dstW >> 1); i++) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;
int V = (vbuf0[i] + vbuf1[i]) >> 8;
int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
+ const void *r, *g, *b;
Y1 = av_clip_uint8(Y1);
Y2 = av_clip_uint8(Y2);
U = av_clip_uint8(U);
V = av_clip_uint8(V);
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
if (hasAlpha) {
A1 = abuf0[i * 2 ] >> 7;
A2 = abuf0[i * 2 + 1] >> 7;