X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FARDroneLib%2FVLIB%2FP264%2Fp264_merge.c;fp=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FARDroneLib%2FVLIB%2FP264%2Fp264_merge.c;h=9ca7f58e17c0def218162600818cfcf38083d8b6;hb=9ec9bc13b75d30bc45535c54a652934debfcea92;hp=0000000000000000000000000000000000000000;hpb=ae0a3c2dc0898400aca0dd6b439c5db8044db7b2;p=mardrone diff --git a/mardrone/ARDrone_SDK_Version_1_8_20110726/ARDroneLib/VLIB/P264/p264_merge.c b/mardrone/ARDrone_SDK_Version_1_8_20110726/ARDroneLib/VLIB/P264/p264_merge.c new file mode 100644 index 0000000..9ca7f58 --- /dev/null +++ b/mardrone/ARDrone_SDK_Version_1_8_20110726/ARDroneLib/VLIB/P264/p264_merge.c @@ -0,0 +1,42 @@ +#include + +// merge scaled residual data from iTransform and prediction data already located in the output picture +void p264_merge_4x4 (int16_t* residual,uint8_t* picture, uint32_t x, uint32_t y, uint32_t linesize) +{ + uint32_t i; + int16_t pixel; + picture += y*linesize+x; + for (i=0;i<4;i++) + { + pixel = (int16_t)(((int16_t)*picture) + (((*residual++)+32)>>6)); + if (pixel > 0xFF) + *picture++ = 0xFF; + else if (pixel < 0) + *picture++ = 0; + else + *picture++ = pixel; + pixel = (int16_t)(((int16_t)*picture) + (((*residual++)+32)>>6)); + if (pixel > 0xFF) + *picture++ = 0xFF; + else if (pixel < 0) + *picture++ = 0; + else + *picture++ = pixel; + pixel = (int16_t)(((int16_t)*picture) + (((*residual++)+32)>>6)); + if (pixel > 0xFF) + *picture++ = 0xFF; + else if (pixel < 0) + *picture++ = 0; + else + *picture++ = pixel; + pixel = (int16_t)(((int16_t)*picture) + (((*residual++)+32)>>6)); + if (pixel > 0xFF) + *picture = 0xFF; + else if (pixel < 0) + *picture = 0; + else + *picture = pixel; + // jump to next line + picture += linesize-3; + } +}