By Torin Douglas
Media correspondent, BBC News
X Factor has played a major role in ITV's resurgence
ITV ends the year in far better shape than it began it - thanks in part to an autumn of The X Factor and its all-powerful producer-presenter, Simon Cowell.
Falling audiences and advertising revenue - and the dreadful business outlook - had hit ITV hard, scuppering its share price and reputation, and hampering its attempts to hire a new chief executive.
Now estimates suggest this weekend's two, two-hour X Factor shows could attract £18m in advertising - and more than 18 million viewers - helping ITV1 finally end its month-by-month decline in revenue.
The series has run all autumn, dominating peaktime viewing on both Saturday and Sunday.
The 40 ITV1 shows are said to have brought in more than £75m in advertising, plus revenue from the phone-votes.
One analyst claims the total benefit to ITV is almost £100m, including income from showings on its website itv.com and the ITV2 spin-off show.
ITV's director of entertainment Elaine Bedell says it's no fluke that The X Factor, now in its sixth series, has become even more popular: "It's become much more than just a pop-talent singing show.
"It's a huge entertainment event with all the soap opera that goes around those events, with the judges squabbling or not squabbling, what the girls are wearing, whether Louis is producing his rule book and, of course, the sheer pulling power of Simon Cowell."
Cowell himself has done equally well.
One analyst reckons that the 40 hours of peaktime X Factor shows this autumn will earn him £5m in appearance fees, and a further £2m through his share of the format rights and production fees.
He's now planning to take the show to Las Vegas as part of his global entertainment venture with Sir Philip Green, the retail tycoon.
But ITV insists there's more to its ratings and revenue revival than X Factor.
Another entertainment reality show, I'm A Celebrity, did well too, hosted by ITV stalwarts Ant and Dec and bolstered by the arrival (and subsequent departure) of Katie Price.
Ant and Dec have contributed to ITV's fortunes with their jungle forays
The tabloid favourite helped herself - and ITV - to acres of front-page coverage, as was intended, even if fans on ITV's message-boards bemoaned it turning into "the Katie Price show".
And earlier in the year Britain's Got Talent, another reality show masterminded by Simon Cowell (and hosted by Ant and Dec), also proved a big hit, thanks largely to the discovery of Susan Boyle, an overnight global sensation.
ITV is cashing in this weekend with an hour-long Boyle profile and performance, immediately after the X Factor final. Inevitably, the programme is called I Dreamed a Dream.
It's a sentiment that may strike a chord with Michael Grade, the executive chairman, as he prepares to hand over to ITV's new chairman, the business turnround specialist Archie Norman.
When he arrived at ITV, Grade was applauded by staff, who hoped he could help turn round their fortunes.
Grade's dream of a recovery based on strong programming has not yet been fully realised but, thanks to Simon Cowell and the X Factor, the ITV picture looks a good deal brighter.