[FFmpeg-devel] [PATCH 4/6] huffyuv: change left prediction access in BGRA
Christophe Gisquet
christophe.gisquet at gmail.com
Thu May 29 11:10:39 CEST 2014
---
libavcodec/huffyuvdec.c | 24 ++++++++++++------------
libavcodec/huffyuvdsp.c | 14 +++++++-------
libavcodec/huffyuvdsp.h | 3 +--
3 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index ab34533..40cac8a 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -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,
diff --git a/libavcodec/huffyuvdsp.c b/libavcodec/huffyuvdsp.c
index 089f667..cbc09cf 100644
--- a/libavcodec/huffyuvdsp.c
+++ b/libavcodec/huffyuvdsp.c
@@ -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)
diff --git a/libavcodec/huffyuvdsp.h b/libavcodec/huffyuvdsp.h
index cc12c75..fd66f0a 100644
--- a/libavcodec/huffyuvdsp.h
+++ b/libavcodec/huffyuvdsp.h
@@ -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);
--
1.8.0.msysgit.0
More information about the ffmpeg-devel
mailing list