Energy calculation

I have a Question on how to calculate local energy for the top row. should i use 0 as value for red green and blue for non existing pixels or should i use 0 for the value of the color diference? If we had a pixel with RGB values of 1, 1,1 as the very first pixel this would result in a difference of 3 for both left and top neigbor and a local energy of 6. however if the diference would be set to 0 for non existing neigbhours the local energy would be 0 as well.( Wich would mean the first pixel of every image alsways would have a local energy of 0).

As aditional question:
I just noticed, that the function diff_color has two things i do not understand:
First :What does inline stand for in front of the uint32_t? is the return type and in or what exactly is it?
Second:
as arguments we dont receive pixel pointer but " struct pixel const a" how do i acces r g b values now?

The local energy for the first pixel is always zero.

Regarding you additional questions:

  1. inline means, you give the compiler an endorsement to copy the body of the function to where it is called, instead of calling the function during runtime. How this is handled is dependent on the compiler.
  2. Use the dot, as in a.r for example.