mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-18 05:11:09 +00:00
avcodec/m101: simplify 8bit code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
22d1148c77
commit
fc6894770e
@ -45,7 +45,6 @@ static int m101_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
int stride, ret;
|
int stride, ret;
|
||||||
int x, y;
|
int x, y;
|
||||||
int min_stride = 2 * avctx->width;
|
int min_stride = 2 * avctx->width;
|
||||||
uint8_t *line;
|
|
||||||
int bits = avctx->extradata[2*4];
|
int bits = avctx->extradata[2*4];
|
||||||
AVFrame *frame = data;
|
AVFrame *frame = data;
|
||||||
|
|
||||||
@ -65,7 +64,6 @@ static int m101_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
line = frame->data[0];
|
|
||||||
frame->interlaced_frame = ((avctx->extradata[3*4] & 3) != 3);
|
frame->interlaced_frame = ((avctx->extradata[3*4] & 3) != 3);
|
||||||
if (frame->interlaced_frame)
|
if (frame->interlaced_frame)
|
||||||
frame->top_field_first = avctx->extradata[3*4] & 1;
|
frame->top_field_first = avctx->extradata[3*4] & 1;
|
||||||
@ -75,10 +73,8 @@ static int m101_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
if (frame->interlaced_frame)
|
if (frame->interlaced_frame)
|
||||||
src_y = ((y&1)^frame->top_field_first) ? y/2 : (y/2 + avctx->height/2);
|
src_y = ((y&1)^frame->top_field_first) ? y/2 : (y/2 + avctx->height/2);
|
||||||
if (bits == 8) {
|
if (bits == 8) {
|
||||||
for (x = 0; x < avctx->width; x++) {
|
uint8_t *line = frame->data[0] + y*frame->linesize[0];
|
||||||
line[y*frame->linesize[0] + 2*x + 0] = buf[src_y*stride + 2*x + 0];
|
memcpy(line, buf + src_y*stride, 2*avctx->width);
|
||||||
line[y*frame->linesize[0] + 2*x + 1] = buf[src_y*stride + 2*x + 1];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
int block;
|
int block;
|
||||||
uint16_t *luma = (uint16_t*)&frame->data[0][y*frame->linesize[0]];
|
uint16_t *luma = (uint16_t*)&frame->data[0][y*frame->linesize[0]];
|
||||||
|
Loading…
Reference in New Issue
Block a user