Re: [Libav-user] Memory leak while using ff_get_buffer ?

2016-09-21 Thread ssshukla26
After some searching, I found out that in some decoders the incoming /avframe
pointer/ is unreferenced using *av_frame_unref* api, and then
*ff_get_buffer* is called. 

Can someone please explain why such things are done ! I am so much confused
.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Memory-leak-while-using-ff-get-buffer-tp4662720p4662733.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Memory leak while using ff_get_buffer ?

2016-09-20 Thread ssshukla26
I am using *ff_get_buffer* in my decoder, it seems to me that using this API
causing some memory leak. Please help, need your suggestions on this !



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Memory-leak-while-using-ff-get-buffer-tp4662720.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
under *./libavcodec/hevc_mp4toannexb_bsf.c* there is note as below.

When private_spspps is zero then spspps_buf points to global extradata and
bsf does replace a global extradata to own-allocated version (default
behaviour).

When private_spspps is non-zero the bsf uses a private version of spspps
buf. This mode necessary when bsf *uses in decoder*, else bsf has issues
after decoder re-initialization. Use the "*private_spspps_buf*" argument to
activate this mode.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662662.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
Solved it by following code under *decode* function of decoder.


if(*av_bitstream_filter_filter*(decoder->bsf, avctx, "*private_spspps_buf*",
>pkt.data,
>pkt.size,
avpkt->data, avpkt->size,
!!(avpkt->flags & AV_PKT_FLAG_KEY)) < 0)
{
ERROR("Error: unable to convert data from avcc to annexb");
}
else
{
//Do decoding of decoder->pkt.data instead of avpkt->data
}



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662661.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
Ok. I might be wrong, but the demuxers are only for extracting data out of
the container ! Right ?

So If that the case, any decoder will receive data in *AVCC* format when
*mp4* files are used as input ?

So one must convert data from avcc to annexb format under the decoder ? 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662657.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
Yup. that's true.

But I don't understand one thing, my decoder is working properly with a
*h264* file in proper AnnexB data format, and when using *mp4* file which is
in AVCC format, the demuxing which should take place is not taking place at
all ! Does that mean I need to configure the demuxer with my decoder or
something like that ? 




--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662655.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
It runs properly, with "*h264*" (default) software decoder without using bit
stream filter.

Which makes me believe that I must be missing something in configuring
decoder to receive proper demuxed data, but I dont know what I am missing ! 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662653.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Demuxer not giving proper data to decoder ?

2016-09-15 Thread ssshukla26
After debugging, I realized that my decoder is getting data in *AVCC* format,
so on application side I added bit stream filter "*h264_mp4toannexb*" and
everything worked. No artefacts at all.

So to make sure that my decoder use data in *AnnexB* format, I added
*h264_mp4toannexb* filter *inside* decoder, filtering the incoming packet
data, so I don't have to change anything on application side. But I am
getting the below error.


"*Packet header is not contained in global extradata, corrupted stream or
invalid MP4/AVCC bitstream*"

Please help.






--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628p4662645.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Demuxer not giving proper data to decoder ?

2016-09-13 Thread ssshukla26
I have added support for one of our custom decoder (with id
*AV_CODEC_ID_H264*) in ffmpeg source, and its working fine with *h264* and
*mp4* files.

When playing mp4 file am seeing macroblocks artefact. So debugging further,
I dump the in-coming packets from demuxer before decoding and found that the
packets itself contains macro blocks artefact. 

So am very very confuse, why demuxer is outputting data with macro blocks
artefact ! 

Please help. 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Demuxer-not-giving-proper-data-to-decoder-tp4662628.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Suggest how to propery fill incomming AVFrame pointer in a decoder !

2016-08-24 Thread ssshukla26
Hi, I am able to fill incoming AVFrame pointers. Can anyone suggest how to
wrap buf[] array of the avframe pointers ! I am too much stuck at this point
. 

Below the code, where *decoder->dst_data[]* array consist of Y, U and V
buffers of image. And *decoder->dst_linesize[]* array consist of respective
line sizes.

AVFrame **avframe_src* = NULL;

