On 12/07/2011 03:41 PM, Kostya Shishkov wrote:
+
+/**
+ * Decode an Indeo4 band.
+ *
+ * @param[in,out] ctx pointer to the decoder context
+ * @param[in,out] band pointer to the band descriptor
+ * @param[in] avctx pointer to the AVCodecContext
+ * @return result code: 0 = OK, negative number = error
+ */
+static int decode_band(IVI4DecContext *ctx, int plane_num,
+ IVIBandDesc *band, AVCodecContext *avctx)
+{
+ int result, i, t, pos, idx1, idx2;
+ IVITile *tile;
+
+ band->buf = band->bufs[ctx->dst_buf];
+ band->ref_buf = band->bufs[ctx->ref_buf];
+
+ result = decode_band_hdr(ctx, band, avctx);
+ if (result) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding band header\n");
+ return result;
+ }
+
+ if (band->is_empty) {
+ av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ band->rv_map =&ctx->rvmap_tabs[band->rvmap_sel];
+
+ /* apply corrections to the selected rvmap table if present */
+ for (i = 0; i< band->num_corr; i++) {
+ idx1 = band->corr[i * 2];
+ idx2 = band->corr[i * 2 + 1];
+ FFSWAP(uint8_t, band->rv_map->runtab[idx1],
band->rv_map->runtab[idx2]);
+ FFSWAP(int16_t, band->rv_map->valtab[idx1],
band->rv_map->valtab[idx2]);
+ }
+
+ pos = get_bits_count(&ctx->gb);
+
+ for (t = 0; t< band->num_tiles; t++) {
+ tile =&band->tiles[t];
+
+ tile->is_empty = get_bits1(&ctx->gb);
+ if (tile->is_empty) {
+ ff_ivi_process_empty_tile(avctx, band, tile,
+ (ctx->planes[0].bands[0].mb_size>> 3) -
(band->mb_size>> 3));
+ //av_log(avctx, AV_LOG_WARNING, "Empty tile encountered!\n");
+ } else {
+ tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
+ if (!tile->data_size) {
+ av_log(avctx, AV_LOG_ERROR, "Tile data size is zero!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ result = decode_mb_info(ctx, band, tile, avctx);
+ if (result< 0)
+ break;
Is it intentional to skip the propagation of the error code here ?
Looks good to me otherwise.
MvH
Benjamin Larsson
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel