Skip to content

Commit

Permalink
xine-lib-1.2@12196
Browse files Browse the repository at this point in the history
  • Loading branch information
huceke committed Jun 26, 2012
1 parent 00204a9 commit 0f576d1
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 37 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
@@ -1,3 +1,11 @@
xine-lib (1.2.3) ????-??-??
* Add test image generator input plugin
* Add fast libjpeg based JPEG decoder
* Add max. Xv image size detection to Xv video output plugin

xine-lib (1.1.22) ????-??-??
* Fix segfault when trying to display large images with Xv output plugins

xine-lib (1.2.2) 2012-06-09
* Fix musepack decoder compilation if libmpcdec headers aren't available.
* Configure tests for xinerama & VideoCD support now soft-fail properly.
Expand Down
15 changes: 15 additions & 0 deletions m4/decoders.m4
Expand Up @@ -112,6 +112,21 @@ AC_DEFUN([XINE_DECODER_PLUGINS], [
fi
AM_CONDITIONAL([ENABLE_GDK_PIXBUF], [test x"$have_gdkpixbuf" = x"yes"])
dnl libjpeg (optional; enabled by default)
AC_ARG_ENABLE([libjpeg],
[AS_HELP_STRING([--enable-libjpeg], [Enable libjpeg support (default: enabled)])],
[test x"$enableval" != x"no" && enable_libjpeg="yes"])
if test x"$enable_libjpeg" != x"no"; then
AC_CHECK_LIB([jpeg], [jpeg_start_decompress],
[AC_CHECK_HEADERS([jpeglib.h], [have_libjpeg=yes], [have_libjpeg=no])], [have_libjpeg=no])
if test x"$enable_libjpeg" = x"yes" && test x"$have_libjpeg" != x"yes"; then
AC_MSG_ERROR([libjpeg support requested, but libjpeg not found])
elif test x"$have_libjpeg" = x"yes"; then
JPEG_LIBS="-ljpeg"
AC_SUBST(JPEG_LIBS)
fi
fi
AM_CONDITIONAL([ENABLE_LIBJPEG], [test x"$have_libjpeg" = x"yes"])
dnl ImageMagick (optional; enabled by default)
AC_ARG_WITH([imagemagick],
Expand Down
2 changes: 2 additions & 0 deletions m4/summary.m4
Expand Up @@ -32,6 +32,7 @@ AC_DEFUN([XINE_LIB_SUMMARY], [
test x"$have_v4l2" = x"yes" && echo " - v4l2"
echo " - cdda"
test x"$have_libbluray" = x"yes" && echo " - bluray"
echo " - test"
echo ""
dnl Demuxers
Expand Down Expand Up @@ -78,6 +79,7 @@ AC_DEFUN([XINE_LIB_SUMMARY], [
test x"$have_dxr3" = x"yes" && echo " - dxr3_video"
test x"$have_gdkpixbuf" = x"yes" && echo " - gdk-pixbuf"
test x"$have_imagemagick" = x"yes" && echo " - image"
test x"$have_libjpeg" = x"yes" && echo " - libjpeg"
test x"$have_theora" = x"yes" && echo " - theora"
test x"$have_w32dll" = x"yes" && echo " - w32dll"
test x"$have_vdpau" = x"yes" && echo " - vdpau"
Expand Down
8 changes: 4 additions & 4 deletions src/combined/ffmpeg/ff_video_decoder.c
Expand Up @@ -1721,13 +1721,13 @@ static void ff_reset (video_decoder_t *this_gen) {

if(this->context && this->decoder_ok)
{
xine_list_iterator_t it;
xine_list_iterator_t it = NULL;

avcodec_flush_buffers(this->context);

/* frame garbage collector here - workaround for buggy ffmpeg codecs that
* don't release their DR1 frames */
while( (it = xine_list_front(this->dr1_frames)) != NULL )
while ((it = xine_list_next (this->dr1_frames, it)) != NULL)
{
vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
if (img)
Expand Down Expand Up @@ -1791,15 +1791,15 @@ static void ff_dispose (video_decoder_t *this_gen) {
lprintf ("ff_dispose\n");

if (this->decoder_ok) {
xine_list_iterator_t it;
xine_list_iterator_t it = NULL;

pthread_mutex_lock(&ffmpeg_lock);
avcodec_close (this->context);
pthread_mutex_unlock(&ffmpeg_lock);

/* frame garbage collector here - workaround for buggy ffmpeg codecs that
* don't release their DR1 frames */
while( (it = xine_list_front(this->dr1_frames)) != NULL )
while ((it = xine_list_next (this->dr1_frames, it)) != NULL)
{
vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
if (img)
Expand Down
6 changes: 6 additions & 0 deletions src/input/Makefile.am
Expand Up @@ -68,6 +68,7 @@ endif

xineplug_LTLIBRARIES = \
xineplug_inp_file.la \
xineplug_inp_test.la \
xineplug_inp_http.la \
xineplug_inp_dvd.la \
$(in_vcd) \
Expand All @@ -90,6 +91,11 @@ xineplug_LTLIBRARIES = \
xineplug_inp_file_la_SOURCES = input_file.c
xineplug_inp_file_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)

xineplug_inp_test_la_SOURCES = input_test.c
xineplug_inp_test_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_inp_test_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_inp_test_la_LDFLAGS = $(xineplug_ldflags)

xineplug_inp_dvd_la_SOURCES = input_dvd.c media_helper.c
xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS)
xineplug_inp_dvd_la_CFLAGS = $(AM_CFLAGS) $(DVD_CFLAGS)
Expand Down
20 changes: 10 additions & 10 deletions src/post/deinterlace/plugins/greedy2frame_template_sse2.c
Expand Up @@ -171,31 +171,30 @@ static void DeinterlaceGreedy2Frame_SSE2(uint8_t *output, int outstride,
* See above for a description of the algorithm.
* weave if (weave(M) AND (weave(T) OR weave(B)))
*/
"movdqa (%3), %%xmm1 \n\t" /* xmm1 = T1 */
"movdqa (%4), %%xmm0 \n\t" /* xmm0 = T0 */
"movdqa (%q5,%3), %%xmm3 \n\t" /* xmm3 = B1 */
"movdqa (%q5,%4), %%xmm2 \n\t" /* xmm2 = B0 */
"movdqa (%2), %%xmm1 \n\t" /* xmm1 = T1 */
"movdqa (%3), %%xmm0 \n\t" /* xmm0 = T0 */
"movdqa (%q4,%2), %%xmm3 \n\t" /* xmm3 = B1 */
"movdqa (%q4,%3), %%xmm2 \n\t" /* xmm2 = B0 */

/* calculate |T1-T0| keep T1 put result in xmm5 */
"movdqa %%xmm1, %%xmm5 \n\t"
"psubusb %%xmm0, %%xmm5 \n\t"
"psubusb %%xmm1, %%xmm0 \n\t"
"por %%xmm0, %%xmm5 \n\t"

"movdqa (%0), %%xmm0 \n\t" /* xmm0 = M1 */
/* T1 is data for line to copy */
"movntdq %%xmm1, %2 \n\t"
"movntdq %%xmm1, %1 \n\t"

/* if |T1-T0| > Threshold we want 0 else dword minus one */
"psrlw $1, %%xmm5 \n\t"
"pand %%xmm6, %%xmm5 \n\t"
"pcmpgtb %1, %%xmm5 \n\t"
"pcmpgtb %0, %%xmm5 \n\t"
"pcmpeqd %%xmm7, %%xmm5 \n\t"

"prefetcht0 64(%q5,%3) \n\t"
"prefetcht0 64(%q5,%4) \n\t"
"prefetcht0 64(%q4,%2) \n\t"
"prefetcht0 64(%q4,%3) \n\t"
:
: "r" (M1), "m" (GreedyTwoFrameThreshold128),
: "m" (GreedyTwoFrameThreshold128),
"m" (*Destc), "r" (T1), "r" (T0), "r" (Pitch) );

asm volatile (
Expand All @@ -205,6 +204,7 @@ static void DeinterlaceGreedy2Frame_SSE2(uint8_t *output, int outstride,
"psubusb %%xmm3, %%xmm2 \n\t"
"por %%xmm2, %%xmm4 \n\t"

"movdqa (%0), %%xmm0 \n\t" /* xmm0 = M1 */
"movdqa (%1), %%xmm2 \n\t" /* xmm2 = M0 */

/* if |B1-B0| > Threshold we want 0 else dword minus one */
Expand Down
9 changes: 9 additions & 0 deletions src/video_dec/Makefile.am
Expand Up @@ -20,8 +20,13 @@ if ENABLE_GDK_PIXBUF
gdkpixbuf_module = xineplug_decode_gdk_pixbuf.la
endif

if ENABLE_LIBJPEG
libjpeg_module = xineplug_decode_libjpeg.la
endif

xineplug_LTLIBRARIES = $(image_module) \
$(gdkpixbuf_module) \
$(libjpeg_module) \
$(theora_module) \
xineplug_decode_bitplane.la \
xineplug_decode_rgb.la \
Expand All @@ -43,3 +48,7 @@ xineplug_decode_image_la_CFLAGS = $(AM_CFLAGS) $(WAND_CFLAGS)
xineplug_decode_gdk_pixbuf_la_SOURCES = gdkpixbuf.c
xineplug_decode_gdk_pixbuf_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) $(GDK_PIXBUF_LIBS)
xineplug_decode_gdk_pixbuf_la_CFLAGS = $(AM_CFLAGS) $(GDK_PIXBUF_CFLAGS)

xineplug_decode_libjpeg_la_SOURCES = libjpeg.c
xineplug_decode_libjpeg_la_LIBADD = $(XINE_LIB) $(JPEG_LIBS)
xineplug_decode_libjpeg_la_CFLAGS = $(AM_CFLAGS) $(JPEG_CFLAGS)
24 changes: 18 additions & 6 deletions src/video_dec/gdkpixbuf.c
Expand Up @@ -132,9 +132,25 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {

lprintf("image loaded successfully\n");

/*
* alloc video frame
*/
img = this->stream->video_out->get_frame (this->stream->video_out, width, height,
(double)width / (double)height,
XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);

/* crop if allocated frame is smaller than requested */
if (width > img->width)
width = img->width;
if (height > img->height)
height = img->height;
img->ratio = (double)width / (double)height;

/*
* rgb data -> yuv_planes
*/
width &= ~1; /* must be even for init_yuv_planes */
init_yuv_planes(&yuv_planes, width, height);

n_channels = gdk_pixbuf_get_n_channels (pixbuf);
Expand All @@ -155,12 +171,8 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
gdk_pixbuf_unref (pixbuf);

/*
* alloc and draw video frame
* draw video frame
*/
img = this->stream->video_out->get_frame (this->stream->video_out, width,
height, (double)width/(double)height,
XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
img->pts = buf->pts;
img->duration = 3600;
img->bad_frame = 0;
Expand Down Expand Up @@ -289,7 +301,7 @@ static const uint32_t supported_types[] = { BUF_VIDEO_IMAGE, BUF_VIDEO_JPEG, 0 }

static const decoder_info_t dec_info_image = {
supported_types, /* supported types */
7 /* priority */
8 /* priority */
};

const plugin_info_t xine_plugin_info[] EXPORTED = {
Expand Down
35 changes: 26 additions & 9 deletions src/video_dec/image.c
Expand Up @@ -102,7 +102,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
this->index += buf->size;

if (buf->decoder_flags & BUF_FLAG_FRAME_END) {
int width, height, i;
int width, height, i, x, y, img_stride;
int status;
MagickWand *wand;
uint8_t *img_buf, *img_buf_ptr;
Expand Down Expand Up @@ -133,9 +133,10 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
return;
}

width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */
width = MagickGetImageWidth(wand);
height = MagickGetImageHeight(wand);
img_buf = malloc(width * height * 3);
img_stride = 3 * width;
#if MAGICK_VERSION < 0x671
MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf);
DestroyMagickWand(wand);
Expand All @@ -151,30 +152,46 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {

lprintf("image loaded successfully\n");

/*
* alloc video frame and set cropping
*/
img = this->stream->video_out->get_frame (this->stream->video_out, width, height,
(double)width / (double)height,
XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);

if (width > img->width)
width = img->width;
if (height > img->height)
height = img->height;
img->ratio = (double)width / (double)height;

/*
* rgb data -> yuv_planes
*/
width &= ~1; /* must be even for init_yuv_planes */
init_yuv_planes(&yuv_planes, width, height);

img_buf_ptr = img_buf;
for (i=0; i < width*height; i++) {
i = 0;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
uint8_t r = *(img_buf_ptr++);
uint8_t g = *(img_buf_ptr++);
uint8_t b = *(img_buf_ptr++);

yuv_planes.y[i] = COMPUTE_Y(r, g, b);
yuv_planes.u[i] = COMPUTE_U(r, g, b);
yuv_planes.v[i] = COMPUTE_V(r, g, b);
i++;
}
img_buf_ptr += img_stride - 3 * width;
}
free(img_buf);

/*
* alloc and draw video frame
* draw video frame
*/
img = this->stream->video_out->get_frame (this->stream->video_out, width,
height, (double)width/(double)height,
XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
img->pts = buf->pts;
img->duration = 3600;
img->bad_frame = 0;
Expand Down Expand Up @@ -295,7 +312,7 @@ static const uint32_t supported_types[] = { BUF_VIDEO_IMAGE, BUF_VIDEO_JPEG, 0 }

static const decoder_info_t dec_info_image = {
supported_types, /* supported types */
6 /* priority */
7 /* priority */
};

const plugin_info_t xine_plugin_info[] EXPORTED = {
Expand Down
17 changes: 13 additions & 4 deletions src/video_out/video_out_xcbxv.c
Expand Up @@ -99,6 +99,7 @@ typedef struct {
unsigned int xv_pitches[3];
unsigned int xv_offsets[3];

int req_width, req_height;
} xv_frame_t;


Expand Down Expand Up @@ -360,8 +361,8 @@ static void xv_update_frame_format (vo_driver_t *this_gen,
width = (width + 7) & ~0x7;
}

if ((frame->width != width)
|| (frame->height != height)
if ((frame->req_width != width)
|| (frame->req_height != height)
|| (frame->format != format)) {

/* printf (LOG_MODULE ": updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */
Expand Down Expand Up @@ -390,13 +391,21 @@ static void xv_update_frame_format (vo_driver_t *this_gen,
frame->vo_frame.base[2] = frame->image + frame->xv_offsets[1];
}

frame->width = width;
frame->height = height;
/* allocated frame size may not match requested size */
frame->req_width = width;
frame->req_height = height;
frame->width = frame->xv_width;
frame->height = frame->xv_height;
frame->format = format;

pthread_mutex_unlock(&this->main_mutex);
}

if (frame->vo_frame.width > frame->width)
frame->vo_frame.width = frame->width;
if (frame->vo_frame.height > frame->height)
frame->vo_frame.height = frame->height;

frame->ratio = ratio;
}

Expand Down
17 changes: 13 additions & 4 deletions src/video_out/video_out_xv.c
Expand Up @@ -102,6 +102,7 @@ typedef struct {
XvImage *image;
XShmSegmentInfo shminfo;

int req_width, req_height;
} xv_frame_t;


Expand Down Expand Up @@ -443,8 +444,8 @@ static void xv_update_frame_format (vo_driver_t *this_gen,
width = (width + 7) & ~0x7;
}

if ((frame->width != width)
|| (frame->height != height)
if ((frame->req_width != width)
|| (frame->req_height != height)
|| (frame->format != format)) {

/* printf (LOG_MODULE ": updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */
Expand Down Expand Up @@ -475,13 +476,21 @@ static void xv_update_frame_format (vo_driver_t *this_gen,
frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1];
}

frame->width = width;
frame->height = height;
/* allocated frame size may not match requested size */
frame->req_width = width;
frame->req_height = height;
frame->width = frame->image->width;
frame->height = frame->image->height;
frame->format = format;

UNLOCK_DISPLAY(this);
}

if (frame->vo_frame.width > frame->width)
frame->vo_frame.width = frame->width;
if (frame->vo_frame.height > frame->height)
frame->vo_frame.height = frame->height;

frame->ratio = ratio;
}

Expand Down

0 comments on commit 0f576d1

Please sign in to comment.