Go to the documentation of this file.
36 #define CHARSET_CHARS 256
38 #define CROP_SCREENS 1
72 int blockx, blocky,
x, y;
78 for (blocky = 0; blocky <
C64YRES; blocky += 8) {
79 for (blockx = 0; blockx <
C64XRES; blockx += 8) {
80 for (y = blocky; y < blocky + 8 && y <
C64YRES; y++) {
81 for (
x = blockx;
x < blockx + 8 &&
x <
C64XRES;
x += 2) {
108 int lowdiff, highdiff;
109 int *best_cb =
c->mc_best_cb;
118 for (
a=0;
a < 256;
a++) {
119 if(i < c->mc_pal_size -1 &&
a ==
c->mc_luma_vals[
i + 1]) {
126 if(
i >=
c->mc_pal_size - 1)
dither[
a] = 0;
128 index2[
a] =
FFMIN(
i + 1,
c->mc_pal_size - 1);
135 for (y = 0; y < 8; y++) {
137 for (
x = 0;
x < 4;
x++) {
138 pix = best_cb[y * 4 +
x];
141 if (index1[pix] >= 3)
142 highdiff += pix -
c->mc_luma_vals[3];
144 lowdiff +=
c->mc_luma_vals[1] - pix;
151 row1 |= 3-(index2[pix] & 3);
153 row1 |= 3-(index1[pix] & 3);
156 row2 |= 3-(index2[pix] & 3);
158 row2 |= 3-(index1[pix] & 3);
162 row1 |= 3-(index2[pix] & 3);
164 row1 |= 3-(index1[pix] & 3);
167 charset[y+0x000] = row1;
171 if (highdiff > 0 && lowdiff > 0 &&
c->mc_use_5col) {
172 if (lowdiff > highdiff) {
173 for (
x = 0;
x < 32;
x++)
174 best_cb[
x] =
FFMIN(
c->mc_luma_vals[3], best_cb[
x]);
176 for (
x = 0;
x < 32;
x++)
177 best_cb[
x] =
FFMAX(
c->mc_luma_vals[1], best_cb[
x]);
187 colrammap[charpos] = (highdiff > 0);
217 c->mc_frame_counter = 0;
219 c->mc_pal_size = 4 +
c->mc_use_5col;
222 for (
a = 0;
a <
c->mc_pal_size;
a++) {
260 for (
a = 0;
a < 256;
a++) {
261 temp = colram[charmap[
a + 0x000]] << 0;
262 temp |= colram[charmap[
a + 0x100]] << 1;
263 temp |= colram[charmap[
a + 0x200]] << 2;
264 if (
a < 0xe8)
temp |= colram[charmap[
a + 0x300]] << 3;
270 const AVFrame *p,
int *got_packet)
282 int *charmap =
c->mc_charmap;
285 int *meta =
c->mc_meta_charset;
286 int *best_cb =
c->mc_best_cb;
289 int colram_size = 0x100 *
c->mc_use_5col;
295 screen_size = b_width * b_height;
305 if (!
c->mc_lifetime)
return 0;
307 if (!
c->mc_frame_counter) {
311 else c->mc_lifetime =
c->mc_frame_counter;
315 if (
c->mc_frame_counter <
c->mc_lifetime) {
317 c->mc_frame_counter++;
319 c->next_pts = p->
pts;
326 if (
c->mc_frame_counter ==
c->mc_lifetime) {
329 if (
c->mc_lifetime) {
330 int alloc_size = charset_size +
c->mc_lifetime*(screen_size + colram_size);
349 memcpy(buf, charset, charset_size);
353 req_size += charset_size;
359 for (y = 0; y < b_height; y++) {
360 for (
x = 0;
x < b_width;
x++) {
361 buf[y * b_width +
x] = charmap[y * b_width +
x];
366 req_size += screen_size;
369 if (
c->mc_use_5col) {
373 req_size += colram_size;
385 c->mc_frame_counter = 0;
393 *got_packet = !!req_size;
398 #if CONFIG_A64MULTI_ENCODER
412 #if CONFIG_A64MULTI5_ENCODER
415 .long_name =
NULL_IF_CONFIG_SMALL(
"Multicolor charset for Commodore 64, extended with 5th color (colram)"),
static const uint8_t mc_colors[5]
AVPixelFormat
Pixel format.
static av_cold int a64multi_close_encoder(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
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
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold int a64multi_encode_init(AVCodecContext *avctx)
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const struct AVCodec * codec
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
static void to_meta_with_crop(AVCodecContext *avctx, const AVFrame *p, int *dest)
int global_quality
Global quality for codecs which cannot change it per frame.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static enum AVPixelFormat pix_fmts[]
static void render_charset(AVCodecContext *avctx, uint8_t *charset, uint8_t *colrammap)
static const uint8_t multi_dither_patterns[9][4][4]
dither patterns used vor rendering the multicolor charset
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVCodec ff_a64multi5_encoder
int avpriv_init_elbg(int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
Initialize the **codebook vector for the elbg algorithm.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
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
Context structure for the Lagged Fibonacci PRNG.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void a64_compress_colram(unsigned char *buf, int *charmap, uint8_t *colram)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
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
static const uint8_t a64_palette[16][3]
int flags
A combination of AV_PKT_FLAG values.
#define AV_LOG_INFO
Standard information.
static const uint8_t interlaced_dither_patterns[9][8][4]
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
unsigned mc_frame_counter
const char * name
Name of the codec implementation.
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 or at least make progress towards producing a frame
#define AV_INPUT_BUFFER_PADDING_SIZE
AVCodec ff_a64multi_encoder
main external API structure.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
int width
picture width / height.
static float distance(float x, float y, int band)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
int avpriv_do_elbg(int *points, int dim, int numpoints, int *codebook, int numCB, int max_steps, int *closest_cb, AVLFG *rand_state)
Implementation of the Enhanced LBG Algorithm Based on the paper "Neural Networks 14:1219-1237" that c...
static const uint8_t dither[8][8]