Revision 9235dfb8 chunker_streamer/chunker_streamer.c

View differences:

chunker_streamer/chunker_streamer.c
17 17
//#define DEBUG_AUDIO_FRAMES
18 18
//#define DEBUG_VIDEO_FRAMES
19 19
//#define DEBUG_CHUNKER
20
//#define DISPLAY_PSNR
20 21
#define DEBUG_ANOMALIES
21 22
//~ #define DEBUG_TIMESTAMPING
22 23
#define GET_PSNR(x) ((x==0) ? 0 : (-10.0*log(x)/log(10)))
......
394 395
	pCodecCtxEnc->gop_size = gop_size; // emit one intra frame every gop_size frames 
395 396
	pCodecCtxEnc->max_b_frames = max_b_frames;
396 397
	pCodecCtxEnc->pix_fmt = PIX_FMT_YUV420P;
397
	//pCodecCtxEnc->flags = CODEC_FLAG_PSNR;
398
	pCodecCtxEnc->flags |= CODEC_FLAG_PSNR;
398 399
	//~ pCodecCtxEnc->flags |= CODEC_FLAG_QSCALE;
399 400

  
400 401
	//some generic quality tuning
......
443 444
	// pCodecCtxEnc->rc_buffer_size = 0;
444 445
	break;
445 446
    case CODEC_ID_MPEG4 :
447
	pCodecCtxEnc->qmin = 10; // qmin=10
448
	pCodecCtxEnc->qmax = 51; // qmax=51
446 449
	break;
447 450
    default:
448 451
	fprintf(stderr, "INIT: Unsupported OUT VIDEO codec: %s!\n", video_codec);
......
764 767
#ifdef DEBUG_VIDEO_FRAMES
765 768
					if(!vcopy && pCodecCtxEnc->coded_frame) {
766 769
						fprintf(stderr, "VIDEOout: pkt_dts %lld pkt_pts %lld frame.pts %lld\n", pCodecCtxEnc->coded_frame->pkt_dts, pCodecCtxEnc->coded_frame->pkt_pts, pCodecCtxEnc->coded_frame->pts);
767
						fprintf(stderr, "VIDEOout: outtype: %d%s\n",
768
							pCodecCtxEnc->coded_frame->pict_type, pCodecCtxEnc->coded_frame->key_frame ? " (key)" : "");
770
						fprintf(stderr, "VIDEOout: outtype: %d%s\n", pCodecCtxEnc->coded_frame->pict_type, pCodecCtxEnc->coded_frame->key_frame ? " (key)" : "");
771
					}
772
#endif
773
#ifdef DISPLAY_PSNR
774
					static double ist_psnr = 0;
775
					static double cum_psnr = 0;
776
					static int psnr_samples = 0;
777
					if(!vcopy && pCodecCtxEnc->coded_frame) {
778
						if(pCodecCtxEnc->flags&CODEC_FLAG_PSNR) {
779
							ist_psnr = GET_PSNR(pCodecCtxEnc->coded_frame->error[0]/(pCodecCtxEnc->width*pCodecCtxEnc->height*255.0*255.0));
780
							psnr_samples++;
781
							cum_psnr += ist_psnr;
782
							fprintf(stderr, "PSNR: ist %.4f avg: %.4f\n", ist_psnr, cum_psnr / (double)psnr_samples);
783
						}
769 784
					}
770 785
#endif
771 786

  

Also available in: Unified diff