continue;
}
- memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
+ memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
+ slice_size);
memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
+ c->dsp.bswap_buf((uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8);
for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step) {
if (get_bits_left(&gb) <= 0) {
- av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
+ av_log(c->avctx, AV_LOG_ERROR,
+ "Slice decoding ran out of bits\n");
goto fail;
}
pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
dest += stride;
}
if (get_bits_left(&gb) > 32)
- av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
- get_bits_left(&gb));
+ av_log(c->avctx, AV_LOG_WARNING,
+ "%d bits left after decoding slice\n", get_bits_left(&gb));
}
ff_free_vlc(&vlc);
static const int rgb_order[4] = { 1, 2, 0, 3 };
-static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
+static void restore_rgb_planes(uint8_t *src, int step, int stride, int width,
+ int height)
{
int i, j;
uint8_t r, g, b;
const int cmask = ~rmode;
for (slice = 0; slice < slices; slice++) {
- slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
+ slice_start = ((slice * height) / slices) & cmask;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
bsrc = src + slice_start * stride;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
- A = bsrc[i];
+ A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride];
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride];
bsrc[0] += C;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
bsrc += stride;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
bsrc += stride;
}
int A, B, C;
uint8_t *bsrc;
int slice_start, slice_height;
- const int cmask = ~(rmode ? 3 : 1);
+ const int cmask = ~(rmode ? 3 : 1);
const int stride2 = stride << 1;
for (slice = 0; slice < slices; slice++) {
slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
slice_height >>= 1;
bsrc = src + slice_start * stride;
// first line - left neighbour prediction
bsrc[0] += 0x80;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
- A = bsrc[i];
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
bsrc[stride + i] += A;
- A = bsrc[stride + i];
+ A = bsrc[stride + i];
}
bsrc += stride2;
if (slice_height == 1)
continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride2];
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride2];
bsrc[0] += C;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride2];
+ B = bsrc[i - stride2];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[stride + i];
+ C = B;
+ A = bsrc[stride + i];
}
bsrc += stride2;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride2];
+ B = bsrc[i - stride2];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i + stride];
+ C = B;
+ A = bsrc[i + stride];
}
bsrc += stride2;
}
}
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
return ret;
}
- /* parse plane structure to retrieve frame flags and validate slice offsets */
+ /* parse plane structure to get frame flags and validate slice offsets */
bytestream2_init(&gb, buf, buf_size);
for (i = 0; i < c->planes; i++) {
plane_start[i] = gb.buffer;
break;
case PIX_FMT_YUV420P:
for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height >> !!i,
plane_start[i], c->frame_pred == PRED_LEFT);
if (ret)
return ret;
break;
case PIX_FMT_YUV422P:
for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height,
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height,
plane_start[i], c->frame_pred == PRED_LEFT);
if (ret)
return ret;
ff_dsputil_init(&c->dsp, avctx);
if (avctx->extradata_size < 16) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata size %d, should be at least 16\n",
avctx->extradata_size);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
avctx->extradata[3], avctx->extradata[2],
avctx->extradata[1], avctx->extradata[0]);
- av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
+ av_log(avctx, AV_LOG_DEBUG, "Original format %X\n",
+ AV_RB32(avctx->extradata + 4));
c->frame_info_size = AV_RL32(avctx->extradata + 8);
c->flags = AV_RL32(avctx->extradata + 12);