if(NULL != (avframe_src = *av_frame_alloc*()))
{
avframe_src->width  = decoder->video_resolution.frame_width;
avframe_src->height =
decoder->video_resolution.frame_height;
avframe_src->format = AV_PIX_FMT_YUV420P;

//Allocate data array of avframe pointer
if(*av_image_alloc*(avframe_src->data,
avframe_src->linesize,
decoder->video_resolution.frame_width,
decoder->video_resolution.frame_height,
AV_PIX_FMT_YUV420P, 1) < 0) 
{
ERROR("Error : Allocating AVFRAME data\n");
}
else
{
//Fill data array of avframe pointer with data from
dst_data[0]
if(*av_image_fill_arrays*(avframe_src->data,
avframe_src->linesize, decoder->dst_data[0],
avframe_src->format, avframe_src->width,
avframe_src->height, 1) > 0) 
{
//This is done to make sure that incoming avframe
pointer's buf[0]
//has proper referenced buffer and YUV data
AVFrame **avframe_dst* = (AVFrame *) pFrame;
if(0 == *av_frame_ref*(avframe_dst,avframe_src))
{
//av_buffer_create is used to make sure that
//buf array of avframe has wrapped data array
//such that its opaque value is set to the
//incoming opaque pointer
avframe_dst->buf[0] =
*av_buffer_create*(avframe_dst->data[0], avframe_dst->linesize[0], NULL,
opaque, 0);
avframe_dst->buf[1] =
*av_buffer_create*(avframe_dst->data[1], avframe_dst->linesize[1], NULL,
opaque, 0);
avframe_dst->buf[2] =
*av_buffer_create*(avframe_dst->data[2], avframe_dst->linesize[2], NULL,
opaque, 0);
if((NULL != avframe_dst->buf[0]) &&
(NULL != avframe_dst->buf[1]) &&
(NULL != avframe_dst->buf[2]))
{
ret = 1; 
}
}
}
av_frame_unref(avframe_src);
}
av_frame_free(_src);
}
else
{
ERROR("Error : Not able to allocate avframe source
pointer\n");
}



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Suggest-how-to-propery-fill-incomming-AVFrame-pointer-in-a-decoder-tp4662417p4662464.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] imgutils.h decode dst buffer going from avpicture_fill to av_image_fill_arrays

2016-08-22 Thread ssshukla26
For software scaling the example is as follows, might help you.


