Go to the documentation of this file.
34 int motion_x,
int motion_y,
int motion_scale,
39 mb->motion_x = motion_x;
40 mb->motion_y = motion_y;
41 mb->motion_scale = motion_scale;
44 mb->src_x = dst_x + motion_x / motion_scale;
45 mb->src_y = dst_y + motion_y / motion_scale;
46 mb->source = direction ? 1 : -1;
53 int y,
int h,
int picture_structure,
57 int vshift =
desc->log2_chroma_h;
58 const int field_pic = picture_structure !=
PICT_FRAME;
91 offset[2]= (y >> vshift) *
src->linesize[1];
99 y, picture_structure,
h);
104 uint32_t *mbtype_table, int8_t *
qscale_table, int16_t (*motion_val[2])[2],
106 int mb_width,
int mb_height,
int mb_stride,
int quarter_sample)
109 const int shift = 1 + quarter_sample;
110 const int scale = 1 <<
shift;
112 const int mv_stride = (mb_width << mv_sample_log2) +
114 int mb_x, mb_y, mbcount = 0;
122 for (mb_y = 0; mb_y < mb_height; mb_y++) {
123 for (mb_x = 0; mb_x < mb_width; mb_x++) {
124 int i, direction, mb_type = mbtype_table[mb_x + mb_y * mb_stride];
125 for (direction = 0; direction < 2; direction++) {
129 for (
i = 0;
i < 4;
i++) {
130 int sx = mb_x * 16 + 4 + 8 * (
i & 1);
131 int sy = mb_y * 16 + 4 + 8 * (
i >> 1);
132 int xy = (mb_x * 2 + (
i & 1) +
133 (mb_y * 2 + (
i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
134 int mx = motion_val[direction][xy][0];
135 int my = motion_val[direction][xy][1];
136 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
139 for (
i = 0;
i < 2;
i++) {
140 int sx = mb_x * 16 + 8;
141 int sy = mb_y * 16 + 4 + 8 *
i;
142 int xy = (mb_x * 2 + (mb_y * 2 +
i) * mv_stride) << (mv_sample_log2 - 1);
143 int mx = motion_val[direction][xy][0];
144 int my = motion_val[direction][xy][1];
149 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
152 for (
i = 0;
i < 2;
i++) {
153 int sx = mb_x * 16 + 4 + 8 *
i;
154 int sy = mb_y * 16 + 8;
155 int xy = (mb_x * 2 +
i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1);
156 int mx = motion_val[direction][xy][0];
157 int my = motion_val[direction][xy][1];
162 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
165 int sx = mb_x * 16 + 8;
166 int sy = mb_y * 16 + 8;
167 int xy = (mb_x + mb_y * mv_stride) << mv_sample_log2;
168 int mx = motion_val[direction][xy][0];
169 int my = motion_val[direction][xy][1];
170 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my, scale, direction);
192 if (avctx->
hwaccel || !mbtype_table)
201 for (y = 0; y < mb_height; y++) {
202 for (
x = 0;
x < mb_width;
x++) {
204 int count = mbskip_table ? mbskip_table[
x + y * mb_stride] : 0;
214 int mb_type = mbtype_table[
x + y * mb_stride];
267 if ((avctx->
debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
271 int h_chroma_shift, v_chroma_shift, block_height;
273 const int mv_stride = (mb_width << mv_sample_log2) +
286 block_height = 16 >> v_chroma_shift;
288 for (mb_y = 0; mb_y < mb_height; mb_y++) {
290 for (mb_x = 0; mb_x < mb_width; mb_x++) {
291 const int mb_index = mb_x + mb_y * mb_stride;
292 if ((avctx->
debug & FF_DEBUG_VIS_QP)) {
294 0x0101010101010101ULL;
296 for (y = 0; y < block_height; y++) {
297 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
298 (block_height * mb_y + y) *
300 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
301 (block_height * mb_y + y) *
305 if ((avctx->
debug & FF_DEBUG_VIS_MB_TYPE) &&
307 int mb_type = mbtype_table[mb_index];
310 #define COLOR(theta, r) \
311 u = (int)(128 + r * cos(theta * M_PI / 180)); \
312 v = (int)(128 + r * sin(theta * M_PI / 180));
329 }
else if (
IS_GMC(mb_type)) {
342 u *= 0x0101010101010101ULL;
343 v *= 0x0101010101010101ULL;
344 for (y = 0; y < block_height; y++) {
345 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
346 (block_height * mb_y + y) * pict->
linesize[1]) =
u;
347 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
348 (block_height * mb_y + y) * pict->
linesize[2]) = v;
353 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 0 +
354 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
355 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 8 +
356 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
359 for (y = 0; y < 16; y++)
360 pict->
data[0][16 * mb_x + 8 + (16 * mb_y + y) *
363 if (
IS_8X8(mb_type) && mv_sample_log2 >= 2) {
364 int dm = 1 << (mv_sample_log2 - 2);
365 for (
i = 0;
i < 4;
i++) {
366 int sx = mb_x * 16 + 8 * (
i & 1);
367 int sy = mb_y * 16 + 8 * (
i >> 1);
368 int xy = (mb_x * 2 + (
i & 1) +
369 (mb_y * 2 + (
i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
372 if (
mv[0] !=
mv[dm] ||
373 mv[dm * mv_stride] !=
mv[dm * (mv_stride + 1)])
374 for (y = 0; y < 8; y++)
375 pict->
data[0][sx + 4 + (sy + y) * pict->
linesize[0]] ^= 0x80;
376 if (
mv[0] !=
mv[dm * mv_stride] ||
mv[dm] !=
mv[dm * (mv_stride + 1)])
377 *(uint64_t *)(pict->
data[0] + sx + (sy + 4) *
378 pict->
linesize[0]) ^= 0x8080808080808080ULL;
388 mbskip_table[mb_index] = 0;
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define SLICE_FLAG_CODED_ORDER
draw_horiz_band() is called in coded order instead of display
#define u(width, name, range_min, range_max)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG-2 field pics)
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
static const int8_t mv[256][2]
void * opaque
for some private data of the user
This structure describes decoded (raw) audio or video data.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
int debug_mv
debug motion vectors
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const struct AVCodec * codec
attribute_deprecated int8_t * qscale_table
QP table.
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint32_t *mbtype_table, int8_t *qscale_table, int16_t(*motion_val[2])[2], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)
Print debugging info for the given picture.
#define USES_LIST(a, list)
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int slice_flags
slice flags
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
enum AVPictureType pict_type
Picture type of the frame.
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
#define AV_NUM_DATA_POINTERS
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band.
main external API structure.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
static int shift(int a, int b)
#define AV_CODEC_EXPORT_DATA_MVS
Export motion vectors through frame side data.
int frame_number
Frame counter, set by libavcodec.
Structure to hold side data for an AVFrame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int add_mb(AVMotionVector *mb, uint32_t mb_type, int dst_x, int dst_y, int motion_x, int motion_y, int motion_scale, int direction)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
@ AV_FRAME_DATA_MOTION_VECTORS
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
static int first_field(const struct video_data *s)