Commit 6dfacd7a authored by Luca Barbato's avatar Luca Barbato
Browse files

indeo: Cosmetic formatting

Trim some overly long lines.
parent 62256010
...@@ -53,9 +53,10 @@ static uint16_t inv_bits(uint16_t val, int nbits) ...@@ -53,9 +53,10 @@ static uint16_t inv_bits(uint16_t val, int nbits)
uint16_t res; uint16_t res;
if (nbits <= 8) { if (nbits <= 8) {
res = ff_reverse[val] >> (8-nbits); res = ff_reverse[val] >> (8 - nbits);
} else } else
res = ((ff_reverse[val & 0xFF] << 8) + (ff_reverse[val >> 8])) >> (16-nbits); res = ((ff_reverse[val & 0xFF] << 8) +
(ff_reverse[val >> 8])) >> (16 - nbits);
return res; return res;
} }
...@@ -114,10 +115,12 @@ av_cold void ff_ivi_init_static_vlc(void) ...@@ -114,10 +115,12 @@ av_cold void ff_ivi_init_static_vlc(void)
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192; ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192;
ivi_mb_vlc_tabs[i].table_allocated = 8192; ivi_mb_vlc_tabs[i].table_allocated = 8192;
ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i], &ivi_mb_vlc_tabs[i], 1); ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i],
&ivi_mb_vlc_tabs[i], 1);
ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192; ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192;
ivi_blk_vlc_tabs[i].table_allocated = 8192; ivi_blk_vlc_tabs[i].table_allocated = 8192;
ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &ivi_blk_vlc_tabs[i], 1); ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i],
&ivi_blk_vlc_tabs[i], 1);
} }
initialized_vlcs = 1; initialized_vlcs = 1;
} }
...@@ -141,10 +144,11 @@ static void ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src) ...@@ -141,10 +144,11 @@ static void ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src)
* @param[in] desc2 ptr to the 2nd descriptor to compare * @param[in] desc2 ptr to the 2nd descriptor to compare
* @return comparison result: 0 - equal, 1 - not equal * @return comparison result: 0 - equal, 1 - not equal
*/ */
static int ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2) static int ivi_huff_desc_cmp(const IVIHuffDesc *desc1,
const IVIHuffDesc *desc2)
{ {
return desc1->num_rows != desc2->num_rows return desc1->num_rows != desc2->num_rows ||
|| memcmp(desc1->xbits, desc2->xbits, desc1->num_rows); memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
} }
int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
...@@ -226,7 +230,8 @@ static av_cold void ivi_free_buffers(IVIPlaneDesc *planes) ...@@ -226,7 +230,8 @@ static av_cold void ivi_free_buffers(IVIPlaneDesc *planes)
av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg) av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
{ {
int p, b; int p, b;
uint32_t b_width, b_height, align_fac, width_aligned, height_aligned, buf_size; uint32_t b_width, b_height, align_fac, width_aligned,
height_aligned, buf_size;
IVIBandDesc *band; IVIBandDesc *band;
ivi_free_buffers(planes); ivi_free_buffers(planes);
...@@ -249,8 +254,10 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg) ...@@ -249,8 +254,10 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
/* select band dimensions: if there is only one band then it /* select band dimensions: if there is only one band then it
* has the full size, if there are several bands each of them * has the full size, if there are several bands each of them
* has only half size */ * has only half size */
b_width = planes[p].num_bands == 1 ? planes[p].width : (planes[p].width + 1) >> 1; b_width = planes[p].num_bands == 1 ? planes[p].width
b_height = planes[p].num_bands == 1 ? planes[p].height : (planes[p].height + 1) >> 1; : (planes[p].width + 1) >> 1;
b_height = planes[p].num_bands == 1 ? planes[p].height
: (planes[p].height + 1) >> 1;
/* luma band buffers will be aligned on 16x16 (max macroblock size) */ /* luma band buffers will be aligned on 16x16 (max macroblock size) */
/* chroma band buffers will be aligned on 8x8 (max macroblock size) */ /* chroma band buffers will be aligned on 8x8 (max macroblock size) */
...@@ -278,8 +285,8 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg) ...@@ -278,8 +285,8 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
if (!band->bufs[2]) if (!band->bufs[2])
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
/* reset custom vlc */
planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0; /* reset custom vlc */ planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0;
} }
} }
...@@ -831,7 +838,8 @@ static int decode_band(IVI45DecContext *ctx, ...@@ -831,7 +838,8 @@ static int decode_band(IVI45DecContext *ctx,
} }
} }
/* restore the selected rvmap table by applying its corrections in reverse order */ /* restore the selected rvmap table by applying its corrections in
* reverse order */
for (i = band->num_corr-1; i >= 0; i--) { for (i = band->num_corr-1; i >= 0; i--) {
idx1 = band->corr[i*2]; idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1]; idx2 = band->corr[i*2+1];
...@@ -844,7 +852,8 @@ static int decode_band(IVI45DecContext *ctx, ...@@ -844,7 +852,8 @@ static int decode_band(IVI45DecContext *ctx,
uint16_t chksum = ivi_calc_band_checksum(band); uint16_t chksum = ivi_calc_band_checksum(band);
if (chksum != band->checksum) { if (chksum != band->checksum) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n", "Band checksum mismatch! Plane %d, band %d, "
"received: %x, calculated: %x\n",
band->plane, band->band_num, band->checksum, chksum); band->plane, band->band_num, band->checksum, chksum);
} }
} }
...@@ -901,10 +910,13 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -901,10 +910,13 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
//STOP_TIMER("decode_planes"); } //STOP_TIMER("decode_planes"); }
/* If the bidirectional mode is enabled, next I and the following P frame will */ /* If the bidirectional mode is enabled, next I and the following P
/* be sent together. Unfortunately the approach below seems to be the only way */ * frame will be sent together. Unfortunately the approach below seems
/* to handle the B-frames mode. That's exactly the same Intel decoders do. */ * to be the only way to handle the B-frames mode.
if (avctx->codec_id == AV_CODEC_ID_INDEO4 && ctx->frame_type == 0/*FRAMETYPE_INTRA*/) { * That's exactly the same Intel decoders do.
*/
if (avctx->codec_id == AV_CODEC_ID_INDEO4 &&
ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
while (get_bits(&ctx->gb, 8)); // skip version string while (get_bits(&ctx->gb, 8)); // skip version string
skip_bits_long(&ctx->gb, 64); // skip padding, TODO: implement correct 8-bytes alignment skip_bits_long(&ctx->gb, 64); // skip padding, TODO: implement correct 8-bytes alignment
if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8) if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8)
......
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