Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I would like to cross check a C implementation of the CRC64 ECMA-182 algorithm.
I tried a different C code snippet I found online and I tried two online CRC calculators but each of them returned different results.
Is there some reference implementation or reference data that allows me to get a reliable reference checksum?
The EMBL-EBI web site has an online checksum calculator, that is used in the context of bioinformatics for analysing protein or genome sequences:
http://www.ebi.ac.uk/Tools/so/seqcksum/
that supports many different methods, included the CRC64-ECMA-182. You can paste your input sequence directly in the form and it will return the checksum. The problem is that the input is a sequence must be one from a set of fixed formats:
http://www.ebi.ac.uk/Tools/so/seqcksum/help/index.html#sequence
However those formats are quite simple, for example the FASTA (link)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Is the ^ operator available in the C language? I have tried using it but it gives a faulty output.
Does it denote raising an integer to the power of something
It works just fine and means bitwise XOR. That is, 1^2 gives 3.
Unfortunately C doesn't provide a function to take power of integers. This is a known flaw of the language. You have to roll out such a function yourself either by using multiplication in a loop, or use the slow floating point function pow.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I need a method to extract list of all local declared variables inside a function in a C source code with their line number. Is there a possible way.. I need this list to add and intialize stub variables after the local variable declaration.
Within the context of a C program?
No. Local variables don't really "exist" in C code. They're all constructs made for the programmer's convenience. This is because humans are really bad at remembering random 64-bit numbers and variable length machine opcodes.
You can do this via external tools, but these don't work at compile time and can't alter the compiled code.
You're asking about "reflection", and C basically has zero reflection features. Either something is defined and compiles, or it isn't and it doesn't. There is no way to ask if some function or variable is defined and change the code's behaviour.
The only facility you have is #define macros for pre-processing, and while you can get exceptionally creative and devious with these, there are limits to what you can and, more importantly, should do.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm analyzing a big chunk of C code and would like to split it into modules. Is there a way to automatically generate a list of C functions, starting with the ones that are the longest?
With the GNU userland (e.g. on Linux) you can use nm -S --size-sort object.o to get a list of symbols sorted by size from an object file. This should be approximately proportional to source code length.
If we can assume that the line with a function declaration is not indented, ends with { and the function definition ends with a non-indented }, this Python snippet can help:
#!/usr/bin/python
import sys
started = None
started_line = None
for lineno, line in enumerate(sys.stdin):
if line.startswith(' '):
continue
if line.strip().endswith('{'):
started = lineno
started_line = line.rstrip()
if line.strip().endswith('}'):
print("%s\t%s" % (lineno - started, started_line))
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for an open-source tool/code or some guidance to extract the motion vectors (MVs) of a H.264 encoded bit sequence. I'm already aware that motion vectors can be visualized using ffmpeg with the following command:
ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
However, I want to produce a log file where the MVs of P and B frames are listed frame by frame. I checked out the structure of MVs from libavutil/motion_vector.h, but I couldn't find an example which shows how they are extracted and laid over the original sequence by ffplay. I thought that if I can find that out, I could possibly re-arrange the code to extract the MVs to a text file.
I also tried the code given in this answer, but it doesn't seem to work with the newer versions of ffmpeg:
I would appreciate any example codes or hints.
The source code for the codecview video filter is here, is that what you're looking for?
[edit] Sorry I guess that's not terribly helpful. The function you're looking for is filter_frame(), which shows you how to read AVMotionVectors (as side-data) from a given AVFrame, this is the code used in your commandline example. This example calls draw_arrow(), but you can simply replace that with a call to printf() or some custom function that logs the MV information to a logfile of your choosing.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking for a small C library to handle utf8 strings.
Specifically, splitting based on unicode delimiters for use with stemming algorithms.
Related posts have suggested:
ICU http://www.icu-project.org/ (I found it too bulky for my purposes on embedded devices)
UTF8-CPP: http://utfcpp.sourceforge.net/ (Excellent, but C++ not C)
Has anyone found any platform independent, small codebase libraries for handling unicode strings (doesn't need to do naturalisation).
A nice, light, library which I use successfully is utf8proc.
There's also MicroUTF-8, but it may require login credentials to view or download the source.
UTF-8 is specially designed so that many byte-oriented string functions continue to work or only need minor modifications.
C's strstr function, for instance, will work perfectly as long as both its inputs are valid, null-terminated UTF-8 strings. strcpy works fine as long as its input string starts at a character boundary (for instance the return value of strstr).
So you may not even need a separate library!