Skip to content

Commit

Permalink
utvideoenc: drop step
Browse files Browse the repository at this point in the history
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Aug 22, 2012
1 parent ba69eb5 commit d79c87a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions libavcodec/utvideoenc.c
Expand Up @@ -229,29 +229,29 @@ static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step,
}

/* Write data to a plane, no prediction applied */
static void write_plane(uint8_t *src, uint8_t *dst, int step, int stride,
static void write_plane(uint8_t *src, uint8_t *dst, int stride,
int width, int height)
{
int i, j;

for (j = 0; j < height; j++) {
for (i = 0; i < width * step; i += step)
for (i = 0; i < width; i++)
*dst++ = src[i];

src += stride;
}
}

/* Write data to a plane with left prediction */
static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
static void left_predict(uint8_t *src, uint8_t *dst, int stride,
int width, int height)
{
int i, j;
uint8_t prev;

prev = 0x80; /* Set the initial value */
for (j = 0; j < height; j++) {
for (i = 0; i < width * step; i += step) {
for (i = 0; i < width; i++) {
*dst++ = src[i] - prev;
prev = src[i];
}
Expand All @@ -260,7 +260,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
}

/* Write data to a plane with median prediction */
static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
static void median_predict(uint8_t *src, uint8_t *dst, int stride,
int width, int height)
{
int i, j;
Expand All @@ -269,7 +269,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,

/* First line uses left neighbour prediction */
prev = 0x80; /* Set the initial value */
for (i = 0; i < width * step; i += step) {
for (i = 0; i < width; i++) {
*dst++ = src[i] - prev;
prev = src[i];
}
Expand All @@ -286,7 +286,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
C = src[-stride];
*dst++ = src[0] - C;
A = src[0];
for (i = step; i < width * step; i += step) {
for (i = 1; i < width; i++) {
B = src[i - stride];
*dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF);
C = B;
Expand All @@ -297,7 +297,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,

/* Rest of the coded part uses median prediction */
for (j = 2; j < height; j++) {
for (i = 0; i < width * step; i += step) {
for (i = 0; i < width; i++) {
B = src[i - stride];
*dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF);
C = B;
Expand Down Expand Up @@ -376,7 +376,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
}

static int encode_plane(AVCodecContext *avctx, uint8_t *src,
uint8_t *dst, int step, int stride,
uint8_t *dst, int stride,
int width, int height, PutByteContext *pb)
{
UtvideoContext *c = avctx->priv_data;
Expand All @@ -396,23 +396,23 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
sstart = send;
send = height * (i + 1) / c->slices;
write_plane(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
stride, width, send - sstart);
}
break;
case PRED_LEFT:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
left_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
stride, width, send - sstart);
}
break;
case PRED_MEDIAN:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
median_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
stride, width, send - sstart);
}
break;
default:
Expand Down Expand Up @@ -556,7 +556,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
case PIX_FMT_RGBA:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, c->slice_buffer[i] + width,
c->slice_buffer[i], 1, width,
c->slice_buffer[i], width,
width, height, &pb);

if (ret) {
Expand All @@ -567,7 +567,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
break;
case PIX_FMT_YUV422P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1,
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
pic->linesize[i], width >> !!i, height, &pb);

if (ret) {
Expand All @@ -578,7 +578,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
break;
case PIX_FMT_YUV420P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1,
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
pic->linesize[i], width >> !!i, height >> !!i,
&pb);

Expand Down

0 comments on commit d79c87a

Please sign in to comment.