int main(int argc, char **argv)
{
const char *src_filename = NULL;
const char *src_resolution = NULL;
const char *src_pix_fmt_name = NULL;
enum AVPixelFormat src_pix_fmt = AV_PIX_FMT_NONE;
uint8_t *src_data[4];
int src_linesize[4];
int src_w=0, src_h=0;
FILE *src_file;
int src_bufsize;

const char *dst_filename = NULL;
const char *dst_resolution = NULL;
const char *dst_pix_fmt_name = NULL;
enum AVPixelFormat dst_pix_fmt = AV_PIX_FMT_NONE;
uint8_t *dst_data[4];
int dst_linesize[4];
int dst_w=0, dst_h=0;
FILE *dst_file;
int dst_bufsize;

struct SwsContext *sws_ctx;
int ret;
int frame_count = 0;
if (argc != 7) {
fprintf(stderr, "*Usage: %s src_file src_resolution src_pix_fmt
dst_file dst_resolution dst_pix_fmt*\n"
"API example program to show how to scale an video/image
with libswscale.\n"
"This program generates a series of pictures, rescales them
to the given "
"resolution and saves them to an output file\n."
"\n", argv[0]);
exit(1);
}

src_filename = argv[1];
src_resolution   = argv[2];
src_pix_fmt_name = argv[3];
dst_filename = argv[4];
dst_resolution = argv[5];
dst_pix_fmt_name = argv[6];

if(AV_PIX_FMT_NONE == (src_pix_fmt = av_get_pix_fmt(src_pix_fmt_name)))
{
fprintf(stderr,
"Invalid source pixel format '%s'\n",
src_pix_fmt_name);
exit(1);
}

if(AV_PIX_FMT_NONE == (dst_pix_fmt = av_get_pix_fmt(dst_pix_fmt_name)))
{
fprintf(stderr,
"Invalid destination pixel format '%s'\n",
dst_pix_fmt_name);
exit(1);
}

if (av_parse_video_size(_w, _h, src_resolution) < 0) {
fprintf(stderr,
"Invalid source resolution '%s', must be in the form WxH or
a valid size abbreviation\n",
src_resolution);
exit(1);
}

if (av_parse_video_size(_w, _h, dst_resolution) < 0) {
fprintf(stderr,
"Invalid destination resolution '%s', must be in the form
WxH or a valid size abbreviation\n",
dst_resolution);
exit(1);
}

src_file = fopen(src_filename, "rb");
if (!src_file) {
fprintf(stderr, "Could not open source file %s\n", src_filename);
exit(1);
}

dst_file = fopen(dst_filename, "wb");
if (!dst_file) {
fprintf(stderr, "Could not open destination file %s\n",
dst_filename);
exit(1);
}

/* create scaling context */
sws_ctx = *sws_getContext*(src_w, src_h, src_pix_fmt,
 dst_w, dst_h, dst_pix_fmt,
 SWS_BILINEAR, NULL, NULL, NULL);
if (!sws_ctx) {
fprintf(stderr,
"Impossible to create scale context for the conversion "
"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
av_get_pix_fmt_name(src_pix_fmt), src_w, src_h,
av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h);
ret = AVERROR(EINVAL);
goto end;
}

/* allocate source and destination image buffers */
if ((ret = *av_image_alloc*(src_data, src_linesize,
  src_w, src_h, src_pix_fmt, 16)) < 0) {
fprintf(stderr, "Could not allocate source image\n");
goto end;
}
src_bufsize = ret;

/* buffer is going to be written to rawvideo file, no alignment */
if ((ret = *av_image_alloc*(dst_data, dst_linesize,
  dst_w, dst_h, dst_pix_fmt, 1)) < 0) {
fprintf(stderr, "Could not allocate destination image\n");
goto end;
}
dst_bufsize = ret;

/* read image from source file */
while(src_bufsize == fread(src_data[0], 1, src_bufsize, src_file))
{
/* convert to destination format */
   *sws_scale*(sws_ctx, (const uint8_t * const*)src_data,src_linesize,
0, src_h, dst_data, dst_linesize);

/* write scaled image to file */
fwrite(dst_data[0], 1, dst_bufsize, dst_file);

printf("No of frames converted = %d\r",++frame_count);
fflush(stdout);
}

printf("\n");

fprintf(stderr, "Scaling succeeded. Play the output file with the
command:\n"
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);

end:
fclose(src_file);
fclose(dst_file);
av_freep(_data[0]);
av_freep(_data[0]);
sws_freeContext(sws_ctx);
return ret;
}




--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-imgutils-h-decode-dst-buffer-going-from-avpicture-fill-to-av-image-fill-arrays-tp4662419p4662429.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list

Re: [Libav-user] Suggest how to propery fill incomming AVFrame pointer in a decoder !

2016-08-19 Thread ssshukla26
What is the difference between *av_frame_get_buffer* and *av_image_alloc*
function ?

Cause using anyone of 'em, I am getting the same output !



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Suggest-how-to-propery-fill-incomming-AVFrame-pointer-in-a-decoder-tp4662417p4662426.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] imgutils.h decode dst buffer going from avpicture_fill to av_image_fill_arrays

2016-08-19 Thread ssshukla26
For example let suppose "decoder->dst_data[0]" has YUV buffer and its
alignment is 1.

---

//Allocate AVFrame data and linesize

av_image_alloc(avframe->data, avframe->linesize, 
decoder->video_resolution.frame_width,
decoder->video_resolution.frame_height,
AV_PIX_FMT_YUV420P, 1);


Below are the 3 methods to fill data array of avframe.

---

//1) if your Y, U, V buffers are contiguous and have the correct size, This
is deprecated
avpicture_fill((AVPicture*) avframe, decoder->dst_data[0], avframe->format,
avframe->width, avframe->height);

---

//2) if your Y, U, V buffers are non-contiguous, This is deprecated
// Initialize avframe->linesize
avpicture_fill((AVPicture*) avframe, NULL, avframe->format, avframe->width,
avframe->height);

//Set avframe->data pointers manually
avframe->data[0] = decoder->dst_data[0];//Y-Buffer
avframe->data[1] = decoder->dst_data[1];//U-Buffer
avframe->data[2] = decoder->dst_data[2];//V-Buffer

---

