示例#1
0
void hook_slice_end(const AVCodecContext *c)
{
	/* round width and height to integer macroblock multiples */
	const int width  = (2 * (c->width  + ((1 << mb_size_log) - 1)) >> mb_size_log) << mb_size_log;
	const int height = (2 * (c->height + ((1 << mb_size_log) - 1)) >> mb_size_log) << mb_size_log;
	AVPicture quad;
	
	if (c->slice.flag_last) {
		/* use per-frame storage to keep the replaced image */
		avpicture_fill(&quad, private_data(c->frame.current), c->pix_fmt, width, height);
		/* left upper quadrant: original */
		av_picture_copy(&quad, (const AVPicture *)c->frame.current, PIX_FMT_YUV420P, c->width, c->height);
		/* right upper quadrant: replacement */
		quad.data[0] += c->width;
		quad.data[1] += c->width / 2;
		quad.data[2] += c->width / 2;
		do_replacement(c, &quad, SLICE_MAX, NULL);
		/* left lower quadrant: slice error map */
		quad.data[0] += (c->height    ) * quad.linesize[0] - (c->width    );
		quad.data[1] += (c->height / 2) * quad.linesize[1] - (c->width / 2);
		quad.data[2] += (c->height / 2) * quad.linesize[2] - (c->width / 2);
		draw_slice_error(&quad);
		/* right lower quadrant: replacement with borders */
		quad.data[0] += c->width;
		quad.data[1] += c->width / 2;
		quad.data[2] += c->width / 2;
		do_replacement(c, &quad, SLICE_MAX, NULL);
		draw_border(proc.frame->replacement, &quad);
	}
}
示例#2
0
std::unique_ptr<std::vector<uint8_t>> IBConnection::get_private_data()
{
    std::unique_ptr<std::vector<uint8_t>> private_data(
        new std::vector<uint8_t>());

    return private_data;
}
//---------------------------------------------------------------------------
void File_DvbSubtitle::Data_Parse()
{
    switch (Element_Code)
    {
        case 0x10 : page_composition_segment(); break;
        case 0x11 : region_composition_segment(); break;
        case 0x12 : CLUT_definition_segment(); break;
        case 0x13 : object_data_segment(); break;
        case 0x14 : display_definition_segment(); break;
        case 0x80 : end_of_display_set_segment(); break;
        case 0xFF : end_of_PES_data_field_marker(); return;
        default   :
                    if (Element_Code>=0x40 && Element_Code<=0x7F)
                        reserved_for_future_use();
                    else if (Element_Code>=0x81 && Element_Code<=0xEF)
                        private_data();
                    else if (Element_Size)
                        Skip_XX(Element_Size,                   "Unknown");
    }
}
示例#4
0
void hook_frame_end(const AVCodecContext *c)
{
	/* round width and height to integer macroblock multiples */
	const int width  = (2 * (c->width  + ((1 << mb_size_log) - 1)) >> mb_size_log) << mb_size_log;
	const int height = (2 * (c->height + ((1 << mb_size_log) - 1)) >> mb_size_log) << mb_size_log;
	AVPicture quad;
	
	if (c->frame.display) {
		/* dump the current display image and its stored replacement to disk */
		int y;
		static FILE *vis = NULL;
		if (!vis) vis = fopen("Visualization.yuv", "w");
		avpicture_fill(&quad, private_data(c->frame.display), c->pix_fmt, width, height);
		/* Y */
		for (y = 0; y < 2 * c->height; y++)
			fwrite(quad.data[0] + y * quad.linesize[0], 1, 2 * c->width, vis);
		/* Cb */
		for (y = 0; y < c->height; y++)
			fwrite(quad.data[1] + y * quad.linesize[1], 1, c->width, vis);
		/* Cr */
		for (y = 0; y < c->height; y++)
			fwrite(quad.data[2] + y * quad.linesize[2], 1, c->width, vis);
	}
}