Commit 9c714731 authored by Martin Vignali's avatar Martin Vignali

libavcodec/utvideo : simplify decode_plane

the func is only call with step = 1
no need to pass it in the func
parent 97ac8a47
...@@ -126,7 +126,7 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym) ...@@ -126,7 +126,7 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
} }
static int decode_plane10(UtvideoContext *c, int plane_no, static int decode_plane10(UtvideoContext *c, int plane_no,
uint16_t *dst, int step, ptrdiff_t stride, uint16_t *dst, ptrdiff_t stride,
int width, int height, int width, int height,
const uint8_t *src, const uint8_t *huff, const uint8_t *src, const uint8_t *huff,
int use_pred) int use_pred)
...@@ -152,7 +152,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no, ...@@ -152,7 +152,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
prev = 0x200; prev = 0x200;
for (j = sstart; j < send; j++) { for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step) { for (i = 0; i < width; i++) {
pix = fsym; pix = fsym;
if (use_pred) { if (use_pred) {
prev += pix; prev += pix;
...@@ -195,8 +195,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no, ...@@ -195,8 +195,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
prev = 0x200; prev = 0x200;
for (j = sstart; j < send; j++) { for (j = sstart; j < send; j++) {
int ws = width * step; for (i = 0; i < width; i++) {
for (i = 0; i < ws; i += step) {
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3); pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
if (pix < 0) { if (pix < 0) {
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
...@@ -240,7 +239,7 @@ static int compute_cmask(int plane_no, int interlaced, enum AVPixelFormat pix_fm ...@@ -240,7 +239,7 @@ static int compute_cmask(int plane_no, int interlaced, enum AVPixelFormat pix_fm
} }
static int decode_plane(UtvideoContext *c, int plane_no, static int decode_plane(UtvideoContext *c, int plane_no,
uint8_t *dst, int step, ptrdiff_t stride, uint8_t *dst, ptrdiff_t stride,
int width, int height, int width, int height,
const uint8_t *src, int use_pred) const uint8_t *src, int use_pred)
{ {
...@@ -266,7 +265,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, ...@@ -266,7 +265,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
prev = 0x80; prev = 0x80;
for (j = sstart; j < send; j++) { for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step) { for (i = 0; i < width; i++) {
pix = fsym; pix = fsym;
if (use_pred) { if (use_pred) {
prev += pix; prev += pix;
...@@ -310,8 +309,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, ...@@ -310,8 +309,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
prev = 0x80; prev = 0x80;
for (j = sstart; j < send; j++) { for (j = sstart; j < send; j++) {
int ws = width * step; for (i = 0; i < width; i++) {
for (i = 0; i < ws; i += step) {
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3); pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
if (pix < 0) { if (pix < 0) {
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
...@@ -634,7 +632,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -634,7 +632,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case AV_PIX_FMT_GBRP: case AV_PIX_FMT_GBRP:
case AV_PIX_FMT_GBRAP: case AV_PIX_FMT_GBRAP:
for (i = 0; i < c->planes; i++) { for (i = 0; i < c->planes; i++) {
ret = decode_plane(c, i, frame.f->data[i], 1, ret = decode_plane(c, i, frame.f->data[i],
frame.f->linesize[i], avctx->width, frame.f->linesize[i], avctx->width,
avctx->height, plane_start[i], avctx->height, plane_start[i],
c->frame_pred == PRED_LEFT); c->frame_pred == PRED_LEFT);
...@@ -671,7 +669,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -671,7 +669,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case AV_PIX_FMT_GBRAP10: case AV_PIX_FMT_GBRAP10:
case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP10:
for (i = 0; i < c->planes; i++) { for (i = 0; i < c->planes; i++) {
ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], 1, ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i],
frame.f->linesize[i] / 2, avctx->width, frame.f->linesize[i] / 2, avctx->width,
avctx->height, plane_start[i], avctx->height, plane_start[i],
plane_start[i + 1] - 1024, plane_start[i + 1] - 1024,
...@@ -685,7 +683,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -685,7 +683,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break; break;
case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV420P:
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i], ret = decode_plane(c, i, frame.f->data[i], frame.f->linesize[i],
avctx->width >> !!i, avctx->height >> !!i, avctx->width >> !!i, avctx->height >> !!i,
plane_start[i], c->frame_pred == PRED_LEFT); plane_start[i], c->frame_pred == PRED_LEFT);
if (ret) if (ret)
...@@ -717,7 +715,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -717,7 +715,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break; break;
case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV422P:
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i], ret = decode_plane(c, i, frame.f->data[i], frame.f->linesize[i],
avctx->width >> !!i, avctx->height, avctx->width >> !!i, avctx->height,
plane_start[i], c->frame_pred == PRED_LEFT); plane_start[i], c->frame_pred == PRED_LEFT);
if (ret) if (ret)
...@@ -747,7 +745,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -747,7 +745,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break; break;
case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUV444P:
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i], ret = decode_plane(c, i, frame.f->data[i], frame.f->linesize[i],
avctx->width, avctx->height, avctx->width, avctx->height,
plane_start[i], c->frame_pred == PRED_LEFT); plane_start[i], c->frame_pred == PRED_LEFT);
if (ret) if (ret)
...@@ -777,7 +775,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -777,7 +775,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break; break;
case AV_PIX_FMT_YUV422P10: case AV_PIX_FMT_YUV422P10:
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], 1, frame.f->linesize[i] / 2, ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], frame.f->linesize[i] / 2,
avctx->width >> !!i, avctx->height, avctx->width >> !!i, avctx->height,
plane_start[i], plane_start[i + 1] - 1024, c->frame_pred == PRED_LEFT); plane_start[i], plane_start[i + 1] - 1024, c->frame_pred == PRED_LEFT);
if (ret) if (ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment