Lines Matching refs:region

177 static void delete_region_display_list(DVBSubContext *ctx, DVBSubRegion *region)
182 while (region->display_list) {
183 display = region->display_list;
216 region->display_list = display->region_list_next;
248 DVBSubRegion *region = ctx->region_list;
250 ctx->region_list = region->next;
252 delete_region_display_list(ctx, region);
254 av_freep(&region->pbuf);
255 av_freep(&region);
734 DVBSubRegion *region;
754 region = get_region(ctx, display->region_id);
755 if (region && region->dirty)
785 region = get_region(ctx, display->region_id);
787 if (!region)
790 if (!region->dirty)
796 rect->w = region->width;
797 rect->h = region->height;
798 rect->nb_colors = (1 << region->depth);
800 rect->linesize[0] = region->width;
802 clut = get_clut(ctx, region->clut);
807 switch (region->depth) {
825 memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(*clut_table));
827 rect->data[0] = av_memdup(region->pbuf, region->buf_size);
834 if (!region->has_computed_clut) {
835 compute_default_clut(ctx, region->computed_clut, rect, rect->w, rect->h);
836 region->has_computed_clut = 1;
839 memcpy(rect->data[1], region->computed_clut, sizeof(region->computed_clut));
868 DVBSubRegion *region = get_region(ctx, display->region_id);
897 if (!region)
900 pbuf = region->pbuf;
901 region->dirty = 1;
909 if ((*buf!=0xf0 && x_pos >= region->width) || y_pos >= region->height) {
910 av_log(avctx, AV_LOG_ERROR, "Invalid object location! %d-%d %d-%d %02x\n", x_pos, region->width, y_pos, region->height, *buf);
916 if (region->depth == 8)
918 else if (region->depth == 4)
923 x_pos = dvbsub_read_2bit_string(avctx, pbuf + (y_pos * region->width),
924 region->width, &buf, buf_end - buf,
928 if (region->depth < 4) {
929 av_log(avctx, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth);
933 if (region->depth == 8)
938 x_pos = dvbsub_read_4bit_string(avctx, pbuf + (y_pos * region->width),
939 region->width, &buf, buf_end - buf,
943 if (region->depth < 8) {
944 av_log(avctx, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth);
948 x_pos = dvbsub_read_8bit_string(avctx, pbuf + (y_pos * region->width),
949 region->width, &buf, buf_end - buf,
978 region->has_computed_clut = 0;
1150 DVBSubRegion *region;
1161 region = get_region(ctx, region_id);
1163 if (!region) {
1164 region = av_mallocz(sizeof(*region));
1165 if (!region)
1168 region->id = region_id;
1169 region->version = -1;
1171 region->next = ctx->region_list;
1172 ctx->region_list = region;
1178 region->width = AV_RB16(buf);
1180 region->height = AV_RB16(buf);
1183 ret = av_image_check_size2(region->width, region->height, avctx->max_pixels, AV_PIX_FMT_PAL8, 0, avctx);
1184 if (ret >= 0 && region->width * region->height * 2 > 320 * 1024 * 8) {
1189 region->width= region->height= 0;
1193 if (region->width * region->height != region->buf_size) {
1194 av_free(region->pbuf);
1196 region->buf_size = region->width * region->height;
1198 region->pbuf = av_malloc(region->buf_size);
1199 if (!region->pbuf) {
1200 region->buf_size =
1201 region->width =
1202 region->height = 0;
1207 region->dirty = 0;
1210 region->depth = 1 << (((*buf++) >> 2) & 7);
1211 if (region->depth < 2 || region->depth > 8) {
1212 av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth);
1213 region->depth= 4;
1215 region->clut = *buf++;
1217 if (region->depth == 8) {
1218 region->bgcolor = *buf++;
1223 if (region->depth == 4)
1224 region->bgcolor = (((*buf++) >> 4) & 15);
1226 region->bgcolor = (((*buf++) >> 2) & 3);
1229 ff_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
1232 memset(region->pbuf, region->bgcolor, region->buf_size);
1233 ff_dlog(avctx, "Fill region (%d)\n", region->bgcolor);
1236 delete_region_display_list(ctx, region);
1268 if (display->x_pos >= region->width ||
1269 display->y_pos >= region->height) {
1270 av_log(avctx, AV_LOG_ERROR, "Object outside region\n");
1280 display->region_list_next = region->display_list;
1281 region->display_list = display;
1340 av_log(avctx, AV_LOG_ERROR, "duplicate region\n");