Go to the documentation of this file.
28 #define UNCHECKED_BITSTREAM_READER 1
79 s->quant_precision = 5;
82 s->unrestricted_mv = 1;
88 s->unrestricted_mv = 0;
95 s->msmpeg4_version = 1;
99 s->msmpeg4_version = 2;
103 s->msmpeg4_version = 3;
107 s->msmpeg4_version = 4;
111 s->msmpeg4_version = 5;
119 s->msmpeg4_version = 6;
170 if (
s->divx_packed ||
s->avctx->hwaccel) {
175 pos -=
s->parse_context.last_index;
185 if (
pos + 10 > buf_size)
194 const int part_mask =
s->partitioned_frame
196 const int mb_size = 16 >>
s->avctx->lowres;
199 s->last_resync_gb =
s->gb;
200 s->first_slice_line = 1;
201 s->resync_mb_x =
s->mb_x;
202 s->resync_mb_y =
s->mb_y;
206 if (
s->studio_profile) {
211 if (
s->avctx->hwaccel) {
213 ret =
s->avctx->hwaccel->decode_slice(
s->avctx, start,
s->gb.buffer_end - start);
215 s->mb_y =
s->mb_height;
219 if (
s->partitioned_frame) {
220 const int qscale =
s->qscale;
227 s->first_slice_line = 1;
228 s->mb_x =
s->resync_mb_x;
229 s->mb_y =
s->resync_mb_y;
233 for (;
s->mb_y <
s->mb_height;
s->mb_y++) {
235 if (
s->msmpeg4_version) {
236 if (
s->resync_mb_y +
s->slice_height ==
s->mb_y) {
244 if (
s->msmpeg4_version == 1) {
251 for (;
s->mb_x <
s->mb_width;
s->mb_x++) {
256 if (
s->resync_mb_x ==
s->mb_x &&
s->resync_mb_y + 1 ==
s->mb_y)
257 s->first_slice_line = 0;
267 ret =
s->decode_mb(
s,
s->block);
273 const int xy =
s->mb_x +
s->mb_y *
s->mb_stride;
282 s->padding_bug_score--;
284 if (++
s->mb_x >=
s->mb_width) {
293 "Slice mismatch at MB: %d\n", xy);
295 s->mb_x + 1,
s->mb_y,
326 !
s->data_partitioning)
327 s->padding_bug_score += 32;
334 !
s->data_partitioning) {
336 const int bits_left =
s->gb.size_in_bits - bits_count;
338 if (bits_left == 0) {
339 s->padding_bug_score += 16;
340 }
else if (bits_left != 1) {
342 v |= 0x7F >> (7 - (bits_count & 7));
344 if (v == 0x7F && bits_left <= 8)
345 s->padding_bug_score--;
348 s->padding_bug_score += 4;
350 s->padding_bug_score++;
360 !
s->data_partitioning) {
362 s->padding_bug_score += 32;
368 AV_RB64(
s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
370 s->padding_bug_score += 32;
375 (
s->padding_bug_score > -2 && !
s->data_partitioning))
396 max_extra += 256 * 256 * 256 * 64;
398 if (
left > max_extra)
400 "discarding %d junk bits at end, next would be %X\n",
412 "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
425 int buf_size = avpkt->
size;
434 if (
s->low_delay == 0 &&
s->next_picture_ptr) {
437 s->next_picture_ptr =
NULL;
456 "this codec does not support truncated bitstreams\n");
466 if (
s->divx_packed &&
s->bitstream_buffer_size) {
468 for(
i=0;
i < buf_size-3;
i++) {
469 if (buf[
i]==0 && buf[
i+1]==0 && buf[
i+2]==1) {
470 if (buf[
i+3]==0xB0) {
472 s->bitstream_buffer_size = 0;
479 if (
s->bitstream_buffer_size && (
s->divx_packed || buf_size <=
MAX_NVOP_SIZE))
481 s->bitstream_buffer_size);
485 s->bitstream_buffer_size = 0;
489 if (!
s->context_initialized)
499 if (
s->avctx->extradata_size &&
s->picture_number == 0) {
502 if (
init_get_bits8(&gb,
s->avctx->extradata,
s->avctx->extradata_size) >= 0 )
517 av_log(
s->avctx,
AV_LOG_WARNING,
"Reverting picture dimensions change due to header decoding failure\n");
531 if (!
s->context_initialized) {
537 if (!
s->current_picture_ptr ||
s->current_picture_ptr->f->data[0]) {
541 s->current_picture_ptr = &
s->picture[
i];
549 if (
s->studio_profile != (
s->idsp.idct ==
NULL))
561 s->context_reinit = 0;
585 s->current_picture.f->pict_type =
s->pict_type;
589 if (!
s->last_picture_ptr &&
599 if (
s->next_p_frame_damaged) {
603 s->next_p_frame_damaged = 0;
607 s->me.qpel_put =
s->qdsp.put_qpel_pixels_tab;
608 s->me.qpel_avg =
s->qdsp.avg_qpel_pixels_tab;
610 s->me.qpel_put =
s->qdsp.put_no_rnd_qpel_pixels_tab;
611 s->me.qpel_avg =
s->qdsp.avg_qpel_pixels_tab;
617 if (!
s->divx_packed && !avctx->
hwaccel)
622 s->gb.buffer_end -
s->gb.buffer);
645 while (
s->mb_y <
s->mb_height) {
646 if (
s->msmpeg4_version) {
647 if (
s->slice_height == 0 ||
s->mb_x != 0 || slice_ret < 0 ||
651 int prev_x =
s->mb_x, prev_y =
s->mb_y;
654 if (prev_y *
s->mb_width + prev_x < s->mb_y *
s->mb_width +
s->mb_x)
655 s->er.error_occurred = 1;
658 if (
s->msmpeg4_version < 4 &&
s->h263_pred)
665 if (
s->msmpeg4_version &&
s->msmpeg4_version < 4 &&
673 if (!
s->studio_profile)
687 if (!
s->divx_packed && avctx->
hwaccel)
690 av_assert1(
s->current_picture.f->pict_type ==
s->current_picture_ptr->f->pict_type);
691 av_assert1(
s->current_picture.f->pict_type ==
s->pict_type);
697 }
else if (
s->last_picture_ptr) {
704 if (
s->last_picture_ptr ||
s->low_delay) {
709 for (p=0; p<3; p++) {
713 for (y=0; y<(
h>>1); y++)
716 pict->
data[p][
x + y*linesize],
717 pict->
data[p][
x + (
h-1-y)*linesize]);
730 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
733 #if CONFIG_MPEG4_NVDEC_HWACCEL
736 #if CONFIG_MPEG4_VDPAU_HWACCEL
739 #if CONFIG_H263_VIDEOTOOLBOX_HWACCEL || CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL
747 #if CONFIG_H263_VAAPI_HWACCEL
750 #if CONFIG_MPEG4_NVDEC_HWACCEL
753 #if CONFIG_MPEG4_VDPAU_HWACCEL
756 #if CONFIG_H263_VIDEOTOOLBOX_HWACCEL
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define CONFIG_MSMPEG4_DECODER
#define MV_TYPE_16X16
1 vector for the whole mb
int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
AVPixelFormat
Pixel format.
static av_cold int init(AVCodecContext *avctx)
#define H263_GOB_HEIGHT(h)
static int get_bits_left(GetBitContext *gb)
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
#define CONFIG_H263_DECODER
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
#define FFSWAP(type, a, b)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
av_cold void ff_qpeldsp_init(QpelDSPContext *c)
static int get_bits_count(const GetBitContext *s)
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
#define AV_CODEC_CAP_TRUNCATED
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 ff_mpv_common_frame_size_change(MpegEncContext *s)
#define CONFIG_WMV2_DECODER
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
void ff_init_block_index(MpegEncContext *s)
#define AV_EF_BUFFER
detect improper bitstream length
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int ff_msmpeg4_decode_ext_header(MpegEncContext *s, int buf_size)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
Decode the first and second partition.
const struct AVCodec * codec
enum AVDiscard skip_frame
Skip decoding for selected frames.
static int decode_slice(MpegEncContext *s)
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_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
av_cold void ff_h263dsp_init(H263DSPContext *ctx)
int flags
AV_CODEC_FLAG_*.
#define HWACCEL_VDPAU(codec)
#define SLICE_END
end marker found
void ff_h263_update_motion_val(MpegEncContext *s)
void ff_h263_decode_init_vlc(void)
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
void ff_mpv_common_end(MpegEncContext *s)
int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
Decode the next video packet.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
int has_b_frames
Size of the frame reordering buffer in the decoder.
#define AV_CEIL_RSHIFT(a, b)
static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
#define FF_BUG_NO_PADDING
void ff_mpeg_er_frame_start(MpegEncContext *s)
int ff_flv_decode_picture_header(MpegEncContext *s)
static enum AVPixelFormat pix_fmts[]
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int ff_msmpeg4_decode_picture_header(MpegEncContext *s)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
@ AVDISCARD_ALL
discard all
int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
static void flush(AVCodecContext *avctx)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
av_cold void ff_mpv_idct_init(MpegEncContext *s)
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
#define SLICE_NOEND
no end marker or error found but mb count exceeded
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
@ AV_PICTURE_TYPE_I
Intra.
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
#define AV_CODEC_FLAG_TRUNCATED
Input bitstream might be truncated at a random location instead of only at frame boundaries.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define AV_EF_EXPLODE
abort decoding on minor error detection
@ AVCOL_RANGE_UNSPECIFIED
av_cold int ff_h263_decode_end(AVCodecContext *avctx)
int ff_intel_h263_decode_picture_header(MpegEncContext *s)
const AVCodecHWConfigInternal * ff_h263_hw_config_list[]
@ AVDISCARD_NONKEY
discard all frames except keyframes
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_EF_IGNORE_ERR
ignore errors and continue
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_h263_resync(MpegEncContext *s)
Decode the group of blocks / video packet header / slice header (MPEG-4 Studio).
void ff_mpeg4_clean_buffers(MpegEncContext *s)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define FF_QSCALE_TYPE_MPEG1
void ff_mpeg_flush(AVCodecContext *avctx)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type)
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb, int header)
Decode MPEG-4 headers.
void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
#define HWACCEL_NVDEC(codec)
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
static void ff_update_block_index(MpegEncContext *s)
static int get_consumed_bytes(MpegEncContext *s, int buf_size)
Return the number of bytes consumed for building the current frame.
@ AV_PIX_FMT_VIDEOTOOLBOX
hardware decoding through Videotoolbox
#define CONFIG_H263I_DECODER
#define i(width, name, range_min, range_max)
enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define FF_BUG_AUTODETECT
autodetection
const char * name
Name of the codec implementation.
av_cold int ff_h263_decode_init(AVCodecContext *avctx)
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
void ff_mpv_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void ff_mpv_frame_end(MpegEncContext *s)
@ AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
#define CONFIG_MPEG4_DECODER
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 ug o o w
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call ff_thread_finish_setup() afterwards. If some code can 't be moved
void ff_h263_loop_filter(MpegEncContext *s)
int ff_h263_decode_picture_header(MpegEncContext *s)
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
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
main external API structure.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
static void frame_end(MpegEncContext *s)
void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
#define AV_EF_AGGRESSIVE
consider things that a sane encoder should not do as an error
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
int coded_width
Bitstream width / height, may be different from width/height e.g.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
void ff_er_frame_end(ERContext *s)
#define HWACCEL_VAAPI(codec)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
void ff_mpv_report_decode_progress(MpegEncContext *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_h263_decode_mb(MpegEncContext *s, int16_t block[6][64])
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
@ AVDISCARD_NONREF
discard all non reference
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
int ff_wmv2_decode_picture_header(MpegEncContext *s)
#define CONFIG_H263P_DECODER
#define CONFIG_FLV_DECODER