1

I am doing some hardware implementation on Ratecontrol of FFMPEG. I am using x264 Encoder, here I am not able to find the C-Code implementation of this function intra_mbcmp_x3_8x8c.

I tried to trace it back wards, but there is only assembly implementation of the code. Can some body please guide to the Pure C-implementation of the latest x264.

It would also be helpful, if someone helps me in disabling x86 flags in FFMPEG, so that I will be able to run the pure C implementation.
Note:I have checked a similar question here.
But I was not able to get my answer.

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Codec Guy
  • 137
  • 2
  • 11

1 Answers1

3

You're probably looking for this. There's various implementations of mbcmp (sad, satd) because x264 allows user selection of which error metric to use.

Oh, and related to your second question, look at the x264 --asm option (or if you intend to use the API, see how it's implemented on the API side):

$ ~/Projects/x264/x86-64/x264 --fullhelp|grep -- --asm
      --asm <integer>         Override CPU detection
Ronald S. Bultje
  • 10,828
  • 26
  • 47
  • Thanks for your reply that was very helpful. Now I have disabled the assembly code of that of the function intra_mbcmp_x3_8x8c in slicetype.c The Problem I am facing is the function intra_mbcmp_x3_8x8c is returning three satd values. I am not able to find the equivalent C code of this function. – Codec Guy Jul 21 '15 at 12:30
  • I have put the printf in most of the C files. But I am not able find where its function body is. I want to know the logic behind this function h->pixf.intra_mbcmp_x3_8x8c( h->mb.pic.p_fenc[0], pix, satds ); Can you please help me knowing the equivalent C Code of this function. Thanks in advance – Codec Guy Jul 21 '15 at 12:30
  • 1
    Line 545 of the file linked to in "this" in my original reply: INTRA_MBCMP( sad, 8x8, dc, h, v, c,, _c ), creates a function void x264_intra_##mbcmp##_x3_##size##chroma##cpu => x264_intra_sad_x3_8x8c_c, which will do a sad (or line 546: satd) on dc, h and v intra predictors in the chroma plane. I don't quite understand what you're not understanding here, can you be more specific? – Ronald S. Bultje Jul 21 '15 at 13:25
  • Thanks for the reply. I wanted to know how ffmpeg is doing the satd calculation in x264. x264 is also taking the min of hor, ver and DC as the satd, was trying to know the motivation behind it – Codec Guy Jul 29 '15 at 05:38
  • 1
    It's trying to find the best chroma intra prediction mode, and does so by calculating the prediction error (difference between source and predictor) for each available prediction mode (H, V, DC) and then returns the score for the one with the best predictor = lowest error score. – Ronald S. Bultje Jul 29 '15 at 11:19
  • Thank you so much for the information. I really appreciate it. – Codec Guy Jul 30 '15 at 05:15