ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Mon Feb 24 12:51:16 2025 +0100| [f1a4787f76cc48a890023088434bcd42b13cc5d6] | 
committer: Andreas Rheinhardt

avcodec/proresdsp: Make put_pixels truely ptrdiff_t compatible

It currently uses an intermediate int which wouldn't work
if linesize exceeded the range of int and inhibits compiler
optimizations. Also switch to pointer arithmetic and use
smaller scope.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1a4787f76cc48a890023088434bcd42b13cc5d6
---

 libavcodec/proresdsp.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index d20b9d938a..20de1cab4f 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -40,16 +40,14 @@
  */
 
 static inline void put_pixel(uint16_t *dst, ptrdiff_t linesize, const int16_t 
*in, int bits_per_raw_sample) {
-    int x, y, src_offset, dst_offset;
-
-    for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += linesize) {
-        for (x = 0; x < 8; x++) {
-            src_offset = (y << 3) + x;
+    for (int y = 0; y < 8; y++, dst += linesize) {
+        for (int x = 0; x < 8; x++) {
+            int src_offset = (y << 3) + x;
 
             if (bits_per_raw_sample == 10) {
-                dst[dst_offset + x] = CLIP_10(in[src_offset]);
+                dst[x] = CLIP_10(in[src_offset]);
             } else {//12b
-                dst[dst_offset + x] = CLIP_12(in[src_offset]);
+                dst[x] = CLIP_12(in[src_offset]);
             }
         }
     }

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to