X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fffv1enc_template.c;h=b93336538b276d3ed97a27b411f2a322e097295f;hb=f4d5d7e8de189ab448a5e662245b57ceb8f20df6;hp=b7eea0dd700dcff3973346a71d049a8282fdd028;hpb=040a92c21f2a5fa1570521620acb600af0e058a6;p=ffmpeg diff --git a/libavcodec/ffv1enc_template.c b/libavcodec/ffv1enc_template.c index b7eea0dd700..b93336538b2 100644 --- a/libavcodec/ffv1enc_template.c +++ b/libavcodec/ffv1enc_template.c @@ -122,8 +122,8 @@ static av_always_inline int RENAME(encode_line)(FFV1Context *s, int w, return 0; } -static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], - int w, int h, const int stride[3]) +static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[4], + int w, int h, const int stride[4]) { int x, y, p, i; const int ring_size = s->context_model ? 3 : 2; @@ -132,6 +132,8 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], int packed = !src[1]; int bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8; int offset = 1 << bits; + int transparency = s->transparency; + int packed_size = (3 + transparency)*2; s->run_index = 0; @@ -152,14 +154,18 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], r = (v >> 16) & 0xFF; a = v >> 24; } else if (packed) { - const uint16_t *p = ((const uint16_t*)(src[0] + x*6 + stride[0]*y)); + const uint16_t *p = ((const uint16_t*)(src[0] + x*packed_size + stride[0]*y)); r = p[0]; g = p[1]; b = p[2]; + if (transparency) + a = p[3]; } else if (sizeof(TYPE) == 4) { g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y)); + if (transparency) + a = *((const uint16_t *)(src[3] + x*2 + stride[3]*y)); } else { b = *((const uint16_t *)(src[0] + x*2 + stride[0]*y)); g = *((const uint16_t *)(src[1] + x*2 + stride[1]*y)); @@ -179,7 +185,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *s, const uint8_t *src[3], sample[2][0][x] = r; sample[3][0][x] = a; } - for (p = 0; p < 3 + s->transparency; p++) { + for (p = 0; p < 3 + transparency; p++) { int ret; sample[p][0][-1] = sample[p][1][0 ]; sample[p][1][ w] = sample[p][1][w-1];