//3) Fill data array of avframe, as decoder->dst_data[0] alignment is 1 use
the same alignment.
av_image_fill_arrays(avframe->data, avframe->linesize, decoder->dst_data[0],
avframe->format, avframe->width, avframe->height, *1*);



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-imgutils-h-decode-dst-buffer-going-from-avpicture-fill-to-av-image-fill-arrays-tp4662419p4662425.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Suggest how to propery fill incomming AVFrame pointer in a decoder !

2016-08-13 Thread ssshukla26
My video decoder is decoding both mp4 files and h264 files. I just wanted to
make sure that the way am filling incoming AVFrame pointer is proper or not,
code snippet as shown below.

int *qhw_decode_frame* (AVCodecContext *avctx, *void *pFrame*, int
*got_frame, AVPacket *avpkt)
{
...
AVFrame *avframe = (AVFrame *) pFrame;
avframe->width  = avctx->width; //width is1920
avframe->height = avctx->height; //height is 1080
avframe->format = AV_PIX_FMT_YUV420P;

if(!(*av_frame_get_buffer(avframe,1)* < 0))
{
 //Copy decoded data to avframe->data pointer.
}
...
}


The above is the only a snippet of the code. I just want to understand that
using *av_frame_get_buffer* is correct way to get data buffers to fill
decoded data ?

I am copying decoded data in data buffer of avframe pointer, is that correct
?

The reason am asking this question is with ffmpeg my above code is working
but when I integrate my ffmpeg with chromium, its crashing when I copy
decoded data to avframe data pointers !



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Suggest-how-to-propery-fill-incomming-AVFrame-pointer-in-a-decoder-tp4662417.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Need to understand where demuxer for mp4 is hooked with h264 decoder ?

2016-08-13 Thread ssshukla26
Yup, extradata has the header data, I was able to decode mp4 data correctly
by passing extradata to my decoder.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Need-to-understand-where-demuxer-for-mp4-is-hooked-with-h264-decoder-tp4662406p4662416.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Need to understand where demuxer for mp4 is hooked with h264 decoder ?

2016-08-10 Thread ssshukla26
Hi, It seems *demuxer for mp4* is sending data to decoder but without
*headers* (i.e. sps and pps) and the packets received is having only *size*
(first 4 bytes) at the beginning.

My decoder need sps and pps else its giving error that "No proper header"
while decoding. Can you please suggest what to be done ?



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Need-to-understand-where-demuxer-for-mp4-is-hooked-with-h264-decoder-tp4662406p4662410.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Need to understand where demuxer for mp4 is hooked with h264 decoder ?

2016-08-09 Thread ssshukla26
Ok, will provide you the patch soon. Till then can you tell me that where
*demuxer for mp4* is hooked with the *default h264 decoder* in the source Or
its hooked via *isom.c* ? Can you please clear that doubt of mine !

P.S. :- My decoder is able to decode H264 files and it is using
"*AV_CODEC_ID_H264*" as *id*. 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Need-to-understand-where-demuxer-for-mp4-is-hooked-with-h264-decoder-tp4662406p4662408.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Need to understand where demuxer for mp4 is hooked with h264 decoder ?

2016-08-08 Thread ssshukla26
Hi,

I am decoding a *mp4 file* using *h264 decoder* (as follows), so where does
this demuxer for mp4 is hooked with h264 decoder in the source ? Please help
I want to hook the demuxer for mp4 with my own decoder.

# *ffmpeg -f mp4 -i no_mans_sky.mp4 out.yuv*

ffmpeg version N-80954-g58dc8bb Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=ffmpeg_4_this_pc/ --enable-shared --enable-nonfree
--enable-pic --enable-gpl
--extra-cflags=-I/home/sunny/ffmpeg/sdl/source/SDL-1.2.15/sdl_4_this_pc/include/SDL/
--extra-ldflags='-L/home/sunny/ffmpeg/sdl/source/SDL-1.2.15/sdl_4_this_pc/lib/
-lSDL'
  libavutil  55. 28.100 / 55. 28.100
  libavcodec 57. 50.100 / 57. 50.100
  libavformat57. 41.100 / 57. 41.100
  libavdevice57.  0.102 / 57.  0.102
  libavfilter 6. 47.100 /  6. 47.100
  libswscale  4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'no_mans_sky.mp4':
  Metadata:
major_brand : dash
minor_version   : 0
compatible_brands: iso6avc1mp41
creation_time   : 2015-10-28 11:49:29
  Duration: 00:01:54.11, start: 0.00, bitrate: 2810 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 41 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94
