|
|
@@ -37,6 +37,7 @@ |
|
|
|
#include "libavutil/colorspace.h" |
|
|
|
#include "libavutil/pixdesc.h" |
|
|
|
#include "libavcore/imgutils.h" |
|
|
|
#include "libavcore/internal.h" |
|
|
|
|
|
|
|
#if HAVE_MMX && HAVE_YASM |
|
|
|
#include "x86/dsputil_mmx.h" |
|
|
@@ -456,46 +457,11 @@ int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt) |
|
|
|
return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL; |
|
|
|
} |
|
|
|
|
|
|
|
#if LIBAVCODEC_VERSION_MAJOR < 53 |
|
|
|
int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){ |
|
|
|
int i; |
|
|
|
|
|
|
|
for(i=0; i<256; i++){ |
|
|
|
int r,g,b; |
|
|
|
|
|
|
|
switch(pix_fmt) { |
|
|
|
case PIX_FMT_RGB8: |
|
|
|
r= (i>>5 )*36; |
|
|
|
g= ((i>>2)&7)*36; |
|
|
|
b= (i&3 )*85; |
|
|
|
break; |
|
|
|
case PIX_FMT_BGR8: |
|
|
|
b= (i>>6 )*85; |
|
|
|
g= ((i>>3)&7)*36; |
|
|
|
r= (i&7 )*36; |
|
|
|
break; |
|
|
|
case PIX_FMT_RGB4_BYTE: |
|
|
|
r= (i>>3 )*255; |
|
|
|
g= ((i>>1)&3)*85; |
|
|
|
b= (i&1 )*255; |
|
|
|
break; |
|
|
|
case PIX_FMT_BGR4_BYTE: |
|
|
|
b= (i>>3 )*255; |
|
|
|
g= ((i>>1)&3)*85; |
|
|
|
r= (i&1 )*255; |
|
|
|
break; |
|
|
|
case PIX_FMT_GRAY8: |
|
|
|
r=b=g= i; |
|
|
|
break; |
|
|
|
default: |
|
|
|
return -1; |
|
|
|
} |
|
|
|
pal[i] = b + (g<<8) + (r<<16); |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
return ff_set_systematic_pal2(pal, pix_fmt); |
|
|
|
} |
|
|
|
|
|
|
|
#if LIBAVCODEC_VERSION_MAJOR < 53 |
|
|
|
int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width) |
|
|
|
{ |
|
|
|
return av_image_fill_linesizes(picture->linesize, pix_fmt, width); |
|
|
@@ -909,7 +875,7 @@ int avpicture_alloc(AVPicture *picture, |
|
|
|
goto fail; |
|
|
|
avpicture_fill(picture, ptr, pix_fmt, width, height); |
|
|
|
if(picture->data[1] && !picture->data[2]) |
|
|
|
ff_set_systematic_pal((uint32_t*)picture->data[1], pix_fmt); |
|
|
|
ff_set_systematic_pal2((uint32_t*)picture->data[1], pix_fmt); |
|
|
|
|
|
|
|
return 0; |
|
|
|
fail: |
|
|
|