[x264-devel] Re: x264 library starting point
Alex Izvorski
aizvorski at gmail.com
Wed Dec 6 06:36:40 CET 2006
On Wed, 2006-12-06 at 12:12 +0800, Michigaki wrote:
> I see. Is there a way to see how they call these functions? We wanted
> to see the flow of function calls in the library. Actually, we want to
> know what a certain piece of code does (which code in particular) and
> its purpose in the library (this we can get from the link Guillaume
> gave us).
>
> I would also like to know if there are any available file listings
> online which include file descriptions and such?
>
> Thanks again.
This call graph may be of interest:
http://www.geocities.com/x264hack/x264-callgraph-sm.png
It is from a very old version of x264, much has changed since. Perhaps
I can make an updated version.
Creating documentation with doxygen also produces good results, even
though there aren't (many/any?) doxygen-specific comments. Make sure to
make it with graphviz. I can post my doxygen config file if you want.
I would like to add proper doxygen-style comments to everything,
starting with data structures, someday.
Ultimately, the best documentation right now is the source itself. If
you would like more, you may have to write it ;) I think more
documentation would be awesome, so I am 100% behind that. I imagine the
learning curve for a new developer is pretty steep.
You may get a more useful response if you ask specific questions that
show you have actually gone looking already... more like "what is
argument X to function Y used for?" than "how to call these functions?".
I suppose a "quick start" intro to using x264 might be helpful to a lot
of people. This is purely from the point of view of someone writing
code that uses the library, it doesn't touch on how it works. Also it
needs more initialization and error checking ;) and probably won't run
as written. This is it in a nutshell:
--- begin code snippet ---
x264_param_t* param = (x264_param_t*)malloc(sizeof(x264_param_t));
char* key; char* value;
while (1)
{
// multiple calls until every parameter you want is configured
x264_param_parse(param, key, value);
}
x264_t* h = x264_encoder_open(param);
x264_picture_t* pic = (x264_picture_t*)malloc(sizeof(x264_picture_t));
x264_picture_alloc(pic, X264_CSP_I420, width, height);
x264_picture_t* pic_out;
x264_nal_t* nals;
int num_nals;
while (1)
{
// copy image data to pic->img.plane[]
x264_encoder_encode(h, &nals, &num_nals, pic, pic_out);
// get compressed data
for (i = 0; i < num_nals; i++)
{
uint8_t* data; // need to allocate
int data_len = x264_nal_encode(data, &data_len_max, 1, &nal[i]);
// do something with compressed data - write to file, etc.
}
}
--- end code snippet ---
Comments and suggestions for improvement welcome ;)
Regards,
--Alex
--
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html
More information about the x264-devel
mailing list