]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/imgconvert.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / imgconvert.c
index c26e5b6479aa975d181902209dc9906618607068..3111418e269fda72002d27e6999856e5ffcad7d5 100644 (file)
@@ -114,6 +114,10 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
         .color_type = FF_COLOR_YUV,
     },
 
+    [PIX_FMT_YUVA422P] = {
+        .color_type = FF_COLOR_YUV,
+    },
+
     [PIX_FMT_YUVA444P] = {
         .color_type = FF_COLOR_YUV,
     },
@@ -340,8 +344,11 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width,
         return size;
     }
 
-    if (desc->flags & PIX_FMT_PAL)
-        memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4);
+    if (desc->flags & PIX_FMT_PAL) {
+        uint32_t *d32 = (unsigned char *)(((size_t)dest + 3) & ~3);
+        for (i = 0; i<256; i++)
+            AV_WL32(d32 + i, AV_RN32(src->data[1] + 4*i));
+    }
 
     return size;
 }
@@ -482,6 +489,7 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum
         ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION),
         ~FF_LOSS_COLORQUANT,
         ~FF_LOSS_DEPTH,
+        ~(FF_LOSS_DEPTH|FF_LOSS_COLORSPACE),
         ~(FF_LOSS_RESOLUTION | FF_LOSS_DEPTH | FF_LOSS_COLORSPACE | FF_LOSS_ALPHA |
           FF_LOSS_COLORQUANT | FF_LOSS_CHROMA),
         0x80000, //non zero entry that combines all loss variants including future additions