28 #if CONFIG_LIBXCB_XFIXES 29 #include <xcb/xfixes.h> 37 #if CONFIG_LIBXCB_SHAPE 38 #include <xcb/shape.h> 80 #define FOLLOW_CENTER -1 82 #define OFFSET(x) offsetof(XCBGrabContext, x) 83 #define D AV_OPT_FLAG_DECODING_PARAM 92 {
"follow_mouse",
"Move the grabbing region when the mouse pointer reaches within specified amount of pixels to the edge of region.",
94 {
"centered",
"Keep the mouse pointer at the center of grabbing region when following.", 0,
AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX,
D,
"follow_mouse" },
110 xcb_query_pointer_reply_t *p,
111 xcb_get_geometry_reply_t *geo)
114 int x = c->
x,
y = c->
y;
129 int right = x + w -
f;
131 int bottom =
y +
h -
f;
134 }
else if (p_x < left) {
139 }
else if (p_y < top) {
158 xcb_get_image_cookie_t iq;
159 xcb_get_image_reply_t *
img;
160 xcb_drawable_t drawable = c->
screen->root;
161 xcb_generic_error_t *e =
NULL;
165 iq = xcb_get_image(c->
conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable,
168 img = xcb_get_image_reply(c->
conn, iq, &e);
172 "Cannot get the image data " 173 "event_error: response_type:%u error_code:%u " 174 "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
175 e->response_type, e->error_code,
176 e->sequence, e->resource_id, e->minor_code, e->major_code);
184 data = xcb_get_image_data(img);
185 length = xcb_get_image_data_length(img);
204 int64_t curtime, delay;
219 #if CONFIG_LIBXCB_SHM 220 static int check_shm(xcb_connection_t *
conn)
222 xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(conn);
223 xcb_shm_query_version_reply_t *reply;
225 reply = xcb_shm_query_version_reply(conn, cookie,
NULL);
234 static void free_shm_buffer(
void *opaque,
uint8_t *
data)
241 xcb_connection_t *
conn = opaque;
247 id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
251 segment = xcb_generate_id(conn);
252 xcb_shm_attach(conn, segment,
id, 0);
253 data = shmat(
id,
NULL, 0);
254 shmctl(
id, IPC_RMID, 0);
255 if ((intptr_t)data == -1 || !data)
258 ref =
av_buffer_create(data, size, free_shm_buffer, (
void *)(ptrdiff_t)segment, 0);
268 xcb_shm_get_image_cookie_t iq;
269 xcb_shm_get_image_reply_t *
img;
270 xcb_drawable_t drawable = c->
screen->root;
271 xcb_generic_error_t *e =
NULL;
282 iq = xcb_shm_get_image(c->
conn, drawable,
284 XCB_IMAGE_FORMAT_Z_PIXMAP, segment, 0);
285 img = xcb_shm_get_image_reply(c->
conn, iq, &e);
291 "Cannot get the image data " 292 "event_error: response_type:%u error_code:%u " 293 "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
294 e->response_type, e->error_code,
295 e->sequence, e->resource_id, e->minor_code, e->major_code);
314 #if CONFIG_LIBXCB_XFIXES 315 static int check_xfixes(xcb_connection_t *
conn)
317 xcb_xfixes_query_version_cookie_t cookie;
318 xcb_xfixes_query_version_reply_t *reply;
320 cookie = xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION,
321 XCB_XFIXES_MINOR_VERSION);
322 reply = xcb_xfixes_query_version_reply(conn, cookie,
NULL);
331 #define BLEND(target, source, alpha) \ 332 (target) + ((source) * (255 - (alpha)) + 255 / 2) / 255 335 xcb_query_pointer_reply_t *p,
336 xcb_get_geometry_reply_t *geo)
342 xcb_xfixes_get_cursor_image_cookie_t cc;
343 xcb_xfixes_get_cursor_image_reply_t *ci;
344 int cx, cy,
x,
y,
w,
h, c_off, i_off;
346 cc = xcb_xfixes_get_cursor_image(gr->
conn);
347 ci = xcb_xfixes_get_cursor_image_reply(gr->
conn, cc,
NULL);
351 cursor = xcb_xfixes_get_cursor_image_cursor_image(ci);
355 cx = ci->x - ci->xhot;
356 cy = ci->y - ci->yhot;
367 cursor += (y - cy) * ci->width;
370 for (y = 0; y <
h; y++) {
373 for (x = 0; x <
w; x++, cursor++, image +=
stride) {
377 g = (*cursor >> 8) & 0xff;
378 b = (*cursor >> 16) & 0xff;
379 a = (*cursor >> 24) & 0xff;
389 image[0] = BLEND(r, image[0], a);
390 image[1] = BLEND(g, image[1], a);
391 image[2] = BLEND(b, image[2], a);
395 cursor += ci->width - w - c_off;
396 image += (gr->
width - w - i_off) * stride;
409 xcb_configure_window(c->
conn,
411 XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
418 xcb_query_pointer_cookie_t pc;
419 xcb_get_geometry_cookie_t gc;
420 xcb_query_pointer_reply_t *p =
NULL;
421 xcb_get_geometry_reply_t *geo =
NULL;
429 pc = xcb_query_pointer(c->
conn, c->
screen->root);
430 gc = xcb_get_geometry(c->
conn, c->
screen->root);
431 p = xcb_query_pointer_reply(c->
conn, pc,
NULL);
436 geo = xcb_get_geometry_reply(c->
conn, gc,
NULL);
450 #if CONFIG_LIBXCB_SHM 451 if (c->
has_shm && xcbgrab_frame_shm(s, pkt) < 0) {
461 #if CONFIG_LIBXCB_XFIXES 462 if (ret >= 0 && c->
draw_mouse && p->same_screen)
463 xcbgrab_draw_mouse(s, pkt, p, geo);
476 #if CONFIG_LIBXCB_SHM 480 xcb_disconnect(ctx->
conn);
485 static xcb_screen_t *
get_screen(
const xcb_setup_t *setup,
int screen_num)
487 xcb_screen_iterator_t
it = xcb_setup_roots_iterator(setup);
490 for (; it.rem > 0; xcb_screen_next (&it)) {
506 const xcb_setup_t *setup = xcb_get_setup(c->
conn);
507 const xcb_format_t *fmt = xcb_setup_pixmap_formats(setup);
508 int length = xcb_setup_pixmap_formats_length(setup);
513 if (fmt->depth == depth) {
516 if (fmt->bits_per_pixel == 32)
517 *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ?
521 if (fmt->bits_per_pixel == 32)
522 *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ?
524 else if (fmt->bits_per_pixel == 24)
525 *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ?
529 if (fmt->bits_per_pixel == 16)
530 *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ?
534 if (fmt->bits_per_pixel == 16)
535 *pix_fmt = setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST ?
539 if (fmt->bits_per_pixel == 8)
546 *bpp = fmt->bits_per_pixel;
561 xcb_get_geometry_cookie_t gc;
562 xcb_get_geometry_reply_t *geo;
563 int64_t frame_size_bits;
575 gc = xcb_get_geometry(c->
conn, c->
screen->root);
576 geo = xcb_get_geometry_reply(c->
conn, gc,
NULL);
581 c->
width = geo->width;
585 if (c->
x + c->
width > geo->width ||
586 c->
y + c->
height > geo->height) {
588 "Capture area %dx%d at position %d.%d " 589 "outside the screen size %dx%d\n",
592 geo->width, geo->height);
614 #if CONFIG_LIBXCB_SHM 616 c->
conn, allocate_shm_buffer,
NULL);
633 xcb_gcontext_t gc = xcb_generate_id(c->
conn);
634 uint32_t
mask = XCB_GC_FOREGROUND |
642 XCB_LINE_STYLE_DOUBLE_DASH,
643 XCB_FILL_STYLE_SOLID };
644 xcb_rectangle_t
r = { 1, 1,
648 xcb_create_gc(c->
conn, gc, c->
window, mask, values);
650 xcb_poly_rectangle(c->
conn, c->
window, gc, 1, &r);
656 uint32_t
mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
658 XCB_EVENT_MASK_EXPOSURE |
659 XCB_EVENT_MASK_STRUCTURE_NOTIFY };
664 xcb_create_window(c->
conn, XCB_COPY_FROM_PARENT,
672 XCB_WINDOW_CLASS_INPUT_OUTPUT,
673 XCB_COPY_FROM_PARENT,
676 #if CONFIG_LIBXCB_SHAPE 677 xcb_shape_rectangles(c->
conn, XCB_SHAPE_SO_SUBTRACT,
678 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
689 #define CROSSHAIR_CURSOR 34 692 xcb_point_t *corner_b)
694 xcb_rectangle_t rectangle;
695 rectangle.x =
FFMIN(corner_a->x, corner_b->x);
696 rectangle.y =
FFMIN(corner_a->y, corner_b->y);
697 rectangle.width =
FFABS(corner_a->x - corner_b->x);
698 rectangle.height =
FFABS(corner_a->y - corner_b->y);
708 int ret = 0, done = 0, was_pressed = 0;
710 xcb_font_t cursor_font;
711 xcb_point_t press_position;
712 xcb_generic_event_t *event;
713 xcb_rectangle_t rectangle = { 0 };
714 xcb_grab_pointer_reply_t *reply;
715 xcb_grab_pointer_cookie_t cookie;
717 xcb_window_t root_window = screen->root;
718 xcb_gcontext_t gc = xcb_generate_id(conn);
719 uint32_t
mask = XCB_GC_FUNCTION | XCB_GC_SUBWINDOW_MODE;
720 uint32_t
values[] = { XCB_GX_INVERT, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS };
721 xcb_create_gc(conn, gc, root_window, mask, values);
723 cursor_font = xcb_generate_id(conn);
724 xcb_open_font(conn, cursor_font, strlen(
"cursor"),
"cursor");
725 cursor = xcb_generate_id(conn);
726 xcb_create_glyph_cursor(conn, cursor, cursor_font, cursor_font,
728 0xFFFF, 0xFFFF, 0xFFFF);
729 cookie = xcb_grab_pointer(conn, 0, root_window,
730 XCB_EVENT_MASK_BUTTON_PRESS |
731 XCB_EVENT_MASK_BUTTON_RELEASE |
732 XCB_EVENT_MASK_BUTTON_MOTION,
733 XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
734 root_window, cursor, XCB_CURRENT_TIME);
735 reply = xcb_grab_pointer_reply(conn, cookie,
NULL);
736 if (!reply || reply->status != XCB_GRAB_STATUS_SUCCESS) {
738 "Failed to select region. Could not grab pointer.\n");
745 xcb_grab_server(conn);
747 while (!done && (event = xcb_wait_for_event(conn))) {
748 switch (event->response_type & ~0x80) {
749 case XCB_BUTTON_PRESS: {
750 xcb_button_press_event_t *press = (xcb_button_press_event_t *)event;
751 press_position = (xcb_point_t){ press->event_x, press->event_y };
752 rectangle.x = press_position.x;
753 rectangle.y = press_position.y;
754 xcb_poly_rectangle(conn, root_window, gc, 1, &rectangle);
758 case XCB_MOTION_NOTIFY: {
760 xcb_motion_notify_event_t *motion =
761 (xcb_motion_notify_event_t *)event;
762 xcb_point_t cursor_position = { motion->event_x, motion->event_y };
763 xcb_poly_rectangle(conn, root_window, gc, 1, &rectangle);
765 xcb_poly_rectangle(conn, root_window, gc, 1, &rectangle);
769 case XCB_BUTTON_RELEASE: {
770 xcb_poly_rectangle(conn, root_window, gc, 1, &rectangle);
780 c->
width = rectangle.width;
781 c->
height = rectangle.height;
789 xcb_ungrab_server(conn);
790 xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
794 xcb_free_cursor(conn, cursor);
795 xcb_close_font(conn, cursor_font);
796 xcb_free_gc(conn, gc);
804 const xcb_setup_t *setup;
810 if (!sscanf(s->
url,
"%[^+]+%d,%d", display_name, &c->
x, &c->
y)) {
812 sscanf(s->
url,
"+%d,%d", &c->
x, &c->
y);
815 c->
conn = xcb_connect(display_name[0] ? display_name :
NULL, &screen_num);
818 if ((ret = xcb_connection_has_error(c->
conn))) {
820 s->
url[0] ? s->
url :
"default", ret);
824 setup = xcb_get_setup(c->
conn);
849 #if CONFIG_LIBXCB_SHM 853 #if CONFIG_LIBXCB_XFIXES 857 "XFixes not available, cannot draw the mouse.\n");
881 .priv_class = &xcbgrab_class,
static xcb_screen_t * get_screen(const xcb_setup_t *setup, int screen_num)
AVInputFormat ff_xcbgrab_demuxer
void * av_buffer_pool_buffer_get_opaque(AVBufferRef *ref)
Query the original opaque parameter of an allocated buffer in the pool.
static enum AVPixelFormat pix_fmt
static av_cold int xcbgrab_read_header(AVFormatContext *s)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
static int create_stream(AVFormatContext *s)
ptrdiff_t const GLvoid * data
static void xcbgrab_update_region(AVFormatContext *s)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
packed RGB 8:8:8, 24bpp, RGBRGB...
static void draw_rectangle(AVFormatContext *s)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
const char * av_default_item_name(void *ptr)
Return the context name.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int av_usleep(unsigned usec)
Sleep for a period of time.
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static const AVClass xcbgrab_class
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
static int pixfmt_from_pixmap_format(AVFormatContext *s, int depth, int *pix_fmt, int *bpp)
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s it
static int xcbgrab_frame(AVFormatContext *s, AVPacket *pkt)
static av_cold int read_close(AVFormatContext *ctx)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
char * url
input or output URL.
enum AVMediaType codec_type
General type of the encoded data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
AVRational avg_frame_rate
Average framerate.
common internal API header
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static const AVOption options[]
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
packed RGB 8:8:8, 24bpp, BGRBGR...
AVBufferPool * av_buffer_pool_init2(int size, void *opaque, AVBufferRef *(*alloc)(void *opaque, int size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator.
static int read_header(FFV1Context *f)
int64_t av_gettime(void)
Get the current time in microseconds.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static xcb_rectangle_t rectangle_from_corners(xcb_point_t *corner_a, xcb_point_t *corner_b)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
char * av_strdup(const char *s)
Duplicate a string.
static int64_t wait_frame(AVFormatContext *s, AVPacket *pkt)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
uint8_t * data
The data buffer.
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
Describe the class of an AVClass context structure.
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
Rational number (pair of numerator and denominator).
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
offset must point to two consecutive integers
static void xcbgrab_image_reply_free(void *opaque, uint8_t *data)
static void setup_window(AVFormatContext *s)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
#define flags(name, subs,...)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
static int xcbgrab_reposition(AVFormatContext *s, xcb_query_pointer_reply_t *p, xcb_get_geometry_reply_t *geo)
A reference to a data buffer.
GLint GLenum GLboolean GLsizei stride
static int ref[MAX_W *MAX_W]
static av_cold int xcbgrab_read_close(AVFormatContext *s)
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void * priv_data
Format private data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
#define AVERROR_EXTERNAL
Generic error in an external library.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...