tbc (default)
Metadata:
  creation_time   : 2015-10-28 11:49:29
  handler_name: VideoHandler
[rawvideo @ 0x793720] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.
Output #0, rawvideo, to 'out.yuv':
  Metadata:
major_brand : dash
minor_version   : 0
compatible_brands: iso6avc1mp41
encoder : Lavf57.41.100
Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97
tbc (default)
Metadata:
  creation_time   : 2015-10-28 11:49:29
  handler_name: VideoHandler
  encoder : Lavc57.50.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (*h264 (native)* -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 1833 fps= 40 q=-0.0 Lsize= 5567738kB time=00:01:01.16
bitrate=745750.2kbits/s speed=1.35x



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Need-to-understand-where-demuxer-for-mp4-is-hooked-with-h264-decoder-tp4662406.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Unable to link libavutil with libswscale !

2016-08-04 Thread ssshukla26
Yes will follow ffmpeg standards when submitting patch on ffmpeg-devel, this
was a rough patch submitted for discussion.

What I get from you response is that we didn't need any changes in
*libavutil* if we are able to provide correct *linesize[]* array ?

Please refer to this  repo
<https://github.com/ssshukla26/NV12Tile-To-NV12-Conversion>   which we have
used to implement *size[]* array inside *av_image_fill_pointers* function.

Can you please help us to put correct *AVPixFmtDescriptor.comp* values for
nv12_tiled format under *libavutil/pixdesc.c *, so that we can get actual
linesize[] array ?

For AV_PIX_FMT_NV12_TILED format we are right now only doing nv12_tiled to
yuv420p conversion, hence do we need to implement it as only input format ?





--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Unable-to-link-libavutil-with-libswscale-tp4662334p4662399.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] decoding for stream 0 failed ?

2016-07-20 Thread ssshukla26
Hi,

I am implementing a custom decoder of qualcomm chipset into ffmpeg, have a
working linux application for the same. I am able to run decoder, but its
closing with aN error as show below.

Note: The output format is nv12 tiled, we have already added support for
nv12 tile to yuv420p conversion in libswscale. 
0001-NV12-Tile-pixel-format-support-added.patch

  

# *ffmpeg -f h264 -c:v h264_qhw -i no_mans_sky_1080p_10sec.h264 -pix_fmt
nv12_tiled -s 1920x1080 -r 30 out_1080p.yuv*
ffmpeg version N-80917-gc5096bc Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 4.9.2 (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC
4.9-2014.09) 20140904 (prerelease)
  configuration: --prefix=comark_SBC_ffmpeg/ --enable-shared
--enable-nonfree --enable-pic --enable-gpl --enable-cross-compile
--cross-prefix=arm-linux-gnueabihf- --arch=arm --target-os=linux
--extra-cflags=-I../sdl/source/SDL-1.2.15/comark_SBC_SDL//include/SDL/
--extra-ldflags='-L../sdl/source/SDL-1.2.15/comark_SBC_SDL//lib/ -lSDL'
  libavutil  55. 28.100 / 55. 28.100
  libavcodec 57. 48.101 / 57. 48.101
  libavformat57. 41.100 / 57. 41.100
  libavdevice57.  0.102 / 57.  0.102
  libavfilter 6. 47.100 /  6. 47.100
  libswscale  4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc54.  0.100 / 54.  0.100
Initialized Params
@ 328 in init_params : width = 1920 & height = 1080
Initialized Decoder
@ 680 in vdec_set_buffer_requirement : Input Buffer mincount=1
maxcount=32
actualcount=3
,buffer_size=2097152
,alignment=2048
@ 703 in vdec_set_buffer_requirement : Output Buffer mincount=6
maxcount=32
actualcount=10
,buffer_size=3137536
,alignment=8192
@ 910 in vdec_alloc_h264_mv : Entered vdec_alloc_h264_mv act_width: 1920,
act_height: 1080, size: 5570560, alignment 8192
Start Decoder
Buffers freed for reconfiguration
@ 910 in vdec_alloc_h264_mv : Entered vdec_alloc_h264_mv act_width: 1920,
act_height: 1080, size: 5570560, alignment 8192
Buffers allocated for reconfiguration
*[h264 @ 0x4a260] decoding for stream 0 failed*

