1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

huffyuv: change left prediction access in BGRA

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Christophe Gisquet 2014-05-29 09:10:39 +00:00 committed by Michael Niedermayer
parent c609f803e1
commit 25e6310a3e
3 changed files with 20 additions and 21 deletions

View File

@ -1028,19 +1028,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
} else {
int y;
int leftr, leftg, leftb, lefta;
uint8_t left[4];
const int last_line = (height - 1) * p->linesize[0];
if (s->bitstream_bpp == 32) {
lefta = p->data[0][last_line+A] = get_bits(&s->gb, 8);
leftr = p->data[0][last_line+R] = get_bits(&s->gb, 8);
leftg = p->data[0][last_line+G] = get_bits(&s->gb, 8);
leftb = p->data[0][last_line+B] = get_bits(&s->gb, 8);
left[A] = p->data[0][last_line+A] = get_bits(&s->gb, 8);
left[R] = p->data[0][last_line+R] = get_bits(&s->gb, 8);
left[G] = p->data[0][last_line+G] = get_bits(&s->gb, 8);
left[B] = p->data[0][last_line+B] = get_bits(&s->gb, 8);
} else {
leftr = p->data[0][last_line+R] = get_bits(&s->gb, 8);
leftg = p->data[0][last_line+G] = get_bits(&s->gb, 8);
leftb = p->data[0][last_line+B] = get_bits(&s->gb, 8);
lefta = p->data[0][last_line+A] = 255;
left[R] = p->data[0][last_line+R] = get_bits(&s->gb, 8);
left[G] = p->data[0][last_line+G] = get_bits(&s->gb, 8);
left[B] = p->data[0][last_line+B] = get_bits(&s->gb, 8);
left[A] = p->data[0][last_line+A] = 255;
skip_bits(&s->gb, 8);
}
@ -1049,14 +1049,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case LEFT:
case PLANE:
decode_bgr_bitstream(s, width - 1);
s->hdsp.add_hfyu_left_pred_bgr32(p->data[0] + last_line + 4, s->temp[0], width - 1, &leftr, &leftg, &leftb, &lefta);
s->hdsp.add_hfyu_left_pred_bgr32(p->data[0] + last_line + 4, s->temp[0], width - 1, left);
for (y = s->height - 2; y >= 0; y--) { //Yes it is stored upside down.
decode_bgr_bitstream(s, width);
s->hdsp.add_hfyu_left_pred_bgr32(p->data[0] + p->linesize[0] * y, s->temp[0], width, &leftr, &leftg, &leftb, &lefta);
s->hdsp.add_hfyu_left_pred_bgr32(p->data[0] + p->linesize[0] * y, s->temp[0], width, left);
if (s->predictor == PLANE) {
if (s->bitstream_bpp != 32) lefta = 0;
if (s->bitstream_bpp != 32) left[A] = 0;
if ((y & s->interlaced) == 0 &&
y < s->height - 1 - s->interlaced) {
s->hdsp.add_bytes(p->data[0] + p->linesize[0] * y,

View File

@ -82,10 +82,10 @@ static int add_hfyu_left_pred_c(uint8_t *dst, const uint8_t *src, int w,
}
static void add_hfyu_left_pred_bgr32_c(uint8_t *dst, const uint8_t *src,
int w, int *red, int *green,
int *blue, int *alpha)
intptr_t w, uint8_t *left)
{
int i, r = *red, g = *green, b = *blue, a = *alpha;
int i;
uint8_t r = left[R], g = left[G], b = left[B], a = left[A];
for (i = 0; i < w; i++) {
b += src[4 * i + B];
@ -99,10 +99,10 @@ static void add_hfyu_left_pred_bgr32_c(uint8_t *dst, const uint8_t *src,
dst[4 * i + A] = a;
}
*red = r;
*green = g;
*blue = b;
*alpha = a;
left[B] = b;
left[G] = g;
left[R] = r;
left[A] = a;
}
av_cold void ff_huffyuvdsp_init(HuffYUVDSPContext *c)

View File

@ -42,8 +42,7 @@ typedef struct HuffYUVDSPContext {
int (*add_hfyu_left_pred)(uint8_t *dst, const uint8_t *src,
int w, int left);
void (*add_hfyu_left_pred_bgr32)(uint8_t *dst, const uint8_t *src,
int w, int *red, int *green,
int *blue, int *alpha);
intptr_t w, uint8_t *left);
} HuffYUVDSPContext;
void ff_huffyuvdsp_init(HuffYUVDSPContext *c);