Stop Decoder
De-Initialized Decoder
De-Initialized Params
*[h264 @ 0x4a260] Could not find codec parameters for stream 0 (Video: h264
(High), none, 1920x1080): unspecified pixel format
*Consider increasing the value for the 'analyzeduration' and 'probesize'
options
Input #0, h264, from 'no_mans_sky_1080p_10sec.h264':
  Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), none, 1920x1080, 12.50 fps, 25 tbr,
1200k tbn, 25 tbc
File 'out_1080p.yuv' already exists. Overwrite ? [y/N] n
Not overwriting - exiting

Please help.




--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-decoding-for-stream-0-failed-tp4662372.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] How to process incomming AVFrame pointer in a decoder ?

2016-07-18 Thread ssshukla26
Hi guyz,

What I found out is that the decoder is getting *avpkt->size* as *0 (zero)*
under the below function after some 67 frames and hence it closing abruptly.

*int qhw_decode_frame (AVCodecContext *avctx, void *pframe, int *got_frame,
AVPacket *avpkt);*

Can anyone please help. Am so much stuck.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-How-to-process-incomming-AVFrame-pointer-in-a-decoder-tp4662357p4662365.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] How to process incomming AVFrame pointer in a decoder ?

2016-07-15 Thread ssshukla26
Hi,

I am implementing the custom decoder of qualcomm chipset into ffmpeg, have a
working linux application for the same. Every thing is working fine except
one thing, that is I am unable to fill decoded data into in coming AVFrame
pointer. 

My implementation of decoder has the following function to decode frames,
*int qhw_decode_frame (AVCodecContext *avctx, void *pframe, int *got_frame,
AVPacket *avpkt);*

First of all the do_decode call was asserting with the following error
*Assertion avctx->internal->buffer_frame->buf[0] failed at
libavcodec/utils.c:2772*

So I used *av_frame_get_buffer* function to allocate memory to data buffers,
but still the pipe (as follows) isn't working.

*$ ffmpeg -f h264 -c:v h264_qhw -i no_mans_sky_1080p_10sec.h264 -vcodec
rawvideo -pix_fmt nv12_tiled -s 1920x1080 -r 30 output.yuv -loglevel debug
*

Note: I confirm my decoder is working by *dumping* the first decode frame on
a file, as the decode function is only called once and then it hang up, just
hanp up and do nothing.

Please help am so much stuck, please guyz need some insight on how to
process and fill the incoming AVFrame pointer from do_decode function.




--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-How-to-process-incomming-AVFrame-pointer-in-a-decoder-tp4662357.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] How to use different decoders under demuxing_decoding.c example ? ?

2016-07-14 Thread ssshukla26
Hi,

I have added a custom h264 decoder for qualcomm chipset under libavcodec,
with code ID "*AV_CODEC_ID_H264*" and name "*h264_qhw*". I want to test it's
working with ffmpeg api's, am not able to see where its failing under ffmpeg
command line. So I opted for *demuxing_decoding.c* example and it's working
fine with a h264 file. But its using the default h264 decoder.

How can I make sure that the *demuxing_decoding.c* example uses "*h264_qhw*"
decoder instead of using default "*h264*".

Please guyz help. Am so much stuck here. Am very new to api's of ffmpeg. 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-How-to-use-different-decoders-under-demuxing-decoding-c-example-tp4662355.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Where to define output format for a decoder ?

2016-07-14 Thread ssshukla26
I am implementing a custom decoder for qualcomm chipset. This custom decoder
output is nv12 tiled format. We have already patched ffmpeg with nv12 tile
format along with software conversion from nv12 tile to yuv420p under
libswscale.

My question is how can I specify output format for a decoder ? Is *pix_fmts*
member of *struct AVCodec* is the place where its needed to be added !  If
not, then where ? 

Please help.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Where-to-define-output-format-for-a-decoder-tp4662354.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Failed to open codec in av_find_stream_info ?

2016-07-13 Thread ssshukla26
The problem is with init function of decoder, its declaration is as follow,

*int qhw_decode_init (AVCodecContext *avctx);*

am getting avctx->width as zero (0) and avctx->heigth as zero(0).

So I initialize my decoder with constant values, as decoder->width=1920 and
decoder->height=1080. After that I am getting following error,

*Assertion avctx->internal->buffer_frame->buf[0] failed at
libavcodec/utils.c:2772*

Please help.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Failed-to-open-codec-in-av-find-stream-info-tp4662352p4662353.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Failed to open codec in av_find_stream_info ?

2016-07-13 Thread ssshukla26
Hi, we are adding a custom decoder for qualcomm chipset into ffmpeg. We have
made a linux application which decodes the *h264* file into *nv12 tiled* yuv
raw data file successfully. 

Our aim is to patch ffmpeg with the custom decoder and to upstream the same,
so that anyone on qualcomm chipset are able to use the hardware decoding
capability. Including opensource projects like chromium. 

I have implemented the custom decoder in ffmpeg, but when I use the decoder
with ffmpeg pipe the commands fails as follows, Please help.

$ *ffmpeg -f h264 -c:v h264_qhw -i no_mans_sky_1080p_10sec.h264 -vcodec
rawvideo -pix_fmt nv12_tiled -s 1920x1080 -r 30 output.yuv -loglevel debug
*
ffmpeg version N-80912-gcc42fe8 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 4.9.2 (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC
4.9-2014.09) 20140904 (prerelease)
  configuration: --prefix=comark_SBC_ffmpeg/ --enable-shared
--enable-nonfree --enable-pic --enable-gpl --enable-cross-compile
--cross-prefix=arm-linux-gnueabihf- --arch=arm --target-os=linux
--extra-cflags=-I../sdl/source/SDL-1.2.15/comark_SBC_SDL//include/SDL/
--extra-ldflags='-L../sdl/source/SDL-1.2.15/comark_SBC_SDL//lib/ -lSDL'
  libavutil  55. 28.100 / 55. 28.100
  libavcodec 57. 48.101 / 57. 48.101
  libavformat57. 41.100 / 57. 41.100
  libavdevice57.  0.102 / 57.  0.102
  libavfilter 6. 47.100 /  6. 47.100
  libswscale  4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument
'h264'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'h264_qhw'.
Reading option '-i' ... matched as input file with argument
'no_mans_sky_1080p_10sec.h264'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'rawvideo'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format)
with argument 'nv12_tiled'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1920x1080'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option 'output.yuv' ... matched as output file.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file no_mans_sky_1080p_10sec.h264.
Applying option f (force format) with argument h264.
Applying option c:v (codec name) with argument h264_qhw.
Successfully parsed a group of options.
Opening an input file: no_mans_sky_1080p_10sec.h264.
[file @ 0x4a970] Setting default whitelist 'file,crypto'
[h264 @ 0x4a280] Before avformat_find_stream_info() pos: 0 bytes read:32768
seeks:0 nb_streams:1
Initialized Params
De-Initialized Decoder
De-Initialized Params
*[h264 @ 0x4a280] Failed to open codec in av_find_stream_info*
[NULL @ 0x53430] user data:"x264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0
direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
Initialized Params
De-Initialized Decoder
De-Initialized Params
[h264 @ 0x4a280] max_analyze_duration 500 reached at 504
microseconds st:0
*[h264 @ 0x4a280] Could not find codec parameters for stream 0 (Video: h264
(High), 1 reference frame, none): unspecified size Consider increasing the
value for the 'analyzeduration' and 'probesize' options*
[h264 @ 0x4a280] After avformat_find_stream_info() pos: 1509376 bytes
read:1540096 seeks:0 frames:65
Input #0, h264, from 'no_mans_sky_1080p_10sec.h264':
  Duration: N/A, bitrate: N/A
Stream #0:0, 65, 1/120: Video: h264 (High), 1 reference frame, none,
12.50 fps, 25 tbr, 1200k tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output file output.yuv.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument rawvideo.
Applying option pix_fmt (set pixel format) with argument nv12_tiled.
Applying option s (set frame size (WxH or abbreviation)) with argument
1920x1080.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with
argument 30.
Successfully parsed a group of options.
Opening an output file: 

Re: [Libav-user] Unable to link libavutil with libswscale !

2016-07-10 Thread ssshukla26
Attaching the patch. PFA.  0001-NV12-Tile-pixel-format-support-added.patch

  

I have just changed the file name *nv12tiledconversion.c* to
*nv12tiled2nv12.c*.

Note :- We are planning to upstream this patch when everything falls right
in its place.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Unable-to-link-libavutil-with-libswscale-tp4662334p4662340.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Unable to link libavutil with libswscale !

2016-07-08 Thread ssshukla26
We are adding *nv12 tile* to *yuv420p* format conversion support in
*libswscale*. While adding the support we also found out that the size
calculation under *av_image_fill_pointers function* under
*libavutil/imgutils.c* file also needed to be changed. 

Hence we added support under *libavutil* by making two new files
*special_format.c* and *special_format.h*, and used it along with
*imgutils.c*. 

This special_format.h is consist of four functions namely,
nv12tile_calc_wTiles
nv12tile_calc_hTiles
nv12tile_calc_boundary_padding
nv12tile_calc_plane_size

We used this functions by including *special_format.h* inside
*nv12tileconversion.c* file (our conversion algo is placed in this file)
inside *libswscale* as follows. 
...
...
*#include "libavutil/special_format.h"*
...
...

But on compiling its giving the below errors.

---
libswscale/libswscale.so: undefined reference to `nv12tile_calc_wTiles'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_plane_size'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_hTiles'
collect2: error: ld returned 1 exit status
make: *** [ffplay_g] Error 1
make: *** Waiting for unfinished jobs
libswscale/libswscale.so: undefined reference to `nv12tile_calc_wTiles'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_plane_size'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_hTiles'
collect2: error: ld returned 1 exit status
make: *** [ffprobe_g] Error 1
libswscale/libswscale.so: undefined reference to `nv12tile_calc_wTiles'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_plane_size'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_hTiles'
collect2: error: ld returned 1 exit status
make: *** [ffserver_g] Error 1
libswscale/libswscale.so: undefined reference to `nv12tile_calc_wTiles'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_plane_size'
libswscale/libswscale.so: undefined reference to `nv12tile_calc_hTiles'
collect2: error: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1
---

To solve this we added the lines (in bold as show below) in *Makefile* under
*libswscale*,

---
include $(SUBDIR)../config.mak

NAME = swscale

HEADERS = swscale.h \
  version.h \

OBJS = alphablend.o \
   hscale.o \
   hscale_fast_bilinear.o   \
   gamma.o  \
   input.o  \
   options.o\
   output.o \
   rgb2rgb.o\
   slice.o  \
   swscale.o\
   swscale_unscaled.o   \
   utils.o  \
   yuv2rgb.o\
   vscale.o \
   nv12tiledconversion.o \
*   ./libavutil/special_format.o \*
   
OBJS-$(CONFIG_SHARED)+= log2_tab.o

# Windows resource file
SLIBOBJS-$(HAVE_GNU_WINDRES) += swscaleres.o

TESTPROGS = colorspace  \
swscale
---

My question is how can I compile the ffmpeg libraries *without including*
special_format.o object reference under libswscale Makefile ? 

The reason why am asking this questions is that I have seen many files under
libswscale using files from under libavutil and they are compiling fine, but
am not able to find out why we are facing this errors ! Please help.

*Note* :- configuration of ffmpeg is as show below.

export SDL_PATH=../sdl/

./configure  --enable-shared --enable-nonfree --enable-pic --enable-gpl
--extra-cflags="-I$SDL_PATH/include/SDL/" --extra-ldflags="-L$SDL_PATH/lib/
-lSDL"



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Libav-user-Unable-to-link-libavutil-with-libswscale-tp4662334.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Where and how to add a custom hardware decoder in libavcodec ?

2016-06-09 Thread ssshukla26
Can anyone please guide me on this ! 



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Where-and-how-to-add-a-custom-hardware-decoder-in-libavcodec-tp4662203p4662233.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Where and how to add a custom hardware decoder in libavcodec ?

2016-06-02 Thread ssshukla26
Hi, 

I am new to ffmpeg, am working on a *custom board* which has its own
hardware decoder. 

I have a linux application for hardware decoder which take a h264 file as
input and provides a yuv file as output. It working fine, now we are
extending this support to *gstreamer* and *ffmpeg* libraries. I am familiar
with gstreamer but new to ffmpeg. 

I just need some quick suggestions on where to add a new decoder and an
example (in ffmpeg source) on how to do that ! 

Please guyz help me.



--
View this message in context: 
http://libav-users.943685.n4.nabble.com/Where-and-how-to-add-a-custom-hardware-decoder-in-libavcodec-tp4662203.html
Sent from the libav-users mailing list archive at Nabble